summaryrefslogtreecommitdiff
path: root/libs/ardour/session_midi.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-05-16 07:30:28 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:42 -0400
commite0ff70cf86c01c42f98faf8b0eaf1a8ccf867946 (patch)
treedcb5ac7037e3b41d850930ea0a1759d79f8ca82a /libs/ardour/session_midi.cc
parentbae9474e9f04e324b1a2776b0fa9faefb5e6f0c2 (diff)
first vaguely working version using PresentationInfo
remote control ID and "order keys" have been removed.
Diffstat (limited to 'libs/ardour/session_midi.cc')
-rw-r--r--libs/ardour/session_midi.cc39
1 files changed, 29 insertions, 10 deletions
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index 390f1de32f..f3a8d7dd81 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -335,6 +335,30 @@ Session::mmc_shuttle (MIDI::MachineControl &/*mmc*/, float speed, bool forw)
}
}
+boost::shared_ptr<Route>
+Session::get_midi_nth_route_by_id (PresentationInfo::order_t n) const
+{
+ PresentationInfo id (PresentationInfo::Flag (0));
+
+ if (n == 318) {
+ id.set_flags (PresentationInfo::MasterOut);
+ } else if (n == 319) {
+ id.set_flags (PresentationInfo::MonitorOut);
+ } else {
+ id = PresentationInfo (n, PresentationInfo::Route);
+ }
+
+ boost::shared_ptr<RouteList> r = routes.reader ();
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ if ((*i)->presentation_info().match (id)) {
+ return *i;
+ }
+ }
+
+ return boost::shared_ptr<Route>();
+}
+
void
Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
{
@@ -342,17 +366,13 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
return;
}
- RouteList::iterator i;
- boost::shared_ptr<RouteList> r = routes.reader();
+ boost::shared_ptr<Route> r = get_midi_nth_route_by_id (trk);
- for (i = r->begin(); i != r->end(); ++i) {
- AudioTrack *at;
+ if (r) {
+ boost::shared_ptr<AudioTrack> at;
- if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) {
- if (trk == at->remote_control_id()) {
- at->rec_enable_control()->set_value (enabled, Controllable::UseGroup);
- break;
- }
+ if ((at = boost::dynamic_pointer_cast<AudioTrack> (r))) {
+ at->rec_enable_control()->set_value (enabled, Controllable::UseGroup);
}
}
}
@@ -696,4 +716,3 @@ Session::mtc_input_port () const
{
return _midi_ports->mtc_input_port ();
}
-