diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-06-17 01:55:36 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-09-27 14:59:29 -0500 |
commit | ac9b5f872d5596897a1f99e439d8c56d670b4a42 (patch) | |
tree | 28465b880f576990e40da569c1acb49a5723e7dc /libs/surfaces/control_protocol | |
parent | 93dd5414d698b8f8d952ccee7ccbe98804671edb (diff) |
add method (taken from GTK GUI) to goto_nth_marker() to BasicUI
Diffstat (limited to 'libs/surfaces/control_protocol')
-rw-r--r-- | libs/surfaces/control_protocol/basic_ui.cc | 31 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/basic_ui.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index aa13060b35..dd18702d4c 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -539,6 +539,37 @@ BasicUI::cancel_all_solo () } } +struct SortLocationsByPosition { + bool operator() (Location* a, Location* b) { + return a->start() < b->start(); + } +}; + +void +BasicUI::goto_nth_marker (int n) +{ + if (!session) { + return; + } + + const Locations::LocationList& l (session->locations()->list()); + Locations::LocationList ordered; + ordered = l; + + SortLocationsByPosition cmp; + ordered.sort (cmp); + + for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) { + if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_session_range()) { + if (n == 0) { + session->request_locate ((*i)->start(), session->transport_rolling()); + break; + } + --n; + } + } +} + #if 0 this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index a09c28e627..069a40c119 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -140,6 +140,8 @@ class LIBCONTROLCP_API BasicUI { void all_tracks_rec_in (); void all_tracks_rec_out (); + void goto_nth_marker (int n); + ARDOUR::framecnt_t timecode_frames_per_hour (); void timecode_time (framepos_t where, Timecode::Time&); |