Update Ctrl-surface MIDI port list when ports change
This is a better variant of bbb6851468
, directly using
the GUI context without indirection.
This commit is contained in:
parent
ed5a9979ea
commit
acfa04d700
|
@ -288,7 +288,9 @@ CC121GUI::CC121GUI (CC121& p)
|
|||
|
||||
/* catch future changes to connection state */
|
||||
|
||||
fp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&CC121GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&CC121GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&CC121GUI::connection_handler, this), gui_context());
|
||||
fp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&CC121GUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
CC121GUI::~CC121GUI ()
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
Gtk::ComboBox allbypass_combo;
|
||||
|
||||
void update_port_combos ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
void connection_handler ();
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
|
|
|
@ -109,8 +109,7 @@ FaderPort::FaderPort (Session& s)
|
|||
);
|
||||
|
||||
/* Catch port connections and disconnections */
|
||||
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::connection_handler, this, _1, _2, _3, _4, _5), this);
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::ConnectionChange, this), this); /* notify GUI */
|
||||
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (_port_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::connection_handler, this, _1, _2, _3, _4, _5), this);
|
||||
|
||||
buttons.insert (std::make_pair (Mute, Button (*this, _("Mute"), Mute, 21)));
|
||||
buttons.insert (std::make_pair (Solo, Button (*this, _("Solo"), Solo, 22)));
|
||||
|
@ -630,7 +629,7 @@ FaderPort::close ()
|
|||
|
||||
stop_midi_handling ();
|
||||
session_connections.drop_connections ();
|
||||
port_connections.drop_connections ();
|
||||
_port_connection.disconnect ();
|
||||
blink_connection.disconnect ();
|
||||
selection_connection.disconnect ();
|
||||
stripable_connections.drop_connections ();
|
||||
|
|
|
@ -183,7 +183,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
|
|||
void build_gui ();
|
||||
|
||||
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
||||
PBD::ScopedConnectionList port_connections;
|
||||
PBD::ScopedConnection _port_connection;
|
||||
|
||||
enum ConnectionState {
|
||||
InputConnected = 0x1,
|
||||
|
|
|
@ -272,7 +272,9 @@ FPGUI::FPGUI (FaderPort& p)
|
|||
|
||||
/* catch future changes to connection state */
|
||||
|
||||
fp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&FPGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&FPGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&FPGUI::connection_handler, this), gui_context());
|
||||
fp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&FPGUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
FPGUI::~FPGUI ()
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
Gtk::ComboBox foot_combo[3];
|
||||
|
||||
void update_port_combos ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
void connection_handler ();
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
|
|
|
@ -172,7 +172,6 @@ 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);
|
||||
|
||||
|
|
|
@ -215,7 +215,9 @@ FP8GUI::FP8GUI (FaderPort8& p)
|
|||
update_port_combos ();
|
||||
|
||||
/* catch future changes to connection state */
|
||||
fp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&FP8GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&FP8GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&FP8GUI::connection_handler, this), gui_context());
|
||||
fp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&FP8GUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
FP8GUI::~FP8GUI ()
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
void update_port_combos ();
|
||||
void connection_handler ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
MidiPortColumns() {
|
||||
|
|
|
@ -137,10 +137,9 @@ 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_connections, MISSING_INVALIDATOR,
|
||||
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (_port_connection, 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 ();
|
||||
}
|
||||
|
|
|
@ -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::ScopedConnectionList port_connections;
|
||||
PBD::ScopedConnection _port_connection;
|
||||
|
||||
std::string _current_binding;
|
||||
uint32_t _bank_size;
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
void toggle_feedback_enable ();
|
||||
|
||||
void update_port_combos ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
void connection_handler ();
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
|
@ -247,8 +247,9 @@ GMCPGUI::GMCPGUI (GenericMidiControlProtocol& p)
|
|||
update_port_combos ();
|
||||
|
||||
/* catch future changes to connection state */
|
||||
|
||||
cp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&GMCPGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&GMCPGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&GMCPGUI::connection_handler, this), gui_context());
|
||||
cp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&GMCPGUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
GMCPGUI::~GMCPGUI ()
|
||||
|
|
|
@ -162,8 +162,9 @@ LCXLGUI::LCXLGUI (LaunchControlXL& p)
|
|||
|
||||
/* catch future changes to connection state */
|
||||
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_reg_connection, invalidator (*this), boost::bind (&LCXLGUI::connection_handler, this), gui_context());
|
||||
lcxl.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&LCXLGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&LCXLGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&LCXLGUI::connection_handler, this), gui_context());
|
||||
lcxl.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&LCXLGUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
LCXLGUI::~LCXLGUI ()
|
||||
|
|
|
@ -67,7 +67,7 @@ private:
|
|||
void update_port_combos ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
void connection_handler ();
|
||||
PBD::ScopedConnection port_reg_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
MidiPortColumns() {
|
||||
|
|
|
@ -103,8 +103,7 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s)
|
|||
ports_acquire ();
|
||||
|
||||
/* Catch port connections and disconnections */
|
||||
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 */
|
||||
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::connection_handler, this, _1, _2, _3, _4, _5), this);
|
||||
|
||||
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,8 +114,7 @@ LaunchControlXL::~LaunchControlXL ()
|
|||
DEBUG_TRACE (DEBUG::LaunchControlXL, "Launch Control XL 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_connections.drop_connections ();
|
||||
port_connection.disconnect ();
|
||||
session_connections.drop_connections ();
|
||||
stripable_connections.drop_connections ();
|
||||
|
||||
|
|
|
@ -631,7 +631,6 @@ private:
|
|||
|
||||
boost::shared_ptr<ARDOUR::Stripable> master;
|
||||
|
||||
PBD::ScopedConnection port_reg_connection;
|
||||
void port_registration_handler();
|
||||
|
||||
enum ConnectionState { InputConnected = 0x1, OutputConnected = 0x2 };
|
||||
|
@ -640,7 +639,7 @@ private:
|
|||
bool connection_handler(boost::weak_ptr<ARDOUR::Port>, std::string name1,
|
||||
boost::weak_ptr<ARDOUR::Port>, std::string name2,
|
||||
bool yn);
|
||||
PBD::ScopedConnectionList port_connections;
|
||||
PBD::ScopedConnection port_connection;
|
||||
void connected();
|
||||
|
||||
/* GUI */
|
||||
|
|
|
@ -129,7 +129,11 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
|
|||
_surface_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::surface_combo_changed));
|
||||
|
||||
_cp.DeviceChanged.connect (device_change_connection, invalidator (*this), boost::bind (&MackieControlProtocolGUI::device_changed, this), gui_context());
|
||||
_cp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&MackieControlProtocolGUI::connection_handler, this), gui_context());
|
||||
|
||||
/* catch future changes to connection state */
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&MackieControlProtocolGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&MackieControlProtocolGUI::connection_handler, this), gui_context());
|
||||
_cp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&MackieControlProtocolGUI::connection_handler, this), gui_context());
|
||||
|
||||
ipmidi_base_port_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::ipmidi_spinner_changed));
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ class MackieControlProtocolGUI : public Gtk::Notebook
|
|||
Gtk::ComboBox* output_combo,
|
||||
boost::shared_ptr<Mackie::Surface> surface);
|
||||
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
void connection_handler ();
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> build_midi_port_list (std::vector<std::string> const & ports, bool for_input);
|
||||
|
|
|
@ -144,8 +144,9 @@ P2GUI::P2GUI (Push2& p)
|
|||
|
||||
/* catch future changes to connection state */
|
||||
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_reg_connection, invalidator (*this), boost::bind (&P2GUI::connection_handler, this), gui_context());
|
||||
p2.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&P2GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&P2GUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&P2GUI::connection_handler, this), gui_context());
|
||||
p2.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&P2GUI::connection_handler, this), gui_context());
|
||||
}
|
||||
|
||||
P2GUI::~P2GUI ()
|
||||
|
|
|
@ -59,9 +59,8 @@ private:
|
|||
Gtk::Image image;
|
||||
|
||||
void update_port_combos ();
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
void connection_handler ();
|
||||
PBD::ScopedConnection port_reg_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
|
||||
struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
MidiPortColumns() {
|
||||
|
|
|
@ -130,9 +130,6 @@ Push2::Push2 (ARDOUR::Session& s)
|
|||
/* Catch port connections and disconnections */
|
||||
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 ();
|
||||
}
|
||||
|
|
|
@ -107,7 +107,9 @@ US2400ProtocolGUI::US2400ProtocolGUI (US2400Protocol& p)
|
|||
table.set_homogeneous (false);
|
||||
|
||||
_cp.DeviceChanged.connect (device_change_connection, invalidator (*this), boost::bind (&US2400ProtocolGUI::device_changed, this), gui_context());
|
||||
_cp.ConnectionChange.connect (connection_change_connection, invalidator (*this), boost::bind (&US2400ProtocolGUI::connection_handler, this), gui_context());
|
||||
_cp.ConnectionChange.connect (_port_connections, invalidator (*this), boost::bind (&US2400ProtocolGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_port_connections, invalidator (*this), boost::bind (&US2400ProtocolGUI::connection_handler, this), gui_context());
|
||||
ARDOUR::AudioEngine::instance()->PortPrettyNameChanged.connect (_port_connections, invalidator (*this), boost::bind (&US2400ProtocolGUI::connection_handler, this), gui_context());
|
||||
|
||||
/* device-dependent part */
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class US2400ProtocolGUI : public Gtk::Notebook
|
|||
Gtk::ComboBox* output_combo,
|
||||
boost::shared_ptr<US2400::Surface> surface);
|
||||
|
||||
PBD::ScopedConnection connection_change_connection;
|
||||
PBD::ScopedConnectionList _port_connections;
|
||||
void connection_handler ();
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> build_midi_port_list (std::vector<std::string> const & ports, bool for_input);
|
||||
|
|
Loading…
Reference in New Issue
Block a user