From 3c00fab75eafb8c347238ad8985078d58fc0f0e9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 27 Nov 2020 12:41:11 -0700 Subject: [PATCH] remove/hide Session::tempo_map() and use TempoMap::use() instead (thread local shared ptr) (GUI edition) --- gtk2_ardour/audio_clock.cc | 31 +++++----- gtk2_ardour/automation_controller.cc | 2 +- gtk2_ardour/automation_line.cc | 6 +- gtk2_ardour/editor.cc | 24 ++++---- gtk2_ardour/editor_actions.cc | 4 +- gtk2_ardour/editor_drag.cc | 37 ++++++------ gtk2_ardour/editor_markers.cc | 31 ++++++---- gtk2_ardour/editor_ops.cc | 42 +++++++------ gtk2_ardour/editor_regions.cc | 7 +-- gtk2_ardour/editor_rulers.cc | 11 ++-- gtk2_ardour/editor_tempodisplay.cc | 88 ++++++++++++++++------------ gtk2_ardour/main_clock.cc | 4 +- gtk2_ardour/midi_region_view.cc | 8 +-- gtk2_ardour/mini_timeline.cc | 2 +- gtk2_ardour/step_editor.cc | 2 +- gtk2_ardour/tempo_dialog.cc | 20 +++---- gtk2_ardour/tempo_dialog.h | 11 ++-- gtk2_ardour/verbose_cursor.cc | 2 +- 18 files changed, 180 insertions(+), 152 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 98a91e9ed7..3b4e77da63 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1234,21 +1234,21 @@ AudioClock::set_bbt (timepos_t const & w, timecnt_t const & o, bool /*force*/) BBT.beats = 0; BBT.ticks = 0; } else { - TempoMap& tmap (_session->tempo_map()); + TempoMap::SharedPtr tmap (TempoMap::use()); if (offset.zero()) { offset = timecnt_t (bbt_reference_time); } - const int divisions = tmap.meter_at (timepos_t (offset)).divisions_per_bar(); + const int divisions = tmap->meter_at (timepos_t (offset)).divisions_per_bar(); Temporal::BBT_Time sub_bbt; if (negative) { - BBT = tmap.bbt_at (tmap.quarter_note_at (timepos_t (offset))); - sub_bbt = tmap.bbt_at (timepos_t (offset - when)); + BBT = tmap->bbt_at (tmap->quarter_note_at (timepos_t (offset))); + sub_bbt = tmap->bbt_at (timepos_t (offset - when)); } else { - BBT = tmap.bbt_at (tmap.quarter_note_at (when + offset)); - sub_bbt = tmap.bbt_at (timepos_t (offset)); + BBT = tmap->bbt_at (tmap->quarter_note_at (when + offset)); + sub_bbt = tmap->bbt_at (timepos_t (offset)); } BBT.bars -= sub_bbt.bars; @@ -1273,7 +1273,7 @@ AudioClock::set_bbt (timepos_t const & w, timecnt_t const & o, bool /*force*/) } } } else { - BBT = _session->tempo_map().bbt_at (when); + BBT = TempoMap::use()->bbt_at (when); } if (negative) { @@ -1295,7 +1295,7 @@ AudioClock::set_bbt (timepos_t const & w, timecnt_t const & o, bool /*force*/) pos = bbt_reference_time; } - TempoMetric m (_session->tempo_map().metric_at (pos)); + TempoMetric m (TempoMap::use()->metric_at (pos)); #ifndef PLATFORM_WINDOWS /* UTF8 1/4 note and 1/8 note ♩ (\u2669) and ♪ (\u266a) are n/a on Windows */ @@ -1331,7 +1331,8 @@ AudioClock::set_session (Session *s) Config->ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context()); _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context()); - _session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this, _1), gui_context()); +#warning NUTEMPO probably need a static signal here, map object will change address etc + // TempoMap::use()->Changed.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this), gui_context()); XMLNode* node = _session->extra_xml (X_("ClockModes")); @@ -1911,19 +1912,19 @@ AudioClock::get_sample_step (Field field, timepos_t const & pos, int dir) BBT.bars = 1; BBT.beats = 0; BBT.ticks = 0; - f = _session->tempo_map().bbt_duration_at (pos,BBT).samples(); + f = TempoMap::use()->bbt_duration_at (pos,BBT).samples(); break; case Beats: BBT.bars = 0; BBT.beats = 1; BBT.ticks = 0; - f = _session->tempo_map().bbt_duration_at(pos,BBT).samples(); + f = TempoMap::use()->bbt_duration_at(pos,BBT).samples(); break; case Ticks: BBT.bars = 0; BBT.beats = 0; BBT.ticks = 1; - f = _session->tempo_map().bbt_duration_at(pos,BBT).samples(); + f = TempoMap::use()->bbt_duration_at(pos,BBT).samples(); break; default: error << string_compose (_("programming error: %1"), "attempt to get samples from non-text field!") << endmsg; @@ -2114,9 +2115,9 @@ AudioClock::samples_from_bbt_string (timepos_t const & pos, const string& str) c if (is_duration) { bbt.bars++; bbt.beats++; - return _session->tempo_map().bbt_duration_at (pos, bbt).samples(); + return TempoMap::use()->bbt_duration_at (pos, bbt).samples(); } else { - return _session->tempo_map().sample_at (bbt, _session->sample_rate()); + return TempoMap::use()->sample_at (bbt, _session->sample_rate()); } } @@ -2135,7 +2136,7 @@ AudioClock::sample_duration_from_bbt_string (timepos_t const & pos, const string return 0; } - return _session->tempo_map().bbt_duration_at(pos,bbt).samples(); + return TempoMap::use()->bbt_duration_at(pos,bbt).samples(); } samplepos_t diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 8daa927d5a..e5b223b4b2 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -284,7 +284,7 @@ AutomationController::set_freq_beats(double beats) const ARDOUR::ParameterDescriptor& desc = _controllable->desc(); const ARDOUR::Session& session = _controllable->session(); const samplepos_t pos = session.transport_sample(); - const Temporal::Tempo& tempo = session.tempo_map().metric_at (pos).tempo(); + const Temporal::Tempo& tempo = Temporal::TempoMap::use()->metric_at (pos).tempo(); const double bpm = tempo.note_types_per_minute(); const double bps = bpm / 60.0; const double freq = bps / beats; diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index d6c4f54f99..3d51abb60f 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -486,7 +486,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) uint32_t sz = size(); if (sz > 0 && sz < line.npoints()) { - const TempoMap& map (e.session()->tempo_map()); + const TempoMap::SharedPtr map (TempoMap::use()); /* determine the limits on x-axis motion for this contiguous range of control points @@ -496,7 +496,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) before_x = line.nth (front()->view_index() - 1)->get_x(); const samplepos_t pos = e.pixel_to_sample(before_x); - const TempoMetric& metric = map.metric_at (pos); + const TempoMetric& metric = map->metric_at (pos); const samplecnt_t len = ceil (metric.samples_per_bar (pos) / (Temporal::ticks_per_beat * metric.meter().divisions_per_bar())); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); @@ -511,7 +511,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) after_x = line.nth (back()->view_index() + 1)->get_x(); const samplepos_t pos = e.pixel_to_sample(after_x); - const TempoMetric& metric = map.metric_at (pos); + const TempoMetric& metric = map->metric_at (pos); const samplecnt_t len = ceil (metric.samples_per_bar (pos) / (Temporal::ticks_per_beat * metric.meter().divisions_per_bar())); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7e028a9739..eac184bd45 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1373,7 +1373,8 @@ Editor::set_session (Session *t) _session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Editor::add_vcas, this, _1), gui_context()); _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Editor::add_routes, this, _1), gui_context()); _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_title, this), gui_context()); - _session->tempo_map().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_changed, this), gui_context()); +#warning NUTEMPO how to catch tempo map changes + // _session->tempo_map().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_changed, this), gui_context()); _session->Located.connect (_session_connections, invalidator (*this), boost::bind (&Editor::located, this), gui_context()); _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::parameter_changed, this, _1), gui_context()); _session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Editor::session_state_saved, this, _1), gui_context()); @@ -1395,7 +1396,7 @@ Editor::set_session (Session *t) restore_ruler_visibility (); //tempo_map_changed (PropertyChange (0)); - _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); + TempoMap::use()->apply_with_metrics (*this, &Editor::draw_metric_marks); for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { (static_cast(*i))->set_samples_per_pixel (samples_per_pixel); @@ -2807,6 +2808,7 @@ timepos_t Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref) { timepos_t ret(presnap); + TempoMap::SharedPtr tmap (TempoMap::use()); if (gpref != SnapToGrid_Unscaled) { // use the visual grid lines which are limited by the zoom scale that the user selected @@ -2839,19 +2841,19 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S case bbt_show_16: case bbt_show_4: case bbt_show_1: - ret = timepos_t (_session->tempo_map().quarter_note_at (_session->tempo_map().round_to_bar (_session->tempo_map().bbt_at (presnap)))); + ret = timepos_t (tmap->quarter_note_at (tmap->round_to_bar (tmap->bbt_at (presnap)))); break; case bbt_show_quarters: - ret = timepos_t (_session->tempo_map().quarter_note_at (presnap).round_to_beat ()); + ret = timepos_t (tmap->quarter_note_at (presnap).round_to_beat ()); break; case bbt_show_eighths: - ret = timepos_t (_session->tempo_map().quarter_note_at (presnap).round_to_subdivision (1 * divisor, direction)); + ret = timepos_t (tmap->quarter_note_at (presnap).round_to_subdivision (1 * divisor, direction)); break; case bbt_show_sixteenths: - ret = timepos_t (_session->tempo_map().quarter_note_at (presnap).round_to_subdivision (2 * divisor, direction)); + ret = timepos_t (tmap->quarter_note_at (presnap).round_to_subdivision (2 * divisor, direction)); break; case bbt_show_thirtyseconds: - ret = timepos_t (_session->tempo_map().quarter_note_at (presnap).round_to_subdivision (4 * divisor, direction)); + ret = timepos_t (tmap->quarter_note_at (presnap).round_to_subdivision (4 * divisor, direction)); break; case bbt_show_sixtyfourths: ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, 8 * divisor, direction); @@ -2861,7 +2863,7 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S break; } } else { - ret = timepos_t (_session->tempo_map().quarter_note_at (presnap).round_to_subdivision (get_grid_beat_divisions(), direction)); + ret = timepos_t (tmap->quarter_note_at (presnap).round_to_subdivision (get_grid_beat_divisions(), direction)); } return ret; @@ -4159,12 +4161,14 @@ Editor::get_grid_type_as_beats (bool& success, timepos_t const & position) return Temporal::Beats::from_double (1.0 / (double) get_grid_beat_divisions ()); } + TempoMap::SharedPtr tmap (TempoMap::use()); + switch (_grid_type) { case GridTypeBeat: - return Temporal::Beats::from_double (4.0 / _session->tempo_map().meter_at (position).note_value()); + return Temporal::Beats::from_double (4.0 / tmap->meter_at (position).note_value()); case GridTypeBar: if (_session) { - const Meter& m = _session->tempo_map().meter_at (position); + const Meter& m = tmap->meter_at (position); return Temporal::Beats::from_double ((4.0 * m.divisions_per_bar()) / m.note_value()); } break; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index f7ff6454ec..eef7b8670d 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1042,13 +1042,13 @@ Editor::set_xjadeo_viewoption (int what) void Editor::edit_current_meter () { - edit_meter_section (_session->tempo_map().metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).meter()); + edit_meter_section (Temporal::TempoMap::use()->metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).meter()); } void Editor::edit_current_tempo () { - edit_tempo_section (_session->tempo_map().metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).tempo()); + edit_tempo_section (Temporal::TempoMap::use()->metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).tempo()); } RefPtr diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 9b47732203..49558e89dc 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3382,7 +3382,7 @@ MeterMarkerDrag::MeterMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c) DEBUG_TRACE (DEBUG::Drags, "New MeterMarkerDrag\n"); assert (_marker); - _movable = !e->session()->tempo_map().is_initial (_marker->meter()); + _movable = !TempoMap::use()->is_initial (_marker->meter()); } void @@ -3401,7 +3401,7 @@ MeterMarkerDrag::setup_pointer_offset () void MeterMarkerDrag::motion (GdkEvent* event, bool first_move) { - TempoMap& map (_editor->session()->tempo_map()); + TempoMap::SharedPtr map (TempoMap::use()); if (first_move) { // create a dummy marker to catch events, then hide it. @@ -3422,14 +3422,14 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) _marker->hide(); /* get current state */ - before_state = &map.get_state(); + before_state = &map->get_state(); if (!_copy) { _editor->begin_reversible_command (_("move meter mark")); } else { timepos_t const pointer = adjusted_current_time (event, false); - BBT_Time pointer_bbt = map.bbt_at (pointer); - Temporal::MeterPoint const & meter = map.metric_at (pointer).meter(); + BBT_Time pointer_bbt = map->bbt_at (pointer); + Temporal::MeterPoint const & meter = map->metric_at (pointer).meter(); BBT_Time bbt = meter.bbt(); /* we can't add a meter where one currently exists */ @@ -3443,17 +3443,17 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) timepos_t pos; - if (map.time_domain() == AudioTime) { - pos = timepos_t (map.sample_at (bbt, _editor->session()->sample_rate())); + if (map->time_domain() == AudioTime) { + pos = timepos_t (map->sample_at (bbt, _editor->session()->sample_rate())); } else { - pos = timepos_t (map.quarter_note_at (bbt)); + pos = timepos_t (map->quarter_note_at (bbt)); } - _marker->reset_meter (map.set_meter (meter, pos)); + _marker->reset_meter (map->set_meter (meter, pos)); } /* only snap to bars. leave snap mode alone for audio locked meters.*/ - if (map.time_domain() != AudioTime) { + if (map->time_domain() != AudioTime) { _editor->set_grid_to (GridTypeBar); _editor->set_snap_mode (SnapMagnetic); } @@ -3470,7 +3470,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) pos = adjusted_current_time (event); } - map.move_meter (_marker->meter(), pos, false); + map->move_meter (_marker->meter(), pos, false); show_verbose_cursor_time (timepos_t (_marker->meter().beats())); _editor->set_snapped_cursor_position (timepos_t (_marker->meter().sample(_editor->session()->sample_rate()))); @@ -3491,10 +3491,11 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred) _editor->set_grid_to (_old_grid_type); _editor->set_snap_mode (_old_snap_mode); - TempoMap& map (_editor->session()->tempo_map()); + TempoMap::SharedPtr map (TempoMap::use()); - XMLNode &after = map.get_state(); - _editor->session()->add_command(new MementoCommand(map, before_state, &after)); + XMLNode &after = map->get_state(); +#warning NUTEMPO memento command issue + //_editor->session()->add_command(new MementoCommand(map, before_state, &after)); _editor->commit_reversible_command (); // delete the dummy marker we used for visual representation while moving. @@ -3512,7 +3513,7 @@ MeterMarkerDrag::aborted (bool moved) _editor->set_grid_to (_old_grid_type); _editor->set_snap_mode (_old_snap_mode); - _editor->session()->tempo_map().set_state (*before_state, Stateful::current_state_version); + TempoMap::use()->set_state (*before_state, Stateful::current_state_version); // delete the dummy marker we used for visual representation while moving. // a new visual marker will show up automatically. delete _marker; @@ -4885,7 +4886,6 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) MarkerSelection::iterator i; CopiedLocationInfo::iterator x; - const int32_t divisions = _editor->get_grid_music_divisions (event->button.state); bool is_start; for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); @@ -5517,7 +5517,6 @@ TimeFXDrag::finished (GdkEvent* event, bool movement_occurred) */ ratio_t fraction (1, 1); - float ffraction; if (movement_occurred) { @@ -6884,7 +6883,7 @@ NoteCreateDrag::grid_aligned_beats (timepos_t const & pos, GdkEvent const * even { Temporal::Beats beats; - TempoMap& map (_editor->session()->tempo_map()); + TempoMap::SharedPtr map (TempoMap::use()); const int32_t divisions = _editor->get_grid_music_divisions (event->button.state); switch (divisions) { @@ -6893,7 +6892,7 @@ NoteCreateDrag::grid_aligned_beats (timepos_t const & pos, GdkEvent const * even beats = pos.beats (); break; case -1: /* round to bar */ - beats = map.quarter_note_at (map.metric_at (pos).meter().round_to_bar (map.bbt_at (pos))); + beats = map->quarter_note_at (map->metric_at (pos).meter().round_to_bar (map->bbt_at (pos))); break; default: /* round to some beat subdivision */ beats = (pos).beats().round_to_subdivision (divisions, Temporal::RoundNearest); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 42b2149415..02fdb87e46 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1080,7 +1080,7 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove) items.push_back (MenuElem (_("Set Constant"), sigc::mem_fun(*this, &Editor::toggle_tempo_type))); } - Temporal::Tempo const * next_ts = _session->tempo_map().next_tempo (loc->tempo()); + Temporal::Tempo const * next_ts = Temporal::TempoMap::use()->next_tempo (loc->tempo()); if (next_ts && next_ts->note_types_per_minute() != loc->tempo().end_note_types_per_minute()) { items.push_back (MenuElem (_("Ramp to Next"), sigc::mem_fun(*this, &Editor::ramp_to_next_tempo))); } @@ -1500,12 +1500,14 @@ Editor::toggle_tempo_type () Temporal::TempoPoint & tempo = tm->tempo(); begin_reversible_command (_("set tempo to constant")); - XMLNode &before = _session->tempo_map().get_state(); + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode &before = tmap->get_state(); - _session->tempo_map().set_ramped (tempo, !tempo.ramped()); + tmap->set_ramped (tempo, !tempo.ramped()); - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO map object may change + //_session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } } @@ -1519,13 +1521,16 @@ Editor::toggle_tempo_clamped () if (tm) { begin_reversible_command (_("Clamp Tempo")); - XMLNode &before = _session->tempo_map().get_state(); + + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode &before = tmap->get_state(); Temporal::Tempo & tempo (tm->tempo()); if (tempo.set_clamped (!tempo.clamped())) { - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO paul knows the drill by now + //_session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } else { abort_reversible_command (); @@ -1544,12 +1549,14 @@ Editor::ramp_to_next_tempo () if (tm) { begin_reversible_command (_("ramp to next tempo")); - XMLNode &before = _session->tempo_map().get_state(); + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode &before = tmap->get_state(); Temporal::TempoPoint & tempo (tm->tempo()); - if (_session->tempo_map().set_ramped (tempo, !tempo.ramped())) { - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + if (tmap->set_ramped (tempo, !tempo.ramped())) { + XMLNode &after = tmap->get_state(); +#warning NUTEMPO see previous warning + // _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } else { abort_reversible_command (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c18f32e12b..7a939066fb 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -7082,7 +7082,8 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end) { timecnt_t length = start.distance (end); - const Meter& m (_session->tempo_map().meter_at (start)); + TempoMap::SharedPtr tmap (TempoMap::use()); + const Meter& m (tmap->meter_at (start)); /* length = 1 bar */ @@ -7106,11 +7107,11 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end) */ - const TempoPoint& t (_session->tempo_map().tempo_at (start)); + const TempoPoint& t (tmap->tempo_at (start)); bool do_global = false; - if ((_session->tempo_map().n_tempos() == 1) && (_session->tempo_map().n_meters() == 1)) { + if ((tmap->n_tempos() == 1) && (tmap->n_meters() == 1)) { /* only 1 tempo & 1 meter: ask if the user wants to set the tempo at the start, or create a new marker @@ -7150,21 +7151,22 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end) } begin_reversible_command (_("set tempo from region")); - XMLNode& before (_session->tempo_map().get_state()); + XMLNode& before (tmap->get_state()); if (do_global) { - _session->tempo_map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), timepos_t()); + tmap->set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), timepos_t()); } else if (t.time() == start) { - _session->tempo_map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), start); + tmap->set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), start); } else { /* constant tempo */ const Tempo tempo (beats_per_minute, t.note_type()); - _session->tempo_map().set_tempo (tempo, start); + tmap->set_tempo (tempo, start); } - XMLNode& after (_session->tempo_map().get_state()); + XMLNode& after (tmap->get_state()); - _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); +#warning NUTEMPO memento command tempo map issues + // _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } @@ -8098,11 +8100,13 @@ Editor::insert_time ( begin_reversible_command (_("insert time")); in_command = true; } - XMLNode& before (_session->tempo_map().get_state()); -#warning NUTEMPO need new map API - //_session->tempo_map().insert_time (pos, samples); - XMLNode& after (_session->tempo_map().get_state()); - _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); + TempoMap::SharedPtr tmap (TempoMap::use()); + + XMLNode& before (tmap->get_state()); + tmap->insert_time (pos, samples); + XMLNode& after (tmap->get_state()); +#warning NUTEMPO memento command tempo map issues + // _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); } if (in_command) { @@ -8273,15 +8277,17 @@ Editor::remove_time (timepos_t const & pos, timecnt_t const & duration, InsertTi } if (tempo_too) { - XMLNode& before (_session->tempo_map().get_state()); + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode& before (tmap->get_state()); - if (_session->tempo_map().remove_time (pos, duration)) { + if (tmap->remove_time (pos, duration)) { if (!in_command) { begin_reversible_command (_("remove time")); in_command = true; } - XMLNode& after (_session->tempo_map().get_state()); - _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); + XMLNode& after (tmap->get_state()); +#warning NUTEMPO memento command tempo map issue + //_session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); } } diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index eb70afe6f5..84b21ab670 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -617,7 +617,7 @@ EditorRegions::format_position (timepos_t const & p, char* buf, size_t bufsize, switch (ARDOUR_UI::instance ()->primary_clock->mode ()) { case AudioClock::BBT: - bbt = _session->tempo_map ().bbt_at (pos); + bbt = Temporal::TempoMap::use()->bbt_at (pos); if (onoff) { snprintf (buf, bufsize, "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks); } else { @@ -774,10 +774,9 @@ EditorRegions::populate_row_length (boost::shared_ptr region, TreeModel: char buf[16]; if (ARDOUR_UI::instance ()->primary_clock->mode () == AudioClock::BBT) { - TempoMap& map (_session->tempo_map ()); -#warning NUTEMPO we need TempoMap::full_duration() to work with BBT Time here + TempoMap::SharedPtr map (TempoMap::use()); Temporal::BBT_Time bbt; /* uninitialized until full duration works */ - // Temporal::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample ()) - map.beat_at_sample (region->first_sample ())); + // Temporal::BBT_Time bbt = map->bbt_duration_at (region->position(), region->length()); snprintf (buf, sizeof (buf), "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks); } else { format_position (timepos_t (region->nt_length ()), buf, sizeof (buf)); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index ba8b24eae2..99ec3c1335 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -980,14 +980,15 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper) std::vector::const_iterator i; Temporal::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler - Beats floor_lower_beat = std::max (Beats(), _session->tempo_map().quarter_note_at (lower)).round_down_to_beat (); + Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); + Beats floor_lower_beat = std::max (Beats(), tmap->quarter_note_at (lower)).round_down_to_beat (); if (floor_lower_beat < 0.0) { floor_lower_beat = 0.0; } - const samplepos_t beat_before_lower_pos = _session->tempo_map().sample_at (floor_lower_beat, _session->sample_rate()); - const samplepos_t beat_after_upper_pos = _session->tempo_map().sample_at ((std::max (Beats(), _session->tempo_map().quarter_note_at (upper)).round_down_to_beat()) + Beats (1, 0), _session->sample_rate()); + const samplepos_t beat_before_lower_pos = tmap->sample_at (floor_lower_beat, _session->sample_rate()); + const samplepos_t beat_after_upper_pos = tmap->sample_at ((std::max (Beats(), tmap->quarter_note_at (upper)).round_down_to_beat()) + Beats (1, 0), _session->sample_rate()); _session->bbt_time (timepos_t (beat_before_lower_pos), lower_beat); _session->bbt_time (timepos_t (beat_after_upper_pos), upper_beat); @@ -1005,7 +1006,7 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper) return; } - bbt_bars = _session->tempo_map().bbt_at (ceil_upper_beat).bars - _session->tempo_map().bbt_at (floor_lower_beat).bars; + bbt_bars = tmap->bbt_at (ceil_upper_beat).bars - tmap->bbt_at (floor_lower_beat).bars; double ruler_line_granularity = UIConfiguration::instance().get_ruler_granularity (); //in pixels ruler_line_granularity = _visible_canvas_width / (ruler_line_granularity*5); //fudge factor '5' probably related to (4+1 beats)/measure, I think @@ -1375,7 +1376,7 @@ Editor::metric_get_bbt (std::vector& marks, int64_t l next_beat.beats = (*i).bbt().beats; next_beat.bars = (*i).bbt().bars; next_beat.ticks = tick; - pos = _session->tempo_map().sample_at (next_beat, sr); + pos = TempoMap::use()->sample_at (next_beat, sr); if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) { i_am_accented = true; diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 44f54203db..e00344746b 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -192,7 +192,7 @@ Editor::tempo_map_changed () compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples()); - _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers + TempoMap::use()->apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers update_tempo_based_rulers (); maybe_draw_grid_lines (); @@ -334,8 +334,9 @@ Editor::compute_current_bbt_points (Temporal::TempoMapPoints& grid, samplepos_t /* prevent negative values of leftmost from creeping into tempomap */ - const Beats lower_beat = max (Beats (), _session->tempo_map().quarter_note_at (leftmost)).round_down_to_beat() - Beats (1, 0); + const Beats lower_beat = max (Beats (), TempoMap::use()->quarter_note_at (leftmost)).round_down_to_beat() - Beats (1, 0); const samplecnt_t sr (_session->sample_rate()); + TempoMap::SharedPtr tmap (TempoMap::use()); switch (bbt_ruler_scale) { @@ -345,28 +346,28 @@ Editor::compute_current_bbt_points (Temporal::TempoMapPoints& grid, samplepos_t case bbt_show_thirtyseconds: case bbt_show_sixtyfourths: case bbt_show_onetwentyeighths: - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0); break; case bbt_show_1: - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 1); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), rightmost, 1); break; case bbt_show_4: - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 4); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), rightmost, 4); break; case bbt_show_16: - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 16); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), rightmost, 16); break; case bbt_show_64: - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 64); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), rightmost, 64); break; default: /* bbt_show_many */ - _session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 128); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), rightmost, 128); break; } } @@ -414,19 +415,21 @@ Editor::mouse_add_new_tempo_event (timepos_t pos) return; } - TempoMap& map(_session->tempo_map()); + TempoMap::SharedPtr map (TempoMap::use()); begin_reversible_command (_("add tempo mark")); - const Beats qn = map.quarter_note_at (pos); + const Beats qn = map->quarter_note_at (pos); if (qn > Beats()) { - XMLNode &before = map.get_state(); + XMLNode &before = map->get_state(); /* add music-locked ramped (?) tempo using the bpm/note type at sample*/ - map.set_tempo (map.tempo_at (pos), timepos_t (qn)); - XMLNode &after = map.get_state(); - _session->add_command(new MementoCommand(map, &before, &after)); + map->set_tempo (map->tempo_at (pos), timepos_t (qn)); + + XMLNode &after = map->get_state(); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + //_session->add_command(new MementoCommand(map, &before, &after)); commit_reversible_command (); } @@ -442,7 +445,7 @@ Editor::mouse_add_new_meter_event (timepos_t pos) #warning NUTEMPO requires new tempo map API #if 0 - TempoMap& map(_session->tempo_map()); + TempoMap::SharedPtr map (TempoMap::use()); MeterDialog meter_dialog (map, pos, _("add")); switch (meter_dialog.run ()) { @@ -463,15 +466,16 @@ Editor::mouse_add_new_meter_event (timepos_t pos) const double al_sample = map.sample_at_bbt (requested); begin_reversible_command (_("add meter mark")); - XMLNode &before = map.get_state(); + XMLNode &before = map->get_state(); if (meter_dialog.get_lock_style() == MusicTime) { - map.add_meter (Meter (bpb, note_type), requested, 0, MusicTime); + map->set_meter (Meter (bpb, note_type), requested); } else { - map.add_meter (Meter (bpb, note_type), requested, al_sample, AudioTime); + map->set_meter (Meter (bpb, note_type), requested); } - _session->add_command(new MementoCommand(map, &before, &map.get_state())); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + // _session->add_command(new MementoCommand(map, &before, &map.get_state())); commit_reversible_command (); #endif //map.dump (cerr); @@ -501,7 +505,7 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item) void Editor::edit_meter_section (Temporal::MeterPoint& section) { - MeterDialog meter_dialog (_session->tempo_map(), section, _("done")); + MeterDialog meter_dialog (section, _("done")); switch (meter_dialog.run()) { case RESPONSE_ACCEPT: @@ -519,20 +523,23 @@ Editor::edit_meter_section (Temporal::MeterPoint& section) Temporal::BBT_Time when; meter_dialog.get_bbt_time (when); + TempoMap::SharedPtr tmap (TempoMap::use()); + begin_reversible_command (_("replace meter mark")); - XMLNode &before = _session->tempo_map().get_state(); + XMLNode &before = tmap->get_state(); - _session->tempo_map().set_meter (meter, when); + tmap->set_meter (meter, when); - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + // _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } void Editor::edit_tempo_section (TempoPoint& section) { - TempoDialog tempo_dialog (_session->tempo_map(), section, _("done")); + TempoDialog tempo_dialog (TempoMap::use(), section, _("done")); switch (tempo_dialog.run ()) { case RESPONSE_ACCEPT: @@ -547,16 +554,19 @@ Editor::edit_tempo_section (TempoPoint& section) bpm = max (0.01, bpm); const Tempo tempo (bpm, nt, end_bpm); + TempoMap::SharedPtr tmap (TempoMap::use()); + Temporal::BBT_Time when; tempo_dialog.get_bbt_time (when); begin_reversible_command (_("replace tempo mark")); - XMLNode &before = _session->tempo_map().get_state(); + XMLNode &before = tmap->get_state(); - _session->tempo_map().set_tempo (tempo, when); + tmap->set_tempo (tempo, when); - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + // _session->add_command (new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); } @@ -576,10 +586,12 @@ gint Editor::real_remove_tempo_marker (TempoPoint *section) { begin_reversible_command (_("remove tempo mark")); - XMLNode &before = _session->tempo_map().get_state(); - _session->tempo_map().remove_tempo (*section); - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode &before = tmap->get_state(); + tmap->remove_tempo (*section); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + // _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); return FALSE; @@ -610,10 +622,12 @@ gint Editor::real_remove_meter_marker (Temporal::MeterPoint *section) { begin_reversible_command (_("remove tempo mark")); - XMLNode &before = _session->tempo_map().get_state(); - _session->tempo_map().remove_meter (*section); - XMLNode &after = _session->tempo_map().get_state(); - _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + TempoMap::SharedPtr tmap (TempoMap::use()); + XMLNode &before = tmap->get_state(); + tmap->remove_meter (*section); + XMLNode &after = tmap->get_state(); +#warning NUTEMPO uh-oh ... how to do this when the object may just go away + //_session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); commit_reversible_command (); return FALSE; diff --git a/gtk2_ardour/main_clock.cc b/gtk2_ardour/main_clock.cc index 354f6ed2fc..7687b5f01e 100644 --- a/gtk2_ardour/main_clock.cc +++ b/gtk2_ardour/main_clock.cc @@ -150,14 +150,14 @@ void MainClock::edit_current_tempo () { if (!PublicEditor::instance().session()) return; - PublicEditor::instance().edit_tempo_section (PublicEditor::instance().session()->tempo_map().tempo_at (absolute_time())); + PublicEditor::instance().edit_tempo_section (Temporal::TempoMap::use()->tempo_at (absolute_time())); } void MainClock::edit_current_meter () { if (!PublicEditor::instance().session()) return; - PublicEditor::instance().edit_meter_section (PublicEditor::instance().session()->tempo_map().meter_at (absolute_time())); + PublicEditor::instance().edit_meter_section (Temporal::TempoMap::use()->meter_at (absolute_time())); } void diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 6fbd2ee849..88512fe236 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2931,8 +2931,8 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_ snapped_x = trackview.editor ().pixel_to_sample (current_x); /* samples */ } - Temporal::TempoMap& tmap (trackview.session()->tempo_map()); - const timepos_t abs_beats (tmap.quarter_note_at (snapped_x)); + Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); + const timepos_t abs_beats (tmap->quarter_note_at (snapped_x)); const Temporal::Beats beats = _region->absolute_time_to_source_beats (abs_beats); Temporal::Beats len = Temporal::Beats(); @@ -3027,9 +3027,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_ } /* and then to beats */ -#warning NUTEMPO need new tempo map - //const timepos_t abs_beats (tmap.quarter_note_at (current_time)); - const timepos_t abs_beats; + const timepos_t abs_beats (Temporal::TempoMap::use()->quarter_note_at (current_time)); const Temporal::Beats x_beats = _region->absolute_time_to_source_beats (abs_beats); if (at_front && x_beats < canvas_note->note()->end_time()) { diff --git a/gtk2_ardour/mini_timeline.cc b/gtk2_ardour/mini_timeline.cc index b81f44c4bb..b3f4a86a4f 100644 --- a/gtk2_ardour/mini_timeline.cc +++ b/gtk2_ardour/mini_timeline.cc @@ -273,7 +273,7 @@ MiniTimeline::format_time (samplepos_t when) case AudioClock::BBT: { char buf[64]; - Temporal::BBT_Time BBT = _session->tempo_map().bbt_at (when); + Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (when); snprintf (buf, sizeof (buf), "%03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32, BBT.bars, BBT.beats, BBT.ticks); _layout->set_text (buf); diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index aff7f507dd..d0634b23b3 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -116,7 +116,7 @@ StepEditor::prepare_step_edit_region () } else { - const Meter& m = _mtv.session()->tempo_map().meter_at (step_edit_insert_position); + const Meter& m = Temporal::TempoMap::use()->meter_at (step_edit_insert_position); /* 1 bar long region */ step_edit_region = _mtv.add_region (step_edit_insert_position, timecnt_t (Beats::beats (m.divisions_per_bar()), step_edit_insert_position), true); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 05a8d73804..1e4c1902ee 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -44,9 +44,9 @@ using namespace ARDOUR; using namespace PBD; using namespace Temporal; -TempoDialog::TempoDialog (TempoMap& map, timepos_t const & pos, const string&) +TempoDialog::TempoDialog (TempoMap::SharedPtr const & map, timepos_t const & pos, const string&) : ArdourDialog (_("New Tempo")) - , _map (&map) + , _map (map) , _section (0) , bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0) , bpm_spinner (bpm_adjustment) @@ -64,9 +64,9 @@ TempoDialog::TempoDialog (TempoMap& map, timepos_t const & pos, const string&) init (when, tempo.note_types_per_minute(), tempo.end_note_types_per_minute(), tempo.note_type(), Tempo::Constant, true, BeatTime); } -TempoDialog::TempoDialog (TempoMap& map, TempoPoint& point, const string&) +TempoDialog::TempoDialog (TempoMap::SharedPtr const & map, TempoPoint& point, const string&) : ArdourDialog (_("Edit Tempo")) - , _map (&map) + , _map (map) , _section (&point) , bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0) , bpm_spinner (bpm_adjustment) @@ -78,9 +78,9 @@ TempoDialog::TempoDialog (TempoMap& map, TempoPoint& point, const string&) , pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER) , tap_tempo_button (_("Tap tempo")) { - Temporal::BBT_Time when (map.bbt_at (point.time())); + Temporal::BBT_Time when (map->bbt_at (point.time())); init (when, _section->note_types_per_minute(), _section->end_note_types_per_minute(), _section->note_type(), _section->type(), - (map.is_initial (point) ||(map.time_domain() == Temporal::BarTime)), map.time_domain()); + (map->is_initial (point) ||(map->time_domain() == Temporal::BarTime)), map->time_domain()); } void @@ -487,16 +487,16 @@ TempoDialog::tap_tempo_focus_out (GdkEventFocus* ) return false; } -MeterDialog::MeterDialog (TempoMap& map, timepos_t const & pos, const string&) +MeterDialog::MeterDialog (TempoMap::SharedPtr const & map, timepos_t const & pos, const string&) : ArdourDialog (_("New Meter")) { - Temporal::BBT_Time when (map.round_to_bar (map.bbt_at (pos))); - Meter& meter (map.meter_at (when)); + Temporal::BBT_Time when (map->round_to_bar (map->bbt_at (pos))); + Meter& meter (map->meter_at (when)); init (when, meter.divisions_per_bar(), meter.note_value(), false, pos.time_domain()); } -MeterDialog::MeterDialog (TempoMap& map, Temporal::MeterPoint& section, const string&) +MeterDialog::MeterDialog (Temporal::MeterPoint& section, const string&) : ArdourDialog (_("Edit Meter")) { init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), section.map().time_domain()); diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index b357e7b720..48fca6b394 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -43,8 +43,8 @@ class TempoDialog : public ArdourDialog { public: - TempoDialog (Temporal::TempoMap&, Temporal::timepos_t const & , const std::string & action); - TempoDialog (Temporal::TempoMap&, Temporal::TempoPoint&, const std::string & action); + TempoDialog (Temporal::TempoMap::SharedPtr const &, Temporal::timepos_t const & , const std::string & action); + TempoDialog (Temporal::TempoMap::SharedPtr const &, Temporal::TempoPoint&, const std::string & action); double get_bpm (); double get_end_bpm (); @@ -84,7 +84,7 @@ private: double last_t; gint64 first_t; - Temporal::TempoMap* _map; + Temporal::TempoMap::SharedPtr _map; Temporal::TempoPoint* _section; Gtk::ComboBoxText pulse_selector; @@ -106,9 +106,8 @@ private: class MeterDialog : public ArdourDialog { public: - - MeterDialog (Temporal::TempoMap&, Temporal::timepos_t const &, const std::string & action); - MeterDialog (Temporal::TempoMap&, Temporal::MeterPoint&, const std::string & action); + MeterDialog (Temporal::TempoMap::SharedPtr const & , Temporal::timepos_t const &, const std::string & action); + MeterDialog (Temporal::MeterPoint&, const std::string & action); double get_bpb (); double get_note_type (); diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index b4ee7d6789..ae5db419c0 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -145,7 +145,7 @@ VerboseCursor::set_duration (samplepos_t start, samplepos_t end) Timecode::Time timecode; Temporal::BBT_Time sbbt; Temporal::BBT_Time ebbt; - Meter& meter_at_start (_editor->_session->tempo_map().metric_at (start).meter()); + Meter& meter_at_start (TempoMap::use()->metric_at (start).meter()); if (_editor->_session == 0) { return;