SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io));
AudioEngine::instance()->PortConnectedOrDisconnected.connect (
- *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _2), gui_context ()
+ *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
}
/** Emitted if a JACK port is connected or disconnected.
* The Port parameters are the ports being connected / disconnected, or 0 if they are not known to Ardour.
+ * The std::string parameters are the (long) port names.
* The bool parameter is true if ports were connected, or false for disconnected.
*/
- PBD::Signal3<void, Port *, Port *, bool> PortConnectedOrDisconnected;
+ PBD::Signal5<void, Port *, std::string, Port *, std::string, bool> PortConnectedOrDisconnected;
std::string make_port_name_relative (std::string) const;
std::string make_port_name_non_relative (std::string) const;
++i;
}
- ae->PortConnectedOrDisconnected (port_a, port_b, conn == 0 ? false : true); /* EMIT SIGNAL */
+ ae->PortConnectedOrDisconnected (
+ port_a, jack_port_name (jack_port_a),
+ port_b, jack_port_name (jack_port_b),
+ conn == 0 ? false : true
+ ); /* EMIT SIGNAL */
}
void
, _gui (0)
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
+
+ AudioEngine::instance()->PortConnectedOrDisconnected.connect (
+ audio_engine_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::port_connected_or_disconnected, this, _2, _4, _5),
+ midi_ui_context ()
+ );
}
MackieControlProtocol::~MackieControlProtocol()
b.push_back (_output_bundle);
return b;
}
+
+void
+MackieControlProtocol::port_connected_or_disconnected (string a, string b, bool connected)
+{
+ /* If something is connected to one of our output ports, send MIDI to update the surface
+ to whatever state it should have.
+ */
+
+ if (!connected) {
+ return;
+ }
+
+ MackiePorts::const_iterator i = _ports.begin();
+ while (i != _ports.end()) {
+
+ string const n = AudioEngine::instance()->make_port_name_non_relative ((*i)->output_port().name ());
+
+ if (a == n || b == n) {
+ break;
+ }
+
+ ++i;
+ }
+
+ if (i != _ports.end ()) {
+ update_surface ();
+ }
+}
Mackie::Strip & master_strip();
private:
+
+ void port_connected_or_disconnected (std::string, std::string, bool);
+
boost::shared_ptr<Mackie::RouteSignal> master_route_signal;
static const char * default_port_name;
/// protects the port list
Glib::Mutex update_mutex;
-
+
+ PBD::ScopedConnectionList audio_engine_connections;
PBD::ScopedConnectionList session_connections;
PBD::ScopedConnectionList port_connections;
PBD::ScopedConnectionList route_connections;