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
This commit is contained in:
Paul Davis
2015-11-17 18:00:36 -05:00
parent 47cf908998
commit e9234c856a
5 changed files with 40 additions and 3 deletions

View 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);

View 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 ()
{

View 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) {

View 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
{

View 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;