X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_midi.cc;h=fa23880b87bef6504618295f4529d8b72a738ceb;hb=d92686afb4105b84b014372b6feb0ccc454a5171;hp=8c1c8b15ff52f2950c543c0a4c5af52c19ff41ec;hpb=5550eebe2fde5c46a5e67613899699713a92e3c8;p=ardour.git diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 8c1c8b15ff..fa23880b87 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -48,7 +48,7 @@ #include "ardour/slave.h" #include "ardour/ticker.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -335,6 +335,36 @@ Session::mmc_shuttle (MIDI::MachineControl &/*mmc*/, float speed, bool forw) } } +boost::shared_ptr +Session::get_midi_nth_route_by_id (PresentationInfo::order_t n) const +{ + PresentationInfo::Flag f; + + /* These numbers are defined by the MMC specification. + */ + + if (n == 318) { + f = PresentationInfo::MasterOut; + } else if (n == 319) { + f = PresentationInfo::MonitorOut; + } else { + f = PresentationInfo::Route; + } + + boost::shared_ptr r = routes.reader (); + PresentationInfo::order_t match_cnt = 0; + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if ((*i)->presentation_info().flag_match (f)) { + if (match_cnt++ == n) { + return *i; + } + } + } + + return boost::shared_ptr(); +} + void Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) { @@ -342,17 +372,13 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) return; } - RouteList::iterator i; - boost::shared_ptr r = routes.reader(); + boost::shared_ptr r = get_midi_nth_route_by_id (trk); - for (i = r->begin(); i != r->end(); ++i) { - AudioTrack *at; + if (r) { + boost::shared_ptr at; - if ((at = dynamic_cast((*i).get())) != 0) { - if (trk == at->remote_control_id()) { - at->set_record_enabled (enabled, Controllable::UseGroup); - break; - } + if ((at = boost::dynamic_pointer_cast (r))) { + at->rec_enable_control()->set_value (enabled, Controllable::UseGroup); } } } @@ -389,7 +415,7 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes) outbound_mtc_timecode_frame = mtc_tc; transmitting_timecode_time = timecode; - LatencyRange mtc_out_latency; // TODO cache this, update on engine().GraphReordered() + LatencyRange mtc_out_latency = {0, 0}; // TODO cache this, update on engine().GraphReordered() _midi_ports->mtc_output_port ()->get_connected_latency_range (ltc_out_latency, true); frameoffset_t mtc_offset = worst_playback_latency() - mtc_out_latency.max; @@ -696,4 +722,3 @@ Session::mtc_input_port () const { return _midi_ports->mtc_input_port (); } -