13
0

Subscribe to pretty-port name changes (surfaces)

This commit is contained in:
Robin Gareus 2021-01-13 20:00:39 +01:00
parent b2c4e71a45
commit bbb6851468
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 16 additions and 11 deletions

View File

@ -110,6 +110,7 @@ FaderPort::FaderPort (Session& s)
/* Catch port connections and disconnections */
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::connection_handler, this, _1, _2, _3, _4, _5), this);
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::ConnectionChange, this), this); /* notify GUI */
buttons.insert (std::make_pair (Mute, Button (*this, _("Mute"), Mute, 21)));
buttons.insert (std::make_pair (Solo, Button (*this, _("Solo"), Solo, 22)));

View File

@ -172,6 +172,7 @@ FaderPort8::FaderPort8 (Session& s)
);
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::connection_handler, this, _2, _4), this);
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::ConnectionChange, this), this); /* notify GUI */
ARDOUR::AudioEngine::instance()->Stopped.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::engine_reset, this), this);
ARDOUR::Port::PortDrop.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::engine_reset, this), this);

View File

@ -137,9 +137,10 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
PresentationInfo::Change.connect (*this, MISSING_INVALIDATOR, boost::bind (&GenericMidiControlProtocol::reset_controllables, this), this);
/* Catch port connections and disconnections (cross-thread) */
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR,
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR,
boost::bind (&GenericMidiControlProtocol::connection_handler, this, _1, _2, _3, _4, _5),
this);
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&GenericMidiControlProtocol::ConnectionChange, this), this); /* notify GUI */
reload_maps ();
}

View File

@ -183,7 +183,7 @@ private:
int connection_state;
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
PBD::ScopedConnection port_connection;
PBD::ScopedConnectionList port_connections;
std::string _current_binding;
uint32_t _bank_size;

View File

@ -103,7 +103,8 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s)
ports_acquire ();
/* Catch port connections and disconnections */
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::connection_handler, this, _1, _2, _3, _4, _5), this);
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::connection_handler, this, _1, _2, _3, _4, _5), this);
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::ConnectionChange, this), this); /* notify GUI */
session->RouteAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
session->vca_manager().VCAAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
@ -115,7 +116,7 @@ LaunchControlXL::~LaunchControlXL ()
/* do this before stopping the event loop, so that we don't get any notifications */
port_reg_connection.disconnect ();
port_connection.disconnect ();
port_connections.drop_connections ();
session_connections.drop_connections ();
stripable_connections.drop_connections ();

View File

@ -640,7 +640,7 @@ private:
bool connection_handler(boost::weak_ptr<ARDOUR::Port>, std::string name1,
boost::weak_ptr<ARDOUR::Port>, std::string name2,
bool yn);
PBD::ScopedConnection port_connection;
PBD::ScopedConnectionList port_connections;
void connected();
/* GUI */

View File

@ -125,10 +125,13 @@ Push2::Push2 (ARDOUR::Session& s)
ports_acquire ();
/* catch arrival and departure of Push2 itself */
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_reg_connection, MISSING_INVALIDATOR, boost::bind (&Push2::port_registration_handler, this), this);
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&Push2::port_registration_handler, this), this);
/* Catch port connections and disconnections */
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&Push2::connection_handler, this, _1, _2, _3, _4, _5), this);
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&Push2::connection_handler, this, _1, _2, _3, _4, _5), this);
/* Catch name changes, notify GUI */
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&Push2::ConnectionChange, this), this);
/* Push 2 ports might already be there */
port_registration_handler ();
@ -139,8 +142,7 @@ Push2::~Push2 ()
DEBUG_TRACE (DEBUG::Push2, "push2 control surface object being destroyed\n");
/* do this before stopping the event loop, so that we don't get any notifications */
port_reg_connection.disconnect ();
port_connection.disconnect ();
port_connections.drop_connections ();
stop_using_device ();
device_release ();

View File

@ -549,7 +549,6 @@ class Push2 : public ARDOUR::ControlProtocol
boost::weak_ptr<ARDOUR::MidiTrack> current_pad_target;
PBD::ScopedConnection port_reg_connection;
void port_registration_handler ();
enum ConnectionState {
@ -559,7 +558,7 @@ class Push2 : public ARDOUR::ControlProtocol
int connection_state;
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
PBD::ScopedConnection port_connection;
PBD::ScopedConnectionList port_connections;
void connected ();
/* GUI */