From e9234c856a783ff3e585e1852852c72843d8ce7f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 17 Nov 2015 18:00:36 -0500 Subject: [PATCH] add syntax and scaffolding for MIDI binding maps to refer to selected tracks/busses. THIS DOES NOT WORK YET. Selection information is not available in libardour at this time --- libs/ardour/ardour/session.h | 1 + libs/ardour/session.cc | 13 +++++++++++++ libs/ardour/session_state.cc | 4 ++++ libs/pbd/controllable_descriptor.cc | 16 +++++++++++++++- libs/pbd/pbd/controllable_descriptor.h | 9 +++++++-- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a3e3529854..15b7fe2fb5 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -279,6 +279,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr route_by_name (std::string); boost::shared_ptr route_by_id (PBD::ID); boost::shared_ptr route_by_remote_id (uint32_t id); + boost::shared_ptr route_by_selected_count (uint32_t cnt); boost::shared_ptr track_by_diskstream_id (PBD::ID); void routes_using_input_from (const std::string& str, RouteList& rl); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 725d94c3cc..c9fd336314 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4061,6 +4061,19 @@ Session::route_by_remote_id (uint32_t id) } +boost::shared_ptr +Session::route_by_selected_count (uint32_t id) +{ + boost::shared_ptr r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + /* NOT IMPLEMENTED */ + } + + return boost::shared_ptr ((Route*) 0); +} + + void Session::reassign_track_numbers () { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 5ad9769ad6..fcd16788d8 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -3339,6 +3339,10 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc) case ControllableDescriptor::RemoteControlID: r = route_by_remote_id (desc.rid()); break; + + case ControllableDescriptor::SelectionCount: + r = route_by_selected_count (desc.selection_id()); + break; } if (!r) { diff --git a/libs/pbd/controllable_descriptor.cc b/libs/pbd/controllable_descriptor.cc index 0228d004e4..dce734127d 100644 --- a/libs/pbd/controllable_descriptor.cc +++ b/libs/pbd/controllable_descriptor.cc @@ -56,6 +56,10 @@ ControllableDescriptor::set (const std::string& str) if (rest[0][0] == 'B') { _banked = true; _rid = atoi (rest[0].substr (1)); + } else if (rest[0][0] == 'S') { + _top_level_type = SelectionCount; + _banked = true; + _selection_id = atoi (rest[0].substr (1)); } else if (isdigit (rest[0][0])) { _banked = false; _rid = atoi (rest[0]); @@ -123,7 +127,7 @@ ControllableDescriptor::set (const std::string& str) } uint32_t -ControllableDescriptor::rid() const +ControllableDescriptor::rid () const { if (banked()) { return _rid + _bank_offset; @@ -132,6 +136,16 @@ ControllableDescriptor::rid() const return _rid; } +uint32_t +ControllableDescriptor::selection_id () const +{ + if (banked()) { + return _selection_id + _bank_offset; + } + + return _selection_id; +} + uint32_t ControllableDescriptor::target (uint32_t n) const { diff --git a/libs/pbd/pbd/controllable_descriptor.h b/libs/pbd/pbd/controllable_descriptor.h index e4366c86eb..b7eb26988e 100644 --- a/libs/pbd/pbd/controllable_descriptor.h +++ b/libs/pbd/pbd/controllable_descriptor.h @@ -31,7 +31,8 @@ class LIBPBD_API ControllableDescriptor { public: enum TopLevelType { RemoteControlID, - NamedRoute + NamedRoute, + SelectionCount, }; enum SubType { @@ -68,6 +69,7 @@ public: SubType subtype() const { return _subtype; } uint32_t rid() const; + uint32_t selection_id() const; uint32_t target (uint32_t n) const; bool banked() const { return _banked; } @@ -77,7 +79,10 @@ private: TopLevelType _top_level_type; SubType _subtype; std::string _top_level_name; - uint32_t _rid; + union { + uint32_t _rid; + uint32_t _selection_id; + }; std::vector _target; uint32_t _banked; uint32_t _bank_offset; -- 2.30.2