Add function to find transport master by port and expose midi parser

This commit is contained in:
Todd Naugle 2021-06-22 22:13:18 -05:00
parent 8237add6d2
commit 5adbcd0673
3 changed files with 17 additions and 0 deletions

View file

@ -456,6 +456,7 @@ class LIBARDOUR_API TransportMasterViaMIDI
public:
virtual ~TransportMasterViaMIDI ();
MIDI::Parser& transport_parser () { return parser; }
boost::shared_ptr<MidiPort> midi_port () const
{
return _midi_port;

View file

@ -79,6 +79,7 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable
boost::shared_ptr<TransportMaster> master_by_type (SyncSource src) const;
boost::shared_ptr<TransportMaster> master_by_name (std::string const &) const;
boost::shared_ptr<TransportMaster> master_by_port (boost::shared_ptr<Port> const &p) const;
TransportMasters const & transport_masters() const { return _transport_masters; }

View file

@ -677,6 +677,21 @@ TransportMasterManager::master_by_type (SyncSource src) const
return boost::shared_ptr<TransportMaster> ();
}
boost::shared_ptr<TransportMaster>
TransportMasterManager::master_by_port (boost::shared_ptr<Port> const &p) const
{
Glib::Threads::RWLock::ReaderLock lm (lock);
for (TransportMasters::const_iterator tm = _transport_masters.begin(); tm != _transport_masters.end(); ++tm) {
if ((*tm)->port() == p) {
return *tm;
}
}
return boost::shared_ptr<TransportMaster> ();
}
void
TransportMasterManager::engine_stopped ()
{