summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_markers.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-03-01 01:58:53 +1100
committernick_m <mainsbridge@gmail.com>2017-03-01 01:58:53 +1100
commit38b5d887950e72a65341d616bf40195657228271 (patch)
tree4458a00751af2460e02711495d6a0cb18616ca64 /gtk2_ardour/editor_markers.cc
parenta9bb1afb27e90466f1fd73372f1c016401148cac (diff)
allow continuation of tempo via right-click 'Continue' where appropriate.
- this is the opposite of 'Ramp to Next'. it removes discontinuities between the last end tempo and the current by altering the current one.
Diffstat (limited to 'gtk2_ardour/editor_markers.cc')
-rw-r--r--gtk2_ardour/editor_markers.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index c2b09f171c..66911fc34c 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -1000,6 +1000,11 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove)
items.push_back (MenuElem (_("Ramp to Next"), sigc::mem_fun(*this, &Editor::ramp_to_next_tempo)));
}
+ TempoSection* prev_ts = _session->tempo_map().previous_tempo_section (&loc->tempo());
+ if (prev_ts && prev_ts->end_note_types_per_minute() != loc->tempo().note_types_per_minute()) {
+ items.push_back (MenuElem (_("Continue"), sigc::mem_fun(*this, &Editor::continue_previous_tempo)));
+ }
+
if (loc->tempo().position_lock_style() == AudioTime && can_remove) {
items.push_back (MenuElem (_("Lock to Music"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style)));
} else if (can_remove) {
@@ -1461,6 +1466,35 @@ Editor::toggle_tempo_type ()
}
void
+Editor::continue_previous_tempo ()
+{
+ TempoMarker* tm;
+ MeterMarker* mm;
+ dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
+
+ if (tm) {
+ TempoMap& tmap (_session->tempo_map());
+ TempoSection* tsp = &tm->tempo();
+ TempoSection* prev_ts = tmap.previous_tempo_section (&tm->tempo());
+ if (prev_ts) {
+ const Tempo tempo (prev_ts->end_note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute());
+ const double pulse = tsp->pulse();
+ const framepos_t frame = tsp->frame();
+ const PositionLockStyle pls = tsp->position_lock_style();
+
+ begin_reversible_command (_("continue previous tempo"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ tmap.replace_tempo (*tsp, tempo, pulse, frame, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+ }
+}
+
+void
Editor::ramp_to_next_tempo ()
{
TempoMarker* tm;