mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Update Mackie surface state when something is connected to its output port (#3887).
git-svn-id: svn://localhost/ardour2/branches/3.0@10135 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
fa590d385b
commit
1145f1ff6c
5 changed files with 46 additions and 4 deletions
|
|
@ -334,7 +334,7 @@ MixerStrip::init ()
|
||||||
SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io));
|
SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io));
|
||||||
|
|
||||||
AudioEngine::instance()->PortConnectedOrDisconnected.connect (
|
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 ()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,9 +249,10 @@ _ the regular process() call to session->process() is not made.
|
||||||
|
|
||||||
/** Emitted if a JACK port is connected or disconnected.
|
/** 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 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.
|
* 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_relative (std::string) const;
|
||||||
std::string make_port_name_non_relative (std::string) const;
|
std::string make_port_name_non_relative (std::string) const;
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,11 @@ AudioEngine::_connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int co
|
||||||
++i;
|
++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
|
void
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,11 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||||
, _gui (0)
|
, _gui (0)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
|
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()
|
MackieControlProtocol::~MackieControlProtocol()
|
||||||
|
|
@ -1742,3 +1747,31 @@ MackieControlProtocol::bundles ()
|
||||||
b.push_back (_output_bundle);
|
b.push_back (_output_bundle);
|
||||||
return b;
|
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 ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,9 @@ class MackieControlProtocol
|
||||||
Mackie::Strip & master_strip();
|
Mackie::Strip & master_strip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void port_connected_or_disconnected (std::string, std::string, bool);
|
||||||
|
|
||||||
boost::shared_ptr<Mackie::RouteSignal> master_route_signal;
|
boost::shared_ptr<Mackie::RouteSignal> master_route_signal;
|
||||||
|
|
||||||
static const char * default_port_name;
|
static const char * default_port_name;
|
||||||
|
|
@ -323,7 +326,8 @@ class MackieControlProtocol
|
||||||
|
|
||||||
/// protects the port list
|
/// protects the port list
|
||||||
Glib::Mutex update_mutex;
|
Glib::Mutex update_mutex;
|
||||||
|
|
||||||
|
PBD::ScopedConnectionList audio_engine_connections;
|
||||||
PBD::ScopedConnectionList session_connections;
|
PBD::ScopedConnectionList session_connections;
|
||||||
PBD::ScopedConnectionList port_connections;
|
PBD::ScopedConnectionList port_connections;
|
||||||
PBD::ScopedConnectionList route_connections;
|
PBD::ScopedConnectionList route_connections;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue