summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-11-17 18:00:36 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-22 15:31:25 -0500
commite9234c856a783ff3e585e1852852c72843d8ce7f (patch)
treecee77bff81a74cc4c57c840503b2338cd31a1ff9
parent47cf908998f51a89a2c2041af87e2675258ef888 (diff)
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
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/session.cc13
-rw-r--r--libs/ardour/session_state.cc4
-rw-r--r--libs/pbd/controllable_descriptor.cc16
-rw-r--r--libs/pbd/pbd/controllable_descriptor.h9
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> 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);
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<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 ()
{
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;
@@ -133,6 +137,16 @@ ControllableDescriptor::rid() const
}
uint32_t
+ControllableDescriptor::selection_id () const
+{
+ if (banked()) {
+ return _selection_id + _bank_offset;
+ }
+
+ return _selection_id;
+}
+
+uint32_t
ControllableDescriptor::target (uint32_t n) const
{
if (n < _target.size()) {
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<uint32_t> _target;
uint32_t _banked;
uint32_t _bank_offset;