summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_markers.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-02-27 03:03:55 +1100
committerRobin Gareus <robin@gareus.org>2017-02-27 20:16:10 +0100
commit663d0e17431e0f841b4a5cde320323d78852a3b2 (patch)
tree3ffb6f459b56b8c931f59a2e8babfb11d1520baf /gtk2_ardour/editor_markers.cc
parentf8a6f8918d0b7f719748bc26e4abf5d2c25174db (diff)
add right-click 'Ramp to Next' tempo marker menu item.
Diffstat (limited to 'gtk2_ardour/editor_markers.cc')
-rw-r--r--gtk2_ardour/editor_markers.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 1e8074c7f3..38a84543ca 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -995,6 +995,10 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove)
items.push_back (MenuElem (_("Set Constant"), sigc::mem_fun(*this, &Editor::toggle_tempo_type)));
}
+ if (_session->tempo_map().next_tempo_section (&loc->tempo())) {
+ items.push_back (MenuElem (_("Ramp to Next"), sigc::mem_fun(*this, &Editor::ramp_to_next_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) {
@@ -1456,6 +1460,37 @@ Editor::toggle_tempo_type ()
}
void
+Editor::ramp_to_next_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* next_ts = tmap.next_tempo_section (&tm->tempo());
+ if (next_ts) {
+ const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), next_ts->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 (_("ramp to next 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 ();
+ }
+ //const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type());
+
+ }
+}
+
+void
Editor::toggle_marker_menu_lock ()
{
ArdourMarker* marker;