diff options
author | nick_m <mainsbridge@gmail.com> | 2015-12-23 05:58:49 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:09 +1000 |
commit | 340bd42c62a10578eb0314faf67eff115b975c2a (patch) | |
tree | f0d868311715690bdd8b53628877014a30f0dbbe /gtk2_ardour | |
parent | 7898435d3f94355fa0996dc9f85b3bc1ef173585 (diff) |
Tempo ramps - allow live updating of tempo markers.
- all a bit slow, but should be ok once we can lock
markers to frames.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 22 |
5 files changed, 34 insertions, 4 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7353b6ff38..0d7717614c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1365,6 +1365,7 @@ Editor::set_session (Session *t) _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().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_changed, this, _1), gui_context()); + _session->tempo_map().MetricPositionChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::marker_position_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()); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 139e044eae..7a2988005d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1697,6 +1697,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void compute_current_bbt_points (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, framepos_t left, framepos_t right); void tempo_map_changed (const PBD::PropertyChange&); + void marker_position_changed (); void redisplay_tempo (bool immediate_redraw); uint32_t bbt_beat_subdivision; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 238a0d8ab0..dccb6cac51 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -515,7 +515,6 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit) if (_editor->session()) { const TempoMap& map (_editor->session()->tempo_map()); framecnt_t pos = grab_frame(); - const Meter& m = map.meter_at (pos); /* not that the frame rate used here can be affected by pull up/down which might be wrong. */ @@ -3255,6 +3254,7 @@ TempoMarkerDrag::TempoMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c) DEBUG_TRACE (DEBUG::Drags, "New TempoMarkerDrag\n"); _marker = reinterpret_cast<TempoMarker*> (_item->get_data ("marker")); + _real_section = &_marker->tempo(); assert (_marker); } @@ -3310,12 +3310,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) /* get current state */ before_state = &map.get_state(); /* remove the section while we drag it */ - map.remove_tempo (section, true); + //map.remove_tempo (section, true); } } - framepos_t const pf = adjusted_current_frame (event); + framepos_t const pf = adjusted_current_frame (event, false); + TempoMap& map (_editor->session()->tempo_map()); _marker->set_position (pf); + map.gui_set_tempo_frame (*_real_section, pf); + show_verbose_cursor_time (pf); } @@ -3351,7 +3354,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) } else { /* we removed it before, so add it back now */ - map.add_tempo (_marker->tempo(), when, _marker->tempo().type()); + map.replace_tempo (*_real_section, _marker->tempo().beats_per_minute() , when, _marker->tempo().type()); XMLNode &after = map.get_state(); _editor->session()->add_command (new MementoCommand<TempoMap>(map, before_state, &after)); _editor->commit_reversible_command (); diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index cd1b0c2474..bd2672e23e 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -25,6 +25,7 @@ #include <gdk/gdk.h> #include <stdint.h> +#include "ardour/tempo.h" #include "ardour/types.h" #include "canvas/types.h" @@ -731,6 +732,8 @@ public: private: TempoMarker* _marker; + ARDOUR::TempoSection* _real_section; + bool _copy; XMLNode* before_state; }; diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 2d5a3e47d5..2794051265 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -101,6 +101,7 @@ Editor::draw_metric_marks (const Metrics& metrics) } + void Editor::tempo_map_changed (const PropertyChange& /*ignored*/) { @@ -123,6 +124,27 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/) } void +Editor::marker_position_changed () +{ +// yes its identical... + if (!_session) { + return; + } + + ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed); + + if (tempo_lines) { + tempo_lines->tempo_map_changed(); + } + + std::vector<TempoMap::BBTPoint> grid; + compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples()); + _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers + draw_measures (grid); + update_tempo_based_rulers (grid); +} + +void Editor::redisplay_tempo (bool immediate_redraw) { if (!_session) { |