Update mixer strip input/output button labels from the general JACK port connection / disconnection callback so that all changes are noticed. Fixes #3638.

git-svn-id: svn://localhost/ardour2/branches/3.0@8368 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-12-29 17:52:32 +00:00
parent f31e5b5d71
commit 0dd2fb557c
6 changed files with 51 additions and 20 deletions

View File

@ -341,6 +341,10 @@ MixerStrip::init ()
set_flags (get_flags() | Gtk::CAN_FOCUS);
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 ()
);
}
MixerStrip::~MixerStrip ()
@ -460,8 +464,6 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
_route->comment());
_route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
_route->input()->changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::input_changed, this, _1, _2), gui_context());
_route->output()->changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::output_changed, this, _1, _2), gui_context());
_route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
if (_route->panner()) {
@ -1214,20 +1216,19 @@ MixerStrip::diskstream_changed ()
}
void
MixerStrip::input_changed (IOChange /*change*/, void */*src*/)
MixerStrip::port_connected_or_disconnected (Port* a, Port* b)
{
Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_input_display, this));
set_width_enum (_width, this);
}
if (_route->input()->has_port (a) || _route->input()->has_port (b)) {
update_input_display ();
set_width_enum (_width, this);
}
void
MixerStrip::output_changed (IOChange /*change*/, void */*src*/)
{
Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_output_display, this));
set_width_enum (_width, this);
if (_route->output()->has_port (a) || _route->output()->has_port (b)) {
update_output_display ();
set_width_enum (_width, this);
}
}
void
MixerStrip::comment_editor_done_editing()
{

View File

@ -218,9 +218,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
void new_send ();
void show_send_controls ();
void input_changed (ARDOUR::IOChange, void *);
void output_changed (ARDOUR::IOChange, void *);
PBD::ScopedConnection panstate_connection;
PBD::ScopedConnection panstyle_connection;
void connect_to_pan ();
@ -279,6 +276,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
static int scrollbar_height;
void update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool input_button);
void port_connected_or_disconnected (ARDOUR::Port *, ARDOUR::Port *);
};
#endif /* __ardour_mixer_strip__ */

View File

@ -245,8 +245,11 @@ _ the regular process() call to session->process() is not made.
/** Emitted if a JACK port is registered or unregistered */
PBD::Signal0<void> PortRegisteredOrUnregistered;
/** Emitted if a JACK port is connected or disconnected */
PBD::Signal0<void> PortConnectedOrDisconnected;
/** 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 bool parameter is true if ports were connected, or false for disconnected.
*/
PBD::Signal3<void, Port *, Port *, bool> PortConnectedOrDisconnected;
std::string make_port_name_relative (std::string);
std::string make_port_name_non_relative (std::string);

View File

@ -118,6 +118,8 @@ class IO : public SessionObject, public Latent
PortSet& ports() { return _ports; }
const PortSet& ports() const { return _ports; }
bool has_port (Port *) const;
Port *nth (uint32_t n) const {
if (n < _ports.num_ports()) {
return _ports.port(n);

View File

@ -394,10 +394,30 @@ AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* a
}
void
AudioEngine::_connect_callback (jack_port_id_t /*id_a*/, jack_port_id_t /*id_b*/, int /*conn*/, void* arg)
AudioEngine::_connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int conn, void* arg)
{
AudioEngine* ae = static_cast<AudioEngine*> (arg);
ae->PortConnectedOrDisconnected (); /* EMIT SIGNAL */
GET_PRIVATE_JACK_POINTER (ae->_jack);
jack_port_t* jack_port_a = jack_port_by_id (_priv_jack, id_a);
jack_port_t* jack_port_b = jack_port_by_id (_priv_jack, id_b);
Port* port_a = 0;
Port* port_b = 0;
boost::shared_ptr<Ports> pr = ae->ports.reader ();
Ports::iterator i = pr->begin ();
while (i != pr->end() && (port_a == 0 || port_b == 0)) {
if (jack_port_a == (*i)->_jack_port) {
port_a = *i;
} else if (jack_port_b == (*i)->_jack_port) {
port_b = *i;
}
++i;
}
ae->PortConnectedOrDisconnected (port_a, port_b, conn == 0 ? false : true); /* EMIT SIGNAL */
}
void

View File

@ -162,7 +162,7 @@ IO::disconnect (Port* our_port, string other_port, void* src)
if (other_port.length() == 0 || our_port == 0) {
return 0;
}
{
Glib::Mutex::Lock lm (io_lock);
@ -1612,3 +1612,10 @@ IO::physically_connected () const
return false;
}
bool
IO::has_port (Port* p) const
{
Glib::Mutex::Lock lm (io_lock);
return _ports.contains (p);
}