diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-19 20:26:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-19 20:26:31 +0000 |
commit | aae367b63c9b619db1e40f27dc334c6987219481 (patch) | |
tree | 142f6ffed6bb749e24a06343587cad6b966888bd /libs/surfaces | |
parent | 67460c2af45d0455e64623572480c064445c2e5b (diff) |
use new syntax for connecting to backend signals that enforces explicit connection scope, plus a few other related matters
git-svn-id: svn://localhost/ardour2/branches/3.0@6376 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/control_protocol/basic_ui.cc | 2 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol.cc | 12 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/basic_ui.h | 4 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/control_protocol.h | 21 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/generic_midi_control_protocol.cc | 17 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.cc | 72 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.h | 10 | ||||
-rw-r--r-- | libs/surfaces/mackie/controls.h | 4 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 26 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_port.cc | 28 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_port.h | 11 | ||||
-rw-r--r-- | libs/surfaces/mackie/route_signal.cc | 18 | ||||
-rw-r--r-- | libs/surfaces/mackie/route_signal.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface_port.h | 10 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.cc | 4 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.h | 3 | ||||
-rw-r--r-- | libs/surfaces/osc/osc_controllable.cc | 2 | ||||
-rw-r--r-- | libs/surfaces/osc/osc_controllable.h | 1 |
18 files changed, 100 insertions, 147 deletions
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index f2a99296a1..8c3eb02982 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -30,7 +30,7 @@ using namespace ARDOUR; using ARDOUR::nframes_t; -sigc::signal<void,std::string,std::string> BasicUI::AccessAction; +PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction; BasicUI::BasicUI (Session& s) : session (&s) diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index 2d59912dc8..d7f9d52efd 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -28,18 +28,18 @@ using namespace ARDOUR; using namespace std; -sigc::signal<void> ControlProtocol::ZoomToSession; -sigc::signal<void> ControlProtocol::ZoomOut; -sigc::signal<void> ControlProtocol::ZoomIn; -sigc::signal<void> ControlProtocol::Enter; -sigc::signal<void,float> ControlProtocol::ScrollTimeline; +PBD::Signal0<void> ControlProtocol::ZoomToSession; +PBD::Signal0<void> ControlProtocol::ZoomOut; +PBD::Signal0<void> ControlProtocol::ZoomIn; +PBD::Signal0<void> ControlProtocol::Enter; +PBD::Signal1<void,float> ControlProtocol::ScrollTimeline; ControlProtocol::ControlProtocol (Session& s, string str) : BasicUI (s), _name (str) { _active = false; - session->RouteAdded.connect (mem_fun(*this, &ControlProtocol::add_strip)); + session->RouteAdded.connect (*this, boost::bind (&ControlProtocol::add_strip, this, _1)); } ControlProtocol::~ControlProtocol () diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index 3456838041..f1bfcaa87c 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -22,7 +22,7 @@ #define __ardour_basic_ui_h__ #include <string> - +#include "pbd/signals.h" #include <jack/types.h> @@ -46,7 +46,7 @@ class BasicUI { void loop_toggle (); void access_action ( std::string action_path ); - static sigc::signal<void,std::string,std::string> AccessAction; + static PBD::Signal2<void,std::string,std::string> AccessAction; void goto_start (); void goto_end (); void rewind (); diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index a01dcd3ab4..8a50caf05f 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -25,8 +25,8 @@ #include <vector> #include <list> #include <boost/shared_ptr.hpp> -#include <sigc++/sigc++.h> -#include <pbd/stateful.h> +#include "pbd/stateful.h" +#include "pbd/signals.h" #include "control_protocol/basic_ui.h" namespace ARDOUR { @@ -34,7 +34,7 @@ namespace ARDOUR { class Route; class Session; -class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, public BasicUI { +class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI { public: ControlProtocol (Session&, std::string name); virtual ~ControlProtocol(); @@ -49,17 +49,17 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu virtual void route_list_changed () {} - sigc::signal<void> ActiveChanged; + PBD::Signal0<void> ActiveChanged; /* signals that a control protocol can emit and other (presumably graphical) user interfaces can respond to */ - static sigc::signal<void> ZoomToSession; - static sigc::signal<void> ZoomIn; - static sigc::signal<void> ZoomOut; - static sigc::signal<void> Enter; - static sigc::signal<void,float> ScrollTimeline; + static PBD::Signal0<void> ZoomToSession; + static PBD::Signal0<void> ZoomIn; + static PBD::Signal0<void> ZoomOut; + static PBD::Signal0<void> Enter; + static PBD::Signal1<void,float> ScrollTimeline; /* the model here is as follows: @@ -107,6 +107,9 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu void next_track (uint32_t initial_id); void prev_track (uint32_t initial_id); + + private: + ControlProtocol (const ControlProtocol&) {} /* noncopyable */ }; extern "C" { diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index a20835dc05..efe2089237 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -61,15 +61,14 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s) auto_binding = FALSE; - Controllable::StartLearning.connect (mem_fun (*this, &GenericMidiControlProtocol::start_learning)); - Controllable::StopLearning.connect (mem_fun (*this, &GenericMidiControlProtocol::stop_learning)); - Session::SendFeedback.connect (mem_fun (*this, &GenericMidiControlProtocol::send_feedback)); - - Controllable::CreateBinding.connect (mem_fun (*this, &GenericMidiControlProtocol::create_binding)); - Controllable::DeleteBinding.connect (mem_fun (*this, &GenericMidiControlProtocol::delete_binding)); - - Session::AutoBindingOn.connect (mem_fun (*this, &GenericMidiControlProtocol::auto_binding_on)); - Session::AutoBindingOff.connect (mem_fun (*this, &GenericMidiControlProtocol::auto_binding_off)); + Controllable::StartLearning.connect (*this, boost::bind (&GenericMidiControlProtocol::start_learning, this, _1)); + Controllable::StopLearning.connect (*this, boost::bind (&GenericMidiControlProtocol::stop_learning, this, _1)); + Controllable::CreateBinding.connect (*this, boost::bind (&GenericMidiControlProtocol::create_binding, this, _1, _2, _3)); + Controllable::DeleteBinding.connect (*this, boost::bind (&GenericMidiControlProtocol::delete_binding, this, _1)); + + Session::SendFeedback.connect (*this, boost::bind (&GenericMidiControlProtocol::send_feedback, this)); + Session::AutoBindingOn.connect (*this, boost::bind (&GenericMidiControlProtocol::auto_binding_on, this)); + Session::AutoBindingOff.connect (*this, boost::bind (&GenericMidiControlProtocol::auto_binding_off, this)); } GenericMidiControlProtocol::~GenericMidiControlProtocol () diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 533bb6db21..a1f5abf3b0 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -57,7 +57,6 @@ MIDIControllable::init () control_type = none; _control_description = "MIDI Control: none"; control_additional = (byte) -1; - connections = 0; feedback = true; // for now /* use channel 0 ("1") as the initial channel */ @@ -72,17 +71,20 @@ MIDIControllable::midi_forget () our existing event + type information. */ - if (connections > 0) { - midi_sense_connection[0].disconnect (); - } - - if (connections > 1) { - midi_sense_connection[1].disconnect (); - } + midi_sense_connection[0].disconnect (); + midi_sense_connection[1].disconnect (); + midi_learn_connection.disconnect (); +} - connections = 0; +void +MIDIControllable::drop_external_control () +{ + midi_sense_connection[0].disconnect (); + midi_sense_connection[1].disconnect (); midi_learn_connection.disconnect (); + control_type = none; + control_additional = (byte) -1; } void @@ -109,7 +111,7 @@ void MIDIControllable::learn_about_external_control () { drop_external_control (); - midi_learn_connection = _port.input()->any.connect (boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3)); + _port.input()->any.connect (midi_learn_connection, boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3)); } void @@ -118,23 +120,6 @@ MIDIControllable::stop_learning () midi_learn_connection.disconnect (); } -void -MIDIControllable::drop_external_control () -{ - if (connections > 0) { - midi_sense_connection[0].disconnect (); - } - if (connections > 1) { - midi_sense_connection[1].disconnect (); - } - - connections = 0; - midi_learn_connection.disconnect (); - - control_type = none; - control_additional = (byte) -1; -} - float MIDIControllable::control_to_midi(float val) { @@ -300,58 +285,43 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) int chn_i = chn; switch (ev) { case MIDI::off: - midi_sense_connection[0] = p.channel_note_off[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2)); + p.channel_note_off[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2)); /* if this is a bistate, connect to noteOn as well, and we'll toggle back and forth between the two. */ if (bistate) { - midi_sense_connection[1] = p.channel_note_on[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); - connections = 2; - } else { - connections = 1; - } + p.channel_note_on[chn_i].connect (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); + } + _control_description = "MIDI control: NoteOff"; break; case MIDI::on: - midi_sense_connection[0] = p.channel_note_on[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); + p.channel_note_on[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); if (bistate) { - midi_sense_connection[1] = p.channel_note_off[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2)); - connections = 2; - } else { - connections = 1; + p.channel_note_off[chn_i].connect (midi_sense_connection[1], boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2)); } _control_description = "MIDI control: NoteOn"; break; case MIDI::controller: - midi_sense_connection[0] = p.channel_controller[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2)); - connections = 1; + p.channel_controller[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2)); snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional); _control_description = buf; break; case MIDI::program: if (!bistate) { - midi_sense_connection[0] = p.channel_program_change[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2)); - connections = 1; + p.channel_program_change[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2)); _control_description = "MIDI control: ProgramChange"; } break; case MIDI::pitchbend: if (!bistate) { - midi_sense_connection[0] = p.channel_pitchbend[chn_i].connect - (boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2)); - connections = 1; + p.channel_pitchbend[chn_i].connect (midi_sense_connection[0], boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2)); _control_description = "MIDI control: Pitchbend"; } break; diff --git a/libs/surfaces/generic_midi/midicontrollable.h b/libs/surfaces/generic_midi/midicontrollable.h index cc85cc42c1..4661b2f4c6 100644 --- a/libs/surfaces/generic_midi/midicontrollable.h +++ b/libs/surfaces/generic_midi/midicontrollable.h @@ -22,11 +22,12 @@ #include <string> -#include <boost/signals2.hpp> - #include "midi++/types.h" + #include "pbd/controllable.h" +#include "pbd/signals.h" #include "pbd/stateful.h" + #include "ardour/types.h" namespace MIDI { @@ -82,9 +83,8 @@ class MIDIControllable : public PBD::Stateful MIDI::byte last_value; bool bistate; int midi_msg_id; /* controller ID or note number */ - boost::signals2::connection midi_sense_connection[2]; - boost::signals2::connection midi_learn_connection; - size_t connections; + PBD::ScopedConnection midi_sense_connection[2]; + PBD::ScopedConnection midi_learn_connection; MIDI::eventType control_type; MIDI::byte control_additional; MIDI::channel_t control_channel; diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index acd91e6047..8a7740598f 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -22,7 +22,7 @@ #include <vector> #include <string> -#include <boost/signals2.hpp> +#include "pbd/signals.h" #include "mackie_control_exception.h" @@ -228,7 +228,7 @@ public: virtual unsigned int in_use_timeout() { return _in_use_timeout; } /// Keep track of the timeout so it can be updated with more incoming events - boost::signals2::scoped_connection in_use_connection; + PBD::ScopedConnection in_use_connection; private: int _id; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 7460b041ad..9698b299b9 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -562,23 +562,23 @@ void MackieControlProtocol::update_surface() void MackieControlProtocol::connect_session_signals() { // receive routes added - session_connections.add_connection (session->RouteAdded.connect(boost::bind (&MackieControlProtocol::notify_route_added, this, _1))); + session->RouteAdded.connect(session_connections, boost::bind (&MackieControlProtocol::notify_route_added, this, _1)); // receive record state toggled - session_connections.add_connection (session->RecordStateChanged.connect(boost::bind (&MackieControlProtocol::notify_record_state_changed, this))); + session->RecordStateChanged.connect(session_connections, boost::bind (&MackieControlProtocol::notify_record_state_changed, this)); // receive transport state changed - session_connections.add_connection (session->TransportStateChange.connect(boost::bind (&MackieControlProtocol::notify_transport_state_changed, this))); + session->TransportStateChange.connect(session_connections, boost::bind (&MackieControlProtocol::notify_transport_state_changed, this)); // receive punch-in and punch-out - session_connections.add_connection (Config->ParameterChanged.connect(boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1))); - session_connections.add_connection (session->config.ParameterChanged.connect (boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1))); + Config->ParameterChanged.connect(session_connections, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)); + session->config.ParameterChanged.connect (session_connections, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1)); // receive rude solo changed - session_connections.add_connection (session->SoloActive.connect(boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1))); + session->SoloActive.connect(session_connections, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1)); // make sure remote id changed signals reach here // see also notify_route_added Sorted sorted = get_sorted_routes(); for ( Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it ) { - session_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind(&MackieControlProtocol::notify_remote_id_changed, this))); + ((*it)->RemoteControlIDChanged.connect (route_connections, boost::bind(&MackieControlProtocol::notify_remote_id_changed, this))); } } @@ -602,10 +602,10 @@ void MackieControlProtocol::add_port( MIDI::Port & midi_port, int number ) MackiePort * sport = new MackiePort( *this, midi_port, number ); _ports.push_back( sport ); - port_connections.add_connection (sport->init_event.connect (boost::bind (&MackieControlProtocol::handle_port_init, this, sport))); - port_connections.add_connection (sport->active_event.connect (boost::bind (&MackieControlProtocol::handle_port_active, this, sport))); - port_connections.add_connection (sport->inactive_event.connect (boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport))); - + sport->init_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_init, this, sport)); + sport->active_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_active, this, sport)); + sport->inactive_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport)); + _ports_changed = true; } } @@ -682,7 +682,7 @@ void MackieControlProtocol::initialize_surface() // Connect events. Must be after route table otherwise there will be trouble for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it ) { - port_connections.add_connection ((*it)->control_event.connect(boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3))); + (*it)->control_event.connect (port_connections, boost::bind (&MackieControlProtocol::handle_control_event, this, _1, _2, _3)); } } @@ -1445,7 +1445,7 @@ void MackieControlProtocol::notify_route_added( ARDOUR::RouteList & rl ) typedef ARDOUR::RouteList ARS; for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) { - route_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind (&MackieControlProtocol::notify_remote_id_changed, this))); + (*it)->RemoteControlIDChanged.connect (route_connections, boost::bind (&MackieControlProtocol::notify_remote_id_changed, this)); } } diff --git a/libs/surfaces/mackie/mackie_port.cc b/libs/surfaces/mackie/mackie_port.cc index 3316483914..8cf69585e3 100644 --- a/libs/surfaces/mackie/mackie_port.cc +++ b/libs/surfaces/mackie/mackie_port.cc @@ -94,7 +94,7 @@ void MackiePort::open() #ifdef PORT_DEBUG cout << "MackiePort::open " << *this << endl; #endif - _sysex = port().input()->sysex.connect (boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3)); + port().input()->sysex.connect (sysex_connection, boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3)); // make sure the device is connected init(); @@ -107,8 +107,8 @@ void MackiePort::close() #endif // disconnect signals - _any.disconnect(); - _sysex.disconnect(); + any_connection.disconnect(); + sysex_connection.disconnect(); // TODO emit a "closing" signal? #ifdef PORT_DEBUG @@ -288,26 +288,8 @@ void MackiePort::finalise_init( bool yn ) void MackiePort::connect_any() { -/* - Doesn't work because there isn't an == operator for slots - MIDI::Signal::slot_list_type slots = port().input()->any.slots(); - - if ( find( slots.begin(), slots.end(), mem_fun( *this, &MackiePort::handle_midi_any ) ) == slots.end() ) -*/ - // TODO but this will break if midi tracing is turned on - if ( port().input()->any.empty() ) - { -#ifdef DEBUG - cout << "connect input parser " << port().input() << " to handle_midi_any" << endl; -#endif - _any = port().input()->any.connect (boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3)); -#ifdef DEBUG - cout << "input parser any connections: " << port().input()->any.size() << endl; -#endif - } - else - { - cout << "MackiePort::connect_any already connected" << endl; + if (!any_connection.connected()) { + port().input()->any.connect (any_connection, boost::bind (&MackiePort::handle_midi_any, this, _1, _2, _3)); } } diff --git a/libs/surfaces/mackie/mackie_port.h b/libs/surfaces/mackie/mackie_port.h index 639183d066..292fc2ac13 100644 --- a/libs/surfaces/mackie/mackie_port.h +++ b/libs/surfaces/mackie/mackie_port.h @@ -18,13 +18,12 @@ #ifndef mackie_port_h #define mackie_port_h -#include "surface_port.h" - #include <midi++/types.h> -#include <boost/signals2.hpp> - #include <glibmm/thread.h> +#include "pbd/signals.h" + +#include "surface_port.h" #include "midi_byte_array.h" #include "types.h" @@ -115,8 +114,8 @@ protected: private: MackieControlProtocol & _mcp; port_type_t _port_type; - boost::signals2::scoped_connection _any; - boost::signals2::scoped_connection _sysex; + PBD::ScopedConnection any_connection; + PBD::ScopedConnection sysex_connection; emulation_t _emulation; bool _initialising; diff --git a/libs/surfaces/mackie/route_signal.cc b/libs/surfaces/mackie/route_signal.cc index fb6cf5b092..9a3dd41bf4 100644 --- a/libs/surfaces/mackie/route_signal.cc +++ b/libs/surfaces/mackie/route_signal.cc @@ -32,36 +32,36 @@ using namespace std; void RouteSignal::connect() { if (_strip.has_solo()) { - connections.add_connection (_route->solo_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this))); + _route->solo_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this)); } if (_strip.has_mute()) { - connections.add_connection (_route->mute_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this))); + _route->mute_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this)); } if (_strip.has_gain()) { - connections.add_connection (_route->gain_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false))); + _route->gain_control()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false)); } - connections.add_connection (_route->NameChanged.connect (boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this))); + _route->NameChanged.connect (connections, boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this)); if (_route->panner()) { - connections.add_connection (_route->panner()->Changed.connect(boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false))); + _route->panner()->Changed.connect(connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)); for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) { - connections.add_connection (_route->panner()->streampanner(i).Changed.connect (boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false))); + _route->panner()->streampanner(i).Changed.connect (connections, boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false)); } } boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route); if (trk) { - connections.add_connection (trk->rec_enable_control()->Changed .connect(boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this))); + trk->rec_enable_control()->Changed .connect(connections, boost::bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this)); } // TODO this works when a currently-banked route is made inactive, but not // when a route is activated which should be currently banked. - connections.add_connection (_route->active_changed.connect (boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this))); - + _route->active_changed.connect (connections, boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this)); + // TODO // SelectedChanged // RemoteControlIDChanged. Better handled at Session level. diff --git a/libs/surfaces/mackie/route_signal.h b/libs/surfaces/mackie/route_signal.h index 5b388a7da5..59bfc66e7b 100644 --- a/libs/surfaces/mackie/route_signal.h +++ b/libs/surfaces/mackie/route_signal.h @@ -21,7 +21,7 @@ #include <vector> #include <boost/shared_ptr.hpp> -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "midi_byte_array.h" diff --git a/libs/surfaces/mackie/surface_port.h b/libs/surfaces/mackie/surface_port.h index f41f2865bb..86ec8ffd9e 100644 --- a/libs/surfaces/mackie/surface_port.h +++ b/libs/surfaces/mackie/surface_port.h @@ -18,9 +18,9 @@ #ifndef surface_port_h #define surface_port_h -#include <boost/signals2.hpp> #include <glibmm/thread.h> +#include "pbd/signals.h" #include "midi_byte_array.h" #include "types.h" @@ -64,17 +64,17 @@ public: const MIDI::Port & port() const { return *_port; } // all control notofications are sent from here - boost::signals2::signal<void(SurfacePort &, Control &, const ControlState &)> control_event; + PBD::Signal3<void,SurfacePort &, Control &, const ControlState &> control_event; // emitted just before the port goes into initialisation // where it tries to establish that its device is connected - boost::signals2::signal<void()> init_event; + PBD::Signal0<void> init_event; // emitted when the port completes initialisation successfully - boost::signals2::signal<void()> active_event; + PBD::Signal0<void> active_event; // emitted when the port goes inactive (ie a read or write failed) - boost::signals2::signal<void()> inactive_event; + PBD::Signal0<void> inactive_event; // the port number - master is 0(extenders are 1((,4 virtual int number() const { return _number; } diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 931a5c1a58..a076b161e7 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -83,7 +83,7 @@ OSC::OSC (Session& s, uint32_t port) // "Application Hooks" session_loaded (s); - scoped_connect (session->Exported, boost::bind (&OSC::session_exported, this, _1, _2)); + session->Exported.connect (*this, boost::bind (&OSC::session_exported, this, _1, _2)); } OSC::~OSC() @@ -573,7 +573,7 @@ OSC::listen_to_route (boost::shared_ptr<Route> route, lo_address addr) */ if (!route_exists) { - scoped_connect (route->GoingAway, (boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)))); + route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route))); } } diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 314d37c7bd..15914bfbbd 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -32,7 +32,6 @@ #include <glibmm/main.h> #include "pbd/abstract_ui.h" -#include "pbd/scoped_connections.h" #include "ardour/types.h" #include "control_protocol/control_protocol.h" @@ -55,7 +54,7 @@ struct OSCUIRequest : public BaseUI::BaseRequestObject { ~OSCUIRequest() {} }; -class OSC : public ARDOUR::ControlProtocol, public PBD::ScopedConnectionList, public AbstractUI<OSCUIRequest> +class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> { public: OSC (ARDOUR::Session&, uint32_t port); diff --git a/libs/surfaces/osc/osc_controllable.cc b/libs/surfaces/osc/osc_controllable.cc index df3facfa8c..f5deadd41d 100644 --- a/libs/surfaces/osc/osc_controllable.cc +++ b/libs/surfaces/osc/osc_controllable.cc @@ -35,7 +35,7 @@ OSCControllable::OSCControllable (lo_address a, const std::string& p, boost::sha , addr (a) , path (p) { - c->Changed.connect (mem_fun (*this, &OSCControllable::send_change)); + c->Changed.connect (changed_connection, mem_fun (*this, &OSCControllable::send_change)); } OSCControllable::~OSCControllable () diff --git a/libs/surfaces/osc/osc_controllable.h b/libs/surfaces/osc/osc_controllable.h index 750cd12509..67b8284460 100644 --- a/libs/surfaces/osc/osc_controllable.h +++ b/libs/surfaces/osc/osc_controllable.h @@ -48,6 +48,7 @@ class OSCControllable : public PBD::Stateful protected: boost::shared_ptr<PBD::Controllable> controllable; + PBD::ScopedConnection changed_connection; lo_address addr; std::string path; |