add syntax and scaffolding for MIDI binding maps to refer to selected tracks/busses.
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 17 Nov 2015 23:00:36 +0000 (18:00 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:25 +0000 (15:31 -0500)
THIS DOES NOT WORK YET. Selection information is not available in libardour at this time

libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/pbd/controllable_descriptor.cc
libs/pbd/pbd/controllable_descriptor.h

index a3e352985442fa9379e149167012836afe09a2d4..15b7fe2fb5e9692e392ab5b42fc210334c6ff84b 100644 (file)
@@ -279,6 +279,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        boost::shared_ptr<Route> route_by_name (std::string);
        boost::shared_ptr<Route> route_by_id (PBD::ID);
        boost::shared_ptr<Route> route_by_remote_id (uint32_t id);
+       boost::shared_ptr<Route> route_by_selected_count (uint32_t cnt);
        boost::shared_ptr<Track> track_by_diskstream_id (PBD::ID);
        void routes_using_input_from (const std::string& str, RouteList& rl);
 
index 725d94c3cc13ec2be7fb887ed8bd15d91b007787..c9fd336314d5a62788d99eb496c76ebe594efe2e 100644 (file)
@@ -4061,6 +4061,19 @@ Session::route_by_remote_id (uint32_t id)
 }
 
 
+boost::shared_ptr<Route>
+Session::route_by_selected_count (uint32_t id)
+{
+       boost::shared_ptr<RouteList> r = routes.reader ();
+
+       for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+               /* NOT IMPLEMENTED */
+       }
+
+       return boost::shared_ptr<Route> ((Route*) 0);
+}
+
+
 void
 Session::reassign_track_numbers ()
 {
index 5ad9769ad6b7f963867321d783b2270b6a536d26..fcd16788d839ddf95faee637c25d70f61442de51 100644 (file)
@@ -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) {
index 0228d004e4984729e9b29ad736ccef8b8f6ab456..dce734127d500700d87341396ebbeb74cd53524c 100644 (file)
@@ -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
 {
index e4366c86eb2d051bc21571b37f15b1a3c46cfe90..b7eb26988e0c8c32cfed1bb4fa6b4f413e373209 100644 (file)
@@ -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<uint32_t> _target;
     uint32_t              _banked;
     uint32_t              _bank_offset;