From aae367b63c9b619db1e40f27dc334c6987219481 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 19 Dec 2009 20:26:31 +0000 Subject: 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 --- libs/ardour/ardour/ardour.h | 4 +- libs/ardour/ardour/audioengine.h | 18 +-- libs/ardour/ardour/audiofilesource.h | 2 +- libs/ardour/ardour/audioplaylist.h | 2 +- libs/ardour/ardour/audiosource.h | 6 +- libs/ardour/ardour/automation_list.h | 10 +- libs/ardour/ardour/bundle.h | 4 +- libs/ardour/ardour/configuration.h | 4 +- libs/ardour/ardour/crossfade.h | 4 +- libs/ardour/ardour/delivery.h | 8 +- libs/ardour/ardour/diskstream.h | 20 +-- libs/ardour/ardour/element_importer.h | 6 +- libs/ardour/ardour/export.h | 2 +- libs/ardour/ardour/export_channel.h | 2 +- libs/ardour/ardour/export_channel_configuration.h | 2 +- libs/ardour/ardour/export_format_base.h | 4 +- libs/ardour/ardour/export_format_manager.h | 4 +- libs/ardour/ardour/export_formats.h | 10 +- libs/ardour/ardour/export_handler.h | 6 +- libs/ardour/ardour/export_multiplication.h | 4 +- libs/ardour/ardour/export_processor.h | 2 +- libs/ardour/ardour/export_profile_manager.h | 2 +- libs/ardour/ardour/export_status.h | 6 +- libs/ardour/ardour/export_timespan.h | 2 +- libs/ardour/ardour/internal_return.h | 2 +- libs/ardour/ardour/internal_send.h | 2 +- libs/ardour/ardour/io.h | 10 +- libs/ardour/ardour/io_processor.h | 4 +- libs/ardour/ardour/location.h | 20 +-- libs/ardour/ardour/meter.h | 8 +- libs/ardour/ardour/midi_model.h | 2 +- libs/ardour/ardour/midi_patch_manager.h | 2 +- libs/ardour/ardour/midi_source.h | 4 +- libs/ardour/ardour/midi_ui.h | 2 +- libs/ardour/ardour/mute_master.h | 2 +- libs/ardour/ardour/named_selection.h | 2 +- libs/ardour/ardour/panner.h | 10 +- libs/ardour/ardour/playlist.h | 15 +- libs/ardour/ardour/playlist_factory.h | 2 +- libs/ardour/ardour/plugin.h | 2 +- libs/ardour/ardour/plugin_insert.h | 2 +- libs/ardour/ardour/plugin_manager.h | 2 +- libs/ardour/ardour/port.h | 4 +- libs/ardour/ardour/processor.h | 6 +- libs/ardour/ardour/region.h | 13 +- libs/ardour/ardour/region_factory.h | 2 +- libs/ardour/ardour/route.h | 38 ++--- libs/ardour/ardour/route_group.h | 8 +- libs/ardour/ardour/route_group_member.h | 2 +- libs/ardour/ardour/session.h | 102 ++++++------ libs/ardour/ardour/session_handle.h | 2 +- libs/ardour/ardour/session_object.h | 4 +- libs/ardour/ardour/session_playlists.h | 2 +- libs/ardour/ardour/slave.h | 6 +- libs/ardour/ardour/sndfilesource.h | 1 + libs/ardour/ardour/source.h | 8 +- libs/ardour/ardour/source_factory.h | 2 +- libs/ardour/ardour/tempo.h | 2 +- libs/ardour/ardour/ticker.h | 2 +- libs/ardour/ardour/track.h | 6 +- libs/ardour/audio_diskstream.cc | 2 +- libs/ardour/audio_playlist.cc | 8 +- libs/ardour/audio_track.cc | 4 +- libs/ardour/audioengine.cc | 6 +- libs/ardour/audiofilesource.cc | 2 +- libs/ardour/audioregion.cc | 18 +-- libs/ardour/audiosource.cc | 4 +- libs/ardour/auditioner.cc | 2 +- libs/ardour/automation_list.cc | 2 +- libs/ardour/delivery.cc | 22 +-- libs/ardour/diskstream.cc | 14 +- libs/ardour/element_importer.cc | 4 +- libs/ardour/export_channel.cc | 2 +- libs/ardour/export_format_manager.cc | 12 +- libs/ardour/export_formats.cc | 12 +- libs/ardour/export_handler.cc | 8 +- libs/ardour/export_processor.cc | 2 +- libs/ardour/globals.cc | 2 +- libs/ardour/internal_return.cc | 6 +- libs/ardour/internal_send.cc | 6 +- libs/ardour/io.cc | 10 +- libs/ardour/meter.cc | 34 +--- libs/ardour/midi_clock_slave.cc | 20 +-- libs/ardour/midi_diskstream.cc | 2 +- libs/ardour/midi_region.cc | 14 +- libs/ardour/midi_source.cc | 2 +- libs/ardour/midi_track.cc | 2 +- libs/ardour/midi_ui.cc | 2 +- libs/ardour/mtc_slave.cc | 12 +- libs/ardour/named_selection.cc | 2 +- libs/ardour/playlist.cc | 5 +- libs/ardour/playlist_factory.cc | 2 +- libs/ardour/processor.cc | 2 +- libs/ardour/region.cc | 8 +- libs/ardour/region_factory.cc | 2 +- libs/ardour/route.cc | 14 +- libs/ardour/route_group.cc | 2 +- libs/ardour/session.cc | 74 ++++----- libs/ardour/session_export.cc | 6 +- libs/ardour/session_handle.cc | 6 +- libs/ardour/session_midi.cc | 32 ++-- libs/ardour/session_playlists.cc | 2 +- libs/ardour/session_state.cc | 28 ++-- libs/ardour/sndfilesource.cc | 3 +- libs/ardour/source_factory.cc | 2 +- libs/ardour/ticker.cc | 10 +- libs/gtkmm2ext/binding_proxy.cc | 2 +- libs/midi++2/channel.cc | 50 +++--- libs/midi++2/midi++/channel.h | 3 +- libs/midi++2/midi++/manager.h | 2 +- libs/midi++2/midi++/mmc.h | 17 +- libs/midi++2/midi++/parser.h | 28 ++-- libs/midi++2/midi++/port.h | 1 - libs/midi++2/mmc.cc | 2 +- libs/midi++2/parser.cc | 2 +- libs/pbd/controllable.cc | 13 +- libs/pbd/pbd/controllable.h | 16 +- libs/pbd/pbd/destructible.h | 4 +- libs/pbd/pbd/memento_command.h | 4 +- libs/pbd/pbd/scoped_connections.h | 72 --------- libs/pbd/pbd/signals.h | 171 +++++++++++++++++++++ libs/pbd/pbd/undo.h | 4 +- libs/pbd/scoped_connections.cc | 53 ------- libs/pbd/signals.cc | 53 +++++++ libs/pbd/undo.cc | 4 +- libs/pbd/wscript | 2 +- libs/surfaces/control_protocol/basic_ui.cc | 2 +- libs/surfaces/control_protocol/control_protocol.cc | 12 +- .../control_protocol/control_protocol/basic_ui.h | 4 +- .../control_protocol/control_protocol.h | 21 +-- .../generic_midi/generic_midi_control_protocol.cc | 17 +- libs/surfaces/generic_midi/midicontrollable.cc | 72 +++------ libs/surfaces/generic_midi/midicontrollable.h | 10 +- libs/surfaces/mackie/controls.h | 4 +- libs/surfaces/mackie/mackie_control_protocol.cc | 26 ++-- libs/surfaces/mackie/mackie_port.cc | 28 +--- libs/surfaces/mackie/mackie_port.h | 11 +- libs/surfaces/mackie/route_signal.cc | 18 +-- libs/surfaces/mackie/route_signal.h | 2 +- libs/surfaces/mackie/surface_port.h | 10 +- libs/surfaces/osc/osc.cc | 4 +- libs/surfaces/osc/osc.h | 3 +- libs/surfaces/osc/osc_controllable.cc | 2 +- libs/surfaces/osc/osc_controllable.h | 1 + 144 files changed, 806 insertions(+), 817 deletions(-) delete mode 100644 libs/pbd/pbd/scoped_connections.h create mode 100644 libs/pbd/pbd/signals.h delete mode 100644 libs/pbd/scoped_connections.cc create mode 100644 libs/pbd/signals.cc (limited to 'libs') diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 1333b58d6f..aaae8ba1c9 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -26,7 +26,7 @@ #include #include -#include +#include "pbd/signals.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" @@ -46,7 +46,7 @@ namespace ARDOUR { class AudioEngine; static const nframes_t max_frames = JACK_MAX_FRAMES; - extern boost::signals2::signal BootMessage; + extern PBD::Signal1 BootMessage; int init (bool with_vst, bool try_optimization); void init_post_engine (); diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index ac367ddd64..b22ca9790f 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -30,7 +30,7 @@ #include #include "pbd/rcu.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/ardour.h" #include @@ -187,32 +187,32 @@ class AudioEngine : public SessionHandlePtr _ the regular process() call to session->process() is not made. */ - boost::signals2::signal Freewheel; + PBD::Signal1 Freewheel; - boost::signals2::signal Xrun; + PBD::Signal0 Xrun; /* this signal is if JACK notifies us of a graph order event */ - boost::signals2::signal GraphReordered; + PBD::Signal0 GraphReordered; /* this signal is emitted if the sample rate changes */ - boost::signals2::signal SampleRateChanged; + PBD::Signal1 SampleRateChanged; /* this signal is sent if JACK ever disconnects us */ - boost::signals2::signal Halted; + PBD::Signal0 Halted; /* these two are emitted when the engine itself is started and stopped */ - boost::signals2::signal Running; - boost::signals2::signal Stopped; + PBD::Signal0 Running; + PBD::Signal0 Stopped; /* this signal is emitted if a JACK port is registered or unregistered */ - boost::signals2::signal PortRegisteredOrUnregistered; + PBD::Signal0 PortRegisteredOrUnregistered; std::string make_port_name_relative (std::string); std::string make_port_name_non_relative (std::string); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 3312bc889d..f0710843f8 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -84,7 +84,7 @@ public: static void set_bwf_serial_number (int); static void set_header_position_offset (nframes_t offset ); - static boost::signals2::signal HeaderPositionOffsetChanged; + static PBD::Signal0 HeaderPositionOffsetChanged; protected: /** Constructor to be called for existing external-to-session files */ diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 927ccfbe11..9dd133cbc0 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -52,7 +52,7 @@ class AudioPlaylist : public ARDOUR::Playlist int set_state (const XMLNode&, int version); - boost::signals2::signal)> NewCrossfade; + PBD::Signal1 > NewCrossfade; void foreach_crossfade (boost::function)>); void crossfades_at (nframes_t frame, Crossfades&); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index dfa103f2e3..4f46451907 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -72,10 +72,10 @@ class AudioSource : virtual public Source, sframes_t start, nframes_t cnt, double samples_per_visual_peak) const; int build_peaks (); - bool peaks_ready (boost::function callWhenReady, boost::signals2::connection& connection_established_if_not_ready) const; + bool peaks_ready (boost::function callWhenReady, PBD::Connection& connection_created_if_not_ready) const; - mutable boost::signals2::signal PeaksReady; - mutable boost::signals2::signal PeakRangeReady; + mutable PBD::Signal0 PeaksReady; + mutable PBD::Signal2 PeakRangeReady; XMLNode& get_state (); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index c75abda0b7..1778771c5f 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -56,11 +56,11 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL void set_automation_state (AutoState); AutoState automation_state() const { return _state; } - boost::signals2::signal automation_state_changed; + PBD::Signal0 automation_state_changed; void set_automation_style (AutoStyle m); AutoStyle automation_style() const { return _style; } - boost::signals2::signal automation_style_changed; + PBD::Signal0 automation_style_changed; bool automation_playback() const { return (_state & Play) || ((_state & Touch) && !_touching); @@ -69,10 +69,10 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL return (_state & Write) || ((_state & Touch) && _touching); } - boost::signals2::signal StateChanged; + PBD::Signal0 StateChanged; - static boost::signals2::signal AutomationListCreated; - mutable boost::signals2::signal Dirty; + static PBD::Signal1 AutomationListCreated; + mutable PBD::Signal0 Dirty; void start_touch (); void stop_touch (); diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 662c3799a5..cc2ee19155 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -25,7 +25,7 @@ #include #include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/data_type.h" @@ -120,7 +120,7 @@ class Bundle : public PBD::ScopedConnectionList DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed }; - boost::signals2::signal Changed; + PBD::Signal1 Changed; protected: diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 1c82309d87..14a43e160c 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -21,7 +21,7 @@ #define __ardour_configuration_h__ #include -#include +#include "pbd/signals.h" #include "pbd/stateful.h" #include "ardour/configuration_variable.h" @@ -41,7 +41,7 @@ class Configuration : public PBD::Stateful virtual XMLNode & get_variables () = 0; virtual void set_variables (XMLNode const &) = 0; - boost::signals2::signal ParameterChanged; + PBD::Signal1 ParameterChanged; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 1a492b742b..5e25bbe00d 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -105,8 +105,8 @@ class Crossfade : public ARDOUR::AudioRegion nframes_t overlap_length() const; - boost::signals2::signal)> Invalidated; - boost::signals2::signal StateChanged; + PBD::Signal1 > Invalidated; + PBD::Signal1 StateChanged; bool covers (nframes_t frame) const { return _position <= frame && frame < _position + _length; diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 7a5931c5fb..a7ccd96a2d 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -85,9 +85,9 @@ public: BufferSet& output_buffers() { return *_output_buffers; } - boost::signals2::signal MuteChange; + PBD::Signal0 MuteChange; - static boost::signals2::signal CycleStart; + static PBD::Signal1 CycleStart; XMLNode& state (bool full); int set_state (const XMLNode&, int version); @@ -120,10 +120,10 @@ public: boost::shared_ptr _panner; static bool panners_legal; - static boost::signals2::signal PannersLegal; + static PBD::Signal0 PannersLegal; int panners_became_legal (); - boost::signals2::scoped_connection panner_legal_c; + PBD::ScopedConnection panner_legal_c; void output_changed (IOChange, void*); gain_t target_gain (); diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index a9664daa32..85e3071021 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -49,7 +49,7 @@ class Region; class Route; class Session; -class Diskstream : public SessionObject, public boost::noncopyable +class Diskstream : public SessionObject { public: enum Flag { @@ -143,15 +143,15 @@ class Diskstream : public SessionObject, public boost::noncopyable void move_processor_automation (boost::weak_ptr, std::list< Evoral::RangeMove > const &); - boost::signals2::signal RecordEnableChanged; - boost::signals2::signal SpeedChanged; - boost::signals2::signal ReverseChanged; - boost::signals2::signal PlaylistChanged; - boost::signals2::signal AlignmentStyleChanged; - boost::signals2::signal LoopSet; + PBD::Signal0 RecordEnableChanged; + PBD::Signal0 SpeedChanged; + PBD::Signal0 ReverseChanged; + PBD::Signal0 PlaylistChanged; + PBD::Signal0 AlignmentStyleChanged; + PBD::Signal1 LoopSet; - static boost::signals2::signal DiskOverrun; - static boost::signals2::signal DiskUnderrun; + static PBD::Signal0 DiskOverrun; + static PBD::Signal0 DiskUnderrun; protected: friend class Session; @@ -306,7 +306,7 @@ class Diskstream : public SessionObject, public boost::noncopyable PBD::ScopedConnectionList playlist_connections; - boost::signals2::scoped_connection ic_connection; + PBD::ScopedConnection ic_connection; Flag _flags; diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index d728a4b989..8ffa3b90ba 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -24,7 +24,7 @@ #include #include -#include +#include "pbd/signals.h" #include "ardour/types.h" class XMLTree; @@ -72,10 +72,10 @@ class ElementImporter bool broken () { return _broken; } /// Signal that requests for anew name - static boost::signals2::signal (std::string, std::string)> Rename; + static PBD::Signal2,std::string, std::string> Rename; /// Signal for ok/cancel prompting - static boost::signals2::signal Prompt; + static PBD::Signal1 Prompt; protected: diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index 055168118d..ee533d4c6d 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -84,7 +84,7 @@ namespace ARDOUR SRC_STATE* src_state; nframes_t pos; - boost::signals2::scoped_connection freewheel_connection; + PBD::ScopedConnection freewheel_connection; /* shared between UI thread and audio thread */ diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h index 4a2f74b775..73e3406869 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -123,7 +123,7 @@ class RegionExportChannelFactory Sample * mixdown_buffer; Sample * gain_buffer; - boost::signals2::scoped_connection export_connection; + PBD::ScopedConnection export_connection; }; /// Export channel that reads from region channel diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index b8d7fa6bf1..9ca49f452d 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -95,7 +95,7 @@ class ExportChannelConfiguration /// Writes all files for this channel config @return true if a new thread was spawned bool write_files (boost::shared_ptr new_processor); - boost::signals2::signal FilesWritten; + PBD::Signal0 FilesWritten; // Tells the handler the necessary information for it to handle tempfiles void register_with_timespan (TimespanPtr timespan); diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index ceb11a2cc9..dceb943e62 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -115,8 +115,8 @@ class ExportFormatBase { : _selected (false), _compatible (true) { } ~SelectableCompatible () {} - boost::signals2::signal SelectChanged; - boost::signals2::signal CompatibleChanged; + PBD::Signal1 SelectChanged; + PBD::Signal1 CompatibleChanged; bool selected () const { return _selected; } bool compatible () const { return _compatible; } diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h index 52463350fe..0d1a0310d9 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -27,7 +27,7 @@ #include #include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/export_formats.h" @@ -92,7 +92,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList /* Signals */ - boost::signals2::signal CompleteChanged; + PBD::Signal1 CompleteChanged; /* Access to lists */ diff --git a/libs/ardour/ardour/export_formats.h b/libs/ardour/ardour/export_formats.h index 3ef207097b..03585f79a9 100644 --- a/libs/ardour/ardour/export_formats.h +++ b/libs/ardour/ardour/export_formats.h @@ -25,7 +25,7 @@ #include #include "pbd/failed_constructor.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/export_format_base.h" #include "ardour/export_format_compatibility.h" @@ -128,11 +128,11 @@ class HasSampleFormat : public PBD::ScopedConnectionList { /* Proxies for signals from sample formats and dither types */ - boost::signals2::signal SampleFormatSelectChanged; - boost::signals2::signal SampleFormatCompatibleChanged; + PBD::Signal2 SampleFormatSelectChanged; + PBD::Signal2 SampleFormatCompatibleChanged; - boost::signals2::signal DitherTypeSelectChanged; - boost::signals2::signal DitherTypeCompatibleChanged; + PBD::Signal2 DitherTypeSelectChanged; + PBD::Signal2 DitherTypeCompatibleChanged; static std::string get_sample_format_name (ExportFormatBase::SampleFormat format); diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index ded6ed5b02..bbf1f7e208 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -118,8 +118,8 @@ class ExportHandler : public ExportElementFactory bool realtime; - boost::signals2::scoped_connection files_written_connection; - boost::signals2::scoped_connection export_read_finished_connection; + PBD::ScopedConnection files_written_connection; + PBD::ScopedConnection export_read_finished_connection; std::list files_written; void add_file (const Glib::ustring&); @@ -177,7 +177,7 @@ class ExportHandler : public ExportElementFactory TimespanPtr current_timespan; ConfigMap::iterator current_map_it; TimespanBounds timespan_bounds; - boost::signals2::scoped_connection channel_config_connection; + PBD::ScopedConnection channel_config_connection; }; diff --git a/libs/ardour/ardour/export_multiplication.h b/libs/ardour/ardour/export_multiplication.h index aace72cc42..eb90e62c47 100644 --- a/libs/ardour/ardour/export_multiplication.h +++ b/libs/ardour/ardour/export_multiplication.h @@ -36,7 +36,7 @@ bool selected () const { return _selected; } void select (bool value); - boost::signals2::signal SelectChanged; + PBD::Signal1 SelectChanged; protected: @@ -151,7 +151,7 @@ void split_node (GraphNode * node, float position); void remove_node (GraphNode * node); - boost::signals2::signal GraphChanged; + PBD::Signal0 GraphChanged; private: diff --git a/libs/ardour/ardour/export_processor.h b/libs/ardour/ardour/export_processor.h index 8e7918d7c5..493dd3231f 100644 --- a/libs/ardour/ardour/export_processor.h +++ b/libs/ardour/ardour/export_processor.h @@ -80,7 +80,7 @@ class ExportProcessor void write_files (); - static boost::signals2::signal WritingFile; + static PBD::Signal1 WritingFile; private: diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 30bb3c5b91..a29979460f 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -206,7 +206,7 @@ class ExportProfileManager void remove_format_profile (FormatPtr format); FormatPtr get_new_format (FormatPtr original); - boost::signals2::signal FormatListChanged; + PBD::Signal0 FormatListChanged; private: diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 9fd3c84ecc..1613fffe52 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -22,7 +22,7 @@ #define __ardour_export_status_h__ #include -#include +#include "pbd/signals.h" #include @@ -46,12 +46,12 @@ struct ExportStatus { volatile bool stop; volatile bool running; - boost::signals2::signal Aborting; + PBD::Signal0 Aborting; void abort (bool error_occurred = false); bool aborted () const { return _aborted; } bool errors () const { return _errors; } - boost::signals2::signal Finished; + PBD::Signal0 Finished; void finish (); bool finished () const { return _finished; } diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h index 461caf6dd8..7b7ae7cd99 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -69,7 +69,7 @@ class ExportTimespan /// Reads data from each channel and writes to tempfile int process (nframes_t frames); - boost::signals2::scoped_connection process_connection; + PBD::ScopedConnection process_connection; void set_range (nframes_t start, nframes_t end); nframes_t get_length () const { return end_frame - start_frame; } diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 498c9f3605..c5facebef6 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -47,7 +47,7 @@ class InternalReturn : public Return BufferSet* get_buffers(); void release_buffers(); - static boost::signals2::signal CycleStart; + static PBD::Signal1 CycleStart; private: BufferSet buffers; diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 7573efd685..2171462ab7 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -53,7 +53,7 @@ class InternalSend : public Send BufferSet* target; boost::shared_ptr _send_to; PBD::ID _send_to_id; - boost::signals2::scoped_connection connect_c; + PBD::ScopedConnection connect_c; void send_to_going_away (); void send_to_name_changed (); diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index eeb7ed64f0..b718cfa5c9 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -132,7 +132,7 @@ class IO : public SessionObject, public Latent const ChanCount& n_ports () const { return _ports.count(); } - boost::signals2::signal changed; + PBD::Signal2 changed; virtual XMLNode& state (bool full); XMLNode& get_state (void); @@ -144,7 +144,7 @@ class IO : public SessionObject, public Latent static int disable_ports (void); static int enable_ports (void); - static boost::signals2::signal PortCountChanged; // emitted when the number of ports changes + static PBD::Signal1 PortCountChanged; // emitted when the number of ports changes static std::string name_from_state (const XMLNode&); static void set_name_in_state (XMLNode&, const std::string&); @@ -152,7 +152,7 @@ class IO : public SessionObject, public Latent /* we have to defer/order port connection. this is how we do it. */ - static boost::signals2::signal ConnectingLegal; + static PBD::Signal0 ConnectingLegal; static bool connecting_legal; XMLNode *pending_state_node; @@ -180,14 +180,14 @@ class IO : public SessionObject, public Latent private: int connecting_became_legal (); - boost::signals2::scoped_connection connection_legal_c; + PBD::ScopedConnection connection_legal_c; boost::shared_ptr _bundle; ///< a bundle representing our ports struct UserBundleInfo { UserBundleInfo (IO*, boost::shared_ptr b); boost::shared_ptr bundle; - boost::signals2::scoped_connection changed; + PBD::ScopedConnection changed; }; std::vector _bundles_connected; ///< user bundles connected to our ports diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index e4a42a80e2..2acf7337a7 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -67,8 +67,8 @@ class IOProcessor : public Processor virtual bool feeds (boost::shared_ptr other) const; - boost::signals2::signal AutomationPlaybackChanged; - boost::signals2::signal AutomationChanged; + PBD::Signal2 AutomationPlaybackChanged; + PBD::Signal2 AutomationChanged; XMLNode& state (bool full_state); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index b50a645a93..1f2b80c831 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -108,15 +108,15 @@ class Location : public PBD::StatefulDestructible bool is_range_marker() const { return _flags & IsRangeMarker; } bool matches (Flags f) const { return _flags & f; } - boost::signals2::signal name_changed; - boost::signals2::signal end_changed; - boost::signals2::signal start_changed; + PBD::Signal1 name_changed; + PBD::Signal1 end_changed; + PBD::Signal1 start_changed; - boost::signals2::signal FlagsChanged; + PBD::Signal2 FlagsChanged; /* this is sent only when both start&end change at the same time */ - boost::signals2::signal changed; + PBD::Signal1 changed; /* CD Track / CD-Text info */ @@ -175,11 +175,11 @@ class Locations : public PBD::StatefulDestructible void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags); - boost::signals2::signal current_changed; - boost::signals2::signal changed; - boost::signals2::signal added; - boost::signals2::signal removed; - boost::signals2::signal StateChanged; + PBD::Signal1 current_changed; + PBD::Signal0 changed; + PBD::Signal1 added; + PBD::Signal1 removed; + PBD::Signal1 StateChanged; template void apply (T& obj, void (T::*method)(LocationList&)) { Glib::Mutex::Lock lm (lock); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 1f5e3307d6..2a283c0c64 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -22,6 +22,7 @@ #include #include "ardour/types.h" #include "ardour/processor.h" +#include "pbd/signals.h" #include "pbd/fastlog.h" namespace ARDOUR { @@ -33,16 +34,11 @@ class Session; class Metering { public: static void update_meters (); - static boost::signals2::signal Meter; - - static boost::signals2::connection connect (boost::function); - static void disconnect (boost::signals2::connection& c); + static PBD::Signal0 Meter; private: /* this object is not meant to be instantiated */ Metering(); - - static Glib::StaticMutex m_meter_signal_lock; }; /** Meters peaks on the input and stores them for access. diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 9961b51528..3cf64da6ea 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -158,7 +158,7 @@ public: XMLNode& get_state(); int set_state(const XMLNode&) { return 0; } - boost::signals2::signal ContentsChanged; + PBD::Signal0 ContentsChanged; const MidiSource* midi_source() const { return _midi_source; } void set_midi_source(MidiSource* source) { _midi_source = source; } diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h index 8c4ff43d5c..f352009ba7 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -22,7 +22,7 @@ #define MIDI_PATCH_MANAGER_H_ #include "midi++/midnam_patch.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/session_handle.h" namespace ARDOUR { diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 74448991d9..7b867c70fd 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -86,10 +86,10 @@ class MidiSource : virtual public Source uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - static boost::signals2::signal MidiSourceCreated; + static PBD::Signal1 MidiSourceCreated; // Signal a range of recorded data is available for reading from model() - mutable boost::signals2::signal ViewDataRangeReady; + mutable PBD::Signal2 ViewDataRangeReady; XMLNode& get_state (); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/midi_ui.h b/libs/ardour/ardour/midi_ui.h index 0ecf1b0589..869d7ab708 100644 --- a/libs/ardour/ardour/midi_ui.h +++ b/libs/ardour/ardour/midi_ui.h @@ -42,7 +42,7 @@ class MidiControlUI : public AbstractUI typedef std::list PortSources; PortSources port_sources; ARDOUR::Session& _session; - boost::signals2::scoped_connection rebind_connection; + PBD::ScopedConnection rebind_connection; bool midi_input_handler (Glib::IOCondition, MIDI::Port*); void reset_ports (); diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index a76775c710..afc1037e42 100644 --- a/libs/ardour/ardour/mute_master.h +++ b/libs/ardour/ardour/mute_master.h @@ -64,7 +64,7 @@ class MuteMaster : public AutomationControl void set_value (float); /* note: float is used as a bitfield of MutePoints */ float get_value () const; - boost::signals2::signal MutePointChanged; + PBD::Signal0 MutePointChanged; XMLNode& get_state(); int set_state(const XMLNode&, int version); diff --git a/libs/ardour/ardour/named_selection.h b/libs/ardour/ardour/named_selection.h index 0c930d5b72..c17ef3bf4d 100644 --- a/libs/ardour/ardour/named_selection.h +++ b/libs/ardour/ardour/named_selection.h @@ -46,7 +46,7 @@ struct NamedSelection : public PBD::Stateful int set_state (const XMLNode&, int version); - static boost::signals2::signal NamedSelectionCreated; + static PBD::Signal1 NamedSelectionCreated; }; }/* namespace ARDOUR */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index bf5a04c745..954727d280 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -81,8 +81,8 @@ class StreamPanner : public PBD::Stateful boost::shared_ptr pan_control() { return _control; } - boost::signals2::signal Changed; /* for position */ - boost::signals2::signal StateChanged; /* for mute */ + PBD::Signal0 Changed; /* for position */ + PBD::Signal0 StateChanged; /* for mute */ int set_state (const XMLNode&, int version); virtual XMLNode& state (bool full_state) = 0; @@ -270,9 +270,9 @@ public: StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; } uint32_t npanners() const { return _streampanners.size(); } - boost::signals2::signal Changed; - boost::signals2::signal LinkStateChanged; - boost::signals2::signal StateChanged; /* for bypass */ + PBD::Signal0 Changed; + PBD::Signal0 LinkStateChanged; + PBD::Signal0 StateChanged; /* for bypass */ /* only StreamPanner should call these */ diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 9c089c2f05..8bcdc5540b 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -51,7 +51,6 @@ class Session; class Region; class Playlist : public SessionObject - , public boost::noncopyable , public boost::enable_shared_from_this { public: typedef std::list > RegionList; @@ -130,13 +129,13 @@ class Playlist : public SessionObject int set_state (const XMLNode&, int version); XMLNode& get_template (); - boost::signals2::signal InUse; - boost::signals2::signal Modified; - boost::signals2::signal)> RegionAdded; - boost::signals2::signal)> RegionRemoved; - boost::signals2::signal NameChanged; - boost::signals2::signal LengthChanged; - boost::signals2::signal > const &)> RangesMoved; + PBD::Signal1 InUse; + PBD::Signal0 Modified; + PBD::Signal1 > RegionAdded; + PBD::Signal1 > RegionRemoved; + PBD::Signal0 NameChanged; + PBD::Signal0 LengthChanged; + PBD::Signal1 > const &> RangesMoved; static std::string bump_name (std::string old_name, Session&); diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h index 4c3680ae8e..17645ad8a3 100644 --- a/libs/ardour/ardour/playlist_factory.h +++ b/libs/ardour/ardour/playlist_factory.h @@ -31,7 +31,7 @@ class Session; class PlaylistFactory { public: - static boost::signals2::signal, bool)> PlaylistCreated; + static PBD::Signal2, bool> PlaylistCreated; static boost::shared_ptr create (Session&, const XMLNode&, bool hidden = false, bool unused = false); static boost::shared_ptr create (DataType type, Session&, std::string name, bool hidden = false); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index ea8f95d8f5..4770c43511 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -143,7 +143,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual bool has_editor() const = 0; - boost::signals2::signal ParameterChanged; + PBD::Signal2 ParameterChanged; /* NOTE: this block of virtual methods looks like the interface to a Processor, but Plugin does not inherit from Processor. diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 6be8f1dda6..25f380c41b 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -106,7 +106,7 @@ class PluginInsert : public Processor void collect_signal_for_analysis(nframes_t nframes); - boost::signals2::signal AnalysisDataGathered; + PBD::Signal2 AnalysisDataGathered; private: /* disallow copy construction */ diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 44c529835e..14c4190787 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -70,7 +70,7 @@ class PluginManager : public boost::noncopyable { PluginStatusType get_status (const PluginInfoPtr&); /** plugins were added to or removed from one of the PluginInfoLists */ - boost::signals2::signal PluginListChanged; + PBD::Signal0 PluginListChanged; private: struct PluginStatus { diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index be4df6bd02..ce4b88f8f2 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include "pbd/signals.h" #include "ardour/data_type.h" #include "ardour/types.h" @@ -118,7 +118,7 @@ public: static void set_engine (AudioEngine *); - boost::signals2::signal MonitorInputChanged; + PBD::Signal1 MonitorInputChanged; protected: diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 5962e8f44e..2dd78c66f4 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -98,10 +98,10 @@ class Processor : public SessionObject, public AutomatableControls, public Laten void *get_gui () const { return _gui; } void set_gui (void *p) { _gui = p; } - static boost::signals2::signal ProcessorCreated; + static PBD::Signal1 ProcessorCreated; - boost::signals2::signal ActiveChanged; - boost::signals2::signal ConfigurationChanged; + PBD::Signal0 ActiveChanged; + PBD::Signal2 ConfigurationChanged; protected: int _pending_active; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index a276fb19ee..4cae00c532 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -26,7 +26,7 @@ #include #include "pbd/undo.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/ardour.h" #include "ardour/data_type.h" @@ -49,10 +49,9 @@ enum RegionEditState { }; class Region - : public SessionObject - , public boost::noncopyable - , public boost::enable_shared_from_this - , public Readable + : public SessionObject + , public boost::enable_shared_from_this + , public Readable { public: typedef std::vector > SourceList; @@ -96,8 +95,8 @@ class Region static Change LayerChanged; static Change HiddenChanged; - boost::signals2::signal StateChanged; - static boost::signals2::signal)> RegionPropertyChanged; + PBD::Signal1 StateChanged; + static PBD::Signal1 > RegionPropertyChanged; void unlock_property_changes () { _flags = Flag (_flags & ~DoNotSendPropertyChanges); } void block_property_changes () { _flags = Flag (_flags | DoNotSendPropertyChanges); } diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index 51858e4926..b53e9490de 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -40,7 +40,7 @@ class RegionFactory { itself, to permit dynamic_cast<> to be used to infer the type of Region. */ - static boost::signals2::signal)> CheckNewRegion; + static PBD::Signal1 > CheckNewRegion; static boost::shared_ptr create (boost::shared_ptr); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index dd6173e963..9630975d1f 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -227,28 +227,28 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void set_user_latency (nframes_t); nframes_t initial_delay() const { return _initial_delay; } - boost::signals2::signal active_changed; - boost::signals2::signal phase_invert_changed; - boost::signals2::signal denormal_protection_changed; - boost::signals2::signal listen_changed; - boost::signals2::signal solo_changed; - boost::signals2::signal solo_safe_changed; - boost::signals2::signal solo_isolated_changed; - boost::signals2::signal comment_changed; - boost::signals2::signal mute_changed; - boost::signals2::signal mute_points_changed; + PBD::Signal0 active_changed; + PBD::Signal0 phase_invert_changed; + PBD::Signal0 denormal_protection_changed; + PBD::Signal1 listen_changed; + PBD::Signal1 solo_changed; + PBD::Signal1 solo_safe_changed; + PBD::Signal1 solo_isolated_changed; + PBD::Signal1 comment_changed; + PBD::Signal1 mute_changed; + PBD::Signal0 mute_points_changed; /** the processors have changed; the parameter indicates what changed */ - boost::signals2::signal processors_changed; - boost::signals2::signal record_enable_changed; + PBD::Signal1 processors_changed; + PBD::Signal1 record_enable_changed; /** the metering point has changed */ - boost::signals2::signal meter_change; - boost::signals2::signal signal_latency_changed; - boost::signals2::signal initial_delay_changed; + PBD::Signal1 meter_change; + PBD::Signal0 signal_latency_changed; + PBD::Signal0 initial_delay_changed; /* gui's call this for their own purposes. */ - boost::signals2::signal gui_changed; + PBD::Signal2 gui_changed; /* stateful */ @@ -261,7 +261,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou int save_as_template (const std::string& path, const std::string& name); - boost::signals2::signal SelectedChanged; + PBD::Signal1 SelectedChanged; int listen_via (boost::shared_ptr, Placement p, bool active, bool aux); void drop_listen (boost::shared_ptr); @@ -306,10 +306,10 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void set_remote_control_id (uint32_t id); uint32_t remote_control_id () const; - boost::signals2::signal RemoteControlIDChanged; + PBD::Signal0 RemoteControlIDChanged; void sync_order_keys (std::string const &); - static boost::signals2::signal SyncOrderKeys; + static PBD::Signal1 SyncOrderKeys; protected: friend class Session; diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index fe4079050d..48b5cb52db 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -24,10 +24,10 @@ #include #include #include -#include +#include "pbd/signals.h" #include "pbd/stateful.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/types.h" @@ -128,8 +128,8 @@ public: boost::shared_ptr route_list() { return routes; } - boost::signals2::signal changed; - boost::signals2::signal FlagsChanged; + PBD::Signal0 changed; + PBD::Signal1 FlagsChanged; XMLNode& get_state (); diff --git a/libs/ardour/ardour/route_group_member.h b/libs/ardour/ardour/route_group_member.h index 8743423b18..824fd52bd3 100644 --- a/libs/ardour/ardour/route_group_member.h +++ b/libs/ardour/ardour/route_group_member.h @@ -33,7 +33,7 @@ class RouteGroupMember RouteGroup* route_group () const { return _route_group; } - boost::signals2::signal route_group_changed; + PBD::Signal0 route_group_changed; protected: RouteGroup* _route_group; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 273f251f3d..7c6c83a121 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -38,7 +38,7 @@ #include "pbd/error.h" #include "pbd/rcu.h" #include "pbd/statefuldestructible.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "pbd/undo.h" #include "midi++/mmc.h" @@ -118,7 +118,7 @@ class VSTPlugin; extern void setup_enum_writer (); -class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public boost::noncopyable +class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager { public: enum RecordState { @@ -164,14 +164,14 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void set_deletion_in_progress (); void clear_deletion_in_progress (); bool deletion_in_progress() const { return _state_of_the_state & Deletion; } - boost::signals2::signal DirtyChanged; + PBD::Signal0 DirtyChanged; const SessionDirectory& session_directory () const { return *(_session_dir.get()); } - static boost::signals2::signal AutoBindingOn; - static boost::signals2::signal AutoBindingOff; + static PBD::Signal0 AutoBindingOn; + static PBD::Signal0 AutoBindingOff; - static boost::signals2::signal Dialog; + static PBD::Signal1 Dialog; std::string sound_dir (bool with_path = true) const; std::string peak_dir () const; @@ -272,29 +272,29 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* Proxy signal for region hidden changes */ - boost::signals2::signal)> RegionHiddenChange; + PBD::Signal1 > RegionHiddenChange; /* Emitted when all i/o connections are complete */ - boost::signals2::signal IOConnectionsComplete; + PBD::Signal0 IOConnectionsComplete; /* Record status signals */ - boost::signals2::signal RecordStateChanged; + PBD::Signal0 RecordStateChanged; /* Transport mechanism signals */ - boost::signals2::signal TransportStateChange; /* generic */ - boost::signals2::signal PositionChanged; /* sent after any non-sequential motion */ - boost::signals2::signal DurationChanged; - boost::signals2::signal Xrun; - boost::signals2::signal TransportLooped; + PBD::Signal0 TransportStateChange; /* generic */ + PBD::Signal1 PositionChanged; /* sent after any non-sequential motion */ + PBD::Signal0 DurationChanged; + PBD::Signal1 Xrun; + PBD::Signal0 TransportLooped; /** emitted when a locate has occurred */ - boost::signals2::signal Located; + PBD::Signal0 Located; - boost::signals2::signal RouteAdded; - boost::signals2::signal RouteGroupChanged; + PBD::Signal1 RouteAdded; + PBD::Signal0 RouteGroupChanged; void queue_event (SessionEvent*); @@ -348,9 +348,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi Locations *locations() { return &_locations; } - boost::signals2::signal auto_loop_location_changed; - boost::signals2::signal auto_punch_location_changed; - boost::signals2::signal locations_modified; + PBD::Signal1 auto_loop_location_changed; + PBD::Signal1 auto_punch_location_changed; + PBD::Signal0 locations_modified; void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); @@ -375,8 +375,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi static int rename_template (std::string old_name, std::string new_name); static int delete_template (std::string name); - boost::signals2::signal StateSaved; - boost::signals2::signal StateReady; + PBD::Signal1 StateSaved; + PBD::Signal0 StateReady; std::vector* possible_states() const; static std::vector* possible_states (std::string path); @@ -406,8 +406,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi RouteGroup *route_group_by_name (std::string); - boost::signals2::signal route_group_added; - boost::signals2::signal route_group_removed; + PBD::Signal1 route_group_added; + PBD::Signal0 route_group_removed; void foreach_route_group (boost::function f) { for (std::list::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) { @@ -476,9 +476,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi nframes_t convert_to_frames_at (nframes_t position, AnyTime const &); - static boost::signals2::signal StartTimeChanged; - static boost::signals2::signal EndTimeChanged; - static boost::signals2::signal TimecodeOffsetChanged; + static PBD::Signal0 StartTimeChanged; + static PBD::Signal0 EndTimeChanged; + static PBD::Signal0 TimecodeOffsetChanged; std::vector get_available_sync_options() const; void request_sync_source (Slave*); @@ -496,15 +496,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi TempoMap& tempo_map() { return *_tempo_map; } /// signals the current transport position in frames, bbt and timecode time (in that order) - boost::signals2::signal tick; + PBD::Signal3 tick; /* region info */ void add_regions (std::vector >&); - boost::signals2::signal)> RegionAdded; - boost::signals2::signal >&)> RegionsAdded; - boost::signals2::signal)> RegionRemoved; + PBD::Signal1 > RegionAdded; + PBD::Signal1 >&> RegionsAdded; + PBD::Signal1 > RegionRemoved; int region_name (std::string& result, std::string base = std::string(""), bool newlevel = false); std::string new_region_name (std::string); @@ -529,9 +529,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi int start_audio_export (nframes_t position, bool realtime); - boost::signals2::signal ProcessExport; - boost::signals2::signal ExportReadFinished; - static boost::signals2::signal Exported; + PBD::Signal1 ProcessExport; + PBD::Signal0 ExportReadFinished; + static PBD::Signal2 Exported; void add_source (boost::shared_ptr); void remove_source (boost::weak_ptr); @@ -548,16 +548,16 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi 0 for "yes, delete this playlist", 1 for "no, don't delete this playlist". */ - boost::signals2::signal)> AskAboutPlaylistDeletion; + PBD::Signal1 > AskAboutPlaylistDeletion; /** handlers should return 0 for "ignore the rate mismatch", !0 for "do not use this session" */ - static boost::signals2::signal AskAboutSampleRateMismatch; + static PBD::Signal2 AskAboutSampleRateMismatch; /** handlers should return !0 for use pending state, 0 for ignore it. */ - static boost::signals2::signal AskAboutPendingState; + static PBD::Signal0 AskAboutPendingState; boost::shared_ptr create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); @@ -575,8 +575,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void remove_named_selection (NamedSelection *); template void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&)); - boost::signals2::signal NamedSelectionAdded; - boost::signals2::signal NamedSelectionRemoved; + PBD::Signal0 NamedSelectionAdded; + PBD::Signal0 NamedSelectionRemoved; /* Curves and AutomationLists (TODO when they go away) */ void add_automation_list(AutomationList*); @@ -595,7 +595,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void cancel_audition (); bool is_auditioning () const; - boost::signals2::signal AuditionActive; + PBD::Signal1 AuditionActive; /* flattening stuff */ @@ -617,8 +617,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void set_listen (boost::shared_ptr, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_record_enable (boost::shared_ptr, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); - boost::signals2::signal SoloActive; - boost::signals2::signal SoloChanged; + PBD::Signal1 SoloActive; + PBD::Signal0 SoloChanged; /* control/master out */ @@ -656,8 +656,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void remove_bundle (boost::shared_ptr); boost::shared_ptr bundle_by_name (std::string) const; - boost::signals2::signal)> BundleAdded; - boost::signals2::signal)> BundleRemoved; + PBD::Signal1 > BundleAdded; + PBD::Signal1 > BundleRemoved; /* MIDI control */ @@ -671,10 +671,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi MIDI::Port *midi_port() const { return _midi_port; } MIDI::Port *midi_clock_port() const { return _midi_clock_port; } - boost::signals2::signal MTC_PortChanged; - boost::signals2::signal MMC_PortChanged; - boost::signals2::signal MIDI_PortChanged; - boost::signals2::signal MIDIClock_PortChanged; + PBD::Signal0 MTC_PortChanged; + PBD::Signal0 MMC_PortChanged; + PBD::Signal0 MIDI_PortChanged; + PBD::Signal0 MIDIClock_PortChanged; void set_trace_midi_input (bool, MIDI::Port* port = 0); void set_trace_midi_output (bool, MIDI::Port* port = 0); @@ -691,7 +691,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void stop_scrub (); void set_scrub_speed (float); nframes_t scrub_buffer_size() const; - boost::signals2::signal ScrubReady; + PBD::Signal0 ScrubReady; /* History (for editors, mixers, UIs etc.) */ @@ -765,7 +765,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void* ptr, float opt); - static boost::signals2::signal SendFeedback; + static PBD::Signal0 SendFeedback; /* Controllables */ @@ -943,7 +943,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi int stop_audio_export (); void finalize_audio_export (); - boost::signals2::scoped_connection export_freewheel_connection; + PBD::ScopedConnection export_freewheel_connection; void prepare_diskstreams (); void commit_diskstreams (nframes_t, bool& session_requires_butler); diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h index c747ee9976..87c6fb6670 100644 --- a/libs/ardour/ardour/session_handle.h +++ b/libs/ardour/ardour/session_handle.h @@ -20,7 +20,7 @@ #ifndef __libardour_session_handle_h__ #define __libardour_session_handle_h__ -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" namespace ARDOUR { class Session; diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h index eb1a7c3e30..47caab5475 100644 --- a/libs/ardour/ardour/session_object.h +++ b/libs/ardour/ardour/session_object.h @@ -22,7 +22,7 @@ #include #include "pbd/statefuldestructible.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/session_handle.h" @@ -53,7 +53,7 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible return true; } - boost::signals2::signal NameChanged; + PBD::Signal0 NameChanged; protected: std::string _name; diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h index 8870794cc0..db29ee8c05 100644 --- a/libs/ardour/ardour/session_playlists.h +++ b/libs/ardour/ardour/session_playlists.h @@ -27,7 +27,7 @@ #include #include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" class XMLNode; diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 4fe8e1ec46..1cc73474d7 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -27,7 +27,7 @@ #include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/types.h" #include "midi++/parser.h" @@ -242,7 +242,7 @@ class MTC_Slave : public Slave { private: Session& session; MIDI::Port* port; - PBD::ScopedConnectionList* port_connections; + PBD::ScopedConnectionList port_connections; bool can_notify_on_unknown_rate; PIChaser* pic; @@ -303,7 +303,7 @@ class MIDIClock_Slave : public Slave { private: ISlaveSessionProxy* session; MIDI::Port* port; - PBD::ScopedConnectionList* port_connections; + PBD::ScopedConnectionList port_connections; /// pulses per quarter note for one MIDI clock frame (default 24) int ppqn; diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 45d535e916..95829769f6 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -98,6 +98,7 @@ class SndFileSource : public AudioFileSource { nframes_t destructive_write_unlocked (Sample *dst, nframes_t cnt); nframes_t nondestructive_write_unlocked (Sample *dst, nframes_t cnt); void handle_header_position_change (); + PBD::ScopedConnection header_position_connection; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index a7a6e2207c..b91d8f129c 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -35,7 +35,7 @@ namespace ARDOUR { class Session; -class Source : public SessionObject, public boost::noncopyable +class Source : public SessionObject { public: enum Flag { @@ -81,15 +81,15 @@ class Source : public SessionObject, public boost::noncopyable virtual bool set_destructive (bool /*yn*/) { return false; } virtual bool length_mutable() const { return false; } - static boost::signals2::signal SourceCreated; - boost::signals2::signal)> Switched; + static PBD::Signal1 SourceCreated; + PBD::Signal1 > Switched; bool has_been_analysed() const; virtual bool can_be_analysed() const { return false; } virtual void set_been_analysed (bool yn); virtual bool check_for_analysis_data_on_disk(); - boost::signals2::signal AnalysisChanged; + PBD::Signal0 AnalysisChanged; AnalysisFeatureList transients; std::string get_transients_path() const; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index 4da285e980..c32b96ae97 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -37,7 +37,7 @@ class SourceFactory { public: static void init (); - static boost::signals2::signal)> SourceCreated; + static PBD::Signal1 > SourceCreated; static boost::shared_ptr create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr createSilent (Session&, const XMLNode& node, diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index ba7bbbcf7e..9fe6f1fee5 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -258,7 +258,7 @@ class TempoMap : public PBD::StatefulDestructible nframes_t frame_rate () const { return _frame_rate; } - boost::signals2::signal StateChanged; + PBD::Signal1 StateChanged; private: static Tempo _default_tempo; diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index 9a26d4d3ff..e133ad5d23 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -20,7 +20,7 @@ #include "midi++/jack.h" -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "ardour/types.h" #include "ardour/session_handle.h" diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 82b4f701b4..0ed4b8c70b 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -43,7 +43,7 @@ class Track : public Route TrackMode mode () const { return _mode; } virtual int set_mode (TrackMode /*m*/) { return false; } virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; } - boost::signals2::signal TrackModeChanged; + PBD::Signal0 TrackModeChanged; virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, bool state_changing, bool can_record, bool rec_monitors_input); @@ -90,8 +90,8 @@ class Track : public Route bool record_enabled() const; void set_record_enable (bool yn, void *src); - boost::signals2::signal DiskstreamChanged; - boost::signals2::signal FreezeChange; + PBD::Signal0 DiskstreamChanged; + PBD::Signal0 FreezeChange; protected: Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO); diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 2ad323ca1c..f60d16391f 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1504,7 +1504,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca continue; /* XXX is this OK? */ } - scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr(region))); + region->GoingAway.connect (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr(region))); _last_capture_regions.push_back (region); diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index acb44e43c4..85c3ffe1b2 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -528,8 +528,8 @@ AudioPlaylist::add_crossfade (boost::shared_ptr xfade) } else { _crossfades.push_back (xfade); - scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); - scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); + xfade->Invalidated.connect (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); + xfade->StateChanged.connect (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); notify_crossfade_added (xfade); } @@ -584,8 +584,8 @@ AudioPlaylist::set_state (const XMLNode& node, int version) try { boost::shared_ptr xfade = boost::shared_ptr (new Crossfade (*((const Playlist *)this), *child)); _crossfades.push_back (xfade); - scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); - scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); + xfade->Invalidated.connect (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); + xfade->StateChanged.connect (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); NewCrossfade(xfade); } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 736fe41738..19b5bd7be5 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -182,7 +182,7 @@ AudioTrack::set_diskstream (boost::shared_ptr ds, void * /*src* if (audio_diskstream()->deprecated_io_node) { if (!IO::connecting_legal) { - scoped_connect (IO::ConnectingLegal, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this)); + IO::ConnectingLegal.connect (*this, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this)); } else { deprecated_use_diskstream_connections (); } @@ -304,7 +304,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base) pending_state = const_cast (&node); if (_session.state_of_the_state() & Session::Loading) { - scoped_connect (_session.StateReady, boost::bind (&AudioTrack::set_state_part_two, this)); + _session.StateReady.connect (*this, boost::bind (&AudioTrack::set_state_part_two, this)); } else { set_state_part_two (); } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index b1c5527570..5b6a7da73a 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -550,7 +550,7 @@ AudioEngine::meter_thread () if (g_atomic_int_get(&m_meter_exit)) { break; } - Metering::update_meters (); + Metering::Meter (); } } @@ -735,9 +735,9 @@ AudioEngine::connect (const string& source, const string& destination) Port* dst = get_port_by_name_locked (d); if (src) { - ret = src->connect (d); + ret = src->connect (d); } else if (dst) { - ret = dst->connect (s); + ret = dst->connect (s); } else { /* neither port is known to us, and this API isn't intended for use as a general patch bay */ ret = -1; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 1500b139ac..297c02e418 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -70,7 +70,7 @@ using namespace Glib; ustring AudioFileSource::peak_dir = ""; -boost::signals2::signal AudioFileSource::HeaderPositionOffsetChanged; +PBD::Signal0 AudioFileSource::HeaderPositionOffsetChanged; uint64_t AudioFileSource::header_position_offset = 0; /* XXX maybe this too */ diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index ac173db546..cce7869072 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -96,7 +96,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, n { boost::shared_ptr afs = boost::dynamic_pointer_cast (src); if (afs) { - scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); + afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -113,7 +113,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, n { boost::shared_ptr afs = boost::dynamic_pointer_cast (src); if (afs) { - scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); + afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -205,7 +205,7 @@ AudioRegion::AudioRegion (boost::shared_ptr other, const Sour boost::shared_ptr afs = boost::dynamic_pointer_cast ((*i)); if (afs) { - scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); + afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this)); } } @@ -229,7 +229,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, const XMLNode& nod { boost::shared_ptr afs = boost::dynamic_pointer_cast (src); if (afs) { - scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); + afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -270,7 +270,7 @@ void AudioRegion::connect_to_analysis_changed () { for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) { - scoped_connect ((*i)->AnalysisChanged, boost::bind (&AudioRegion::invalidate_transients, this)); + (*i)->AnalysisChanged.connect (*this, boost::bind (&AudioRegion::invalidate_transients, this)); } } @@ -285,7 +285,7 @@ AudioRegion::connect_to_header_position_offset_changed () unique_srcs.insert (*i); boost::shared_ptr afs = boost::dynamic_pointer_cast (*i); if (afs) { - scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); + afs->HeaderPositionOffsetChanged.connect (*this, boost::bind (&AudioRegion::source_offset_changed, this)); } } } @@ -294,9 +294,9 @@ AudioRegion::connect_to_header_position_offset_changed () void AudioRegion::listen_to_my_curves () { - scoped_connect (_envelope->StateChanged, boost::bind (&AudioRegion::envelope_changed, this)); - scoped_connect (_fade_in->StateChanged, boost::bind (&AudioRegion::fade_in_changed, this)); - scoped_connect (_fade_out->StateChanged, boost::bind (&AudioRegion::fade_out_changed, this)); + _envelope->StateChanged.connect (*this, boost::bind (&AudioRegion::envelope_changed, this)); + _fade_in->StateChanged.connect (*this, boost::bind (&AudioRegion::fade_in_changed, this)); + _fade_out->StateChanged.connect (*this, boost::bind (&AudioRegion::fade_out_changed, this)); } void diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index fd481c9730..5fcabb0c77 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -149,7 +149,7 @@ AudioSource::update_length (sframes_t pos, sframes_t cnt) ***********************************************************************/ bool -AudioSource::peaks_ready (boost::function doThisWhenReady, boost::signals2::connection& connect_here_if_not) const +AudioSource::peaks_ready (boost::function doThisWhenReady, Connection& connect_here_if_not) const { bool ret; Glib::Mutex::Lock lm (_peaks_ready_lock); @@ -159,7 +159,7 @@ AudioSource::peaks_ready (boost::function doThisWhenReady, boost::signal */ if (!(ret = _peaks_built)) { - connect_here_if_not = PeaksReady.connect (doThisWhenReady); + PeaksReady.connect (connect_here_if_not, doThisWhenReady); } return ret; diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 7d353a1bdd..1e28ebc8b4 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -72,7 +72,7 @@ Auditioner::Auditioner (Session& s) _main_outs->allow_pan_reset (); _main_outs->reset_panner (); - scoped_connect (_output->changed, boost::bind (&Auditioner::output_changed, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Auditioner::output_changed, this, _1, _2)); the_region.reset ((AudioRegion*) 0); g_atomic_int_set (&_active, 0); diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 9a6eb08e45..3543f8b51f 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -35,7 +35,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -boost::signals2::signal AutomationList::AutomationListCreated; +PBD::Signal1 AutomationList::AutomationListCreated; #if 0 static void dumpit (const AutomationList& al, string prefix = "") diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 7f159a441c..1438f93722 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -42,8 +42,8 @@ using namespace std; using namespace PBD; using namespace ARDOUR; -boost::signals2::signal Delivery::CycleStart; -boost::signals2::signal Delivery::PannersLegal; +PBD::Signal1 Delivery::CycleStart; +PBD::Signal0 Delivery::PannersLegal; bool Delivery::panners_legal = false; /* deliver to an existing IO object */ @@ -64,10 +64,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr io, boost::shared_ptrchanged, boost::bind (&Delivery::output_changed, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2)); } - scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1)); } /* deliver to a new IO object */ @@ -88,10 +88,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr mm, const string& _display_to_user = false; if (_output) { - scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2)); } - scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1)); } /* deliver to a new IO object, reconstruct from XML */ @@ -116,10 +116,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr mm, const XMLNode& } if (_output) { - scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2)); } - scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1)); } /* deliver to an existing IO object, reconstruct from XML */ @@ -144,10 +144,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr out, boost::shared_ptrchanged, boost::bind (&Delivery::output_changed, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Delivery::output_changed, this, _1, _2)); } - scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&Delivery::cycle_start, this, _1)); } std::string @@ -419,7 +419,7 @@ Delivery::reset_panner () } } else { panner_legal_c.disconnect (); - panner_legal_c = PannersLegal.connect (boost::bind (&Delivery::panners_became_legal, this)); + PannersLegal.connect (panner_legal_c, boost::bind (&Delivery::panners_became_legal, this)); } } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index f9e8202ebc..8af85a553c 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -68,8 +68,8 @@ using namespace PBD; */ ARDOUR::nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256; -boost::signals2::signal Diskstream::DiskOverrun; -boost::signals2::signal Diskstream::DiskUnderrun; +PBD::Signal0 Diskstream::DiskOverrun; +PBD::Signal0 Diskstream::DiskUnderrun; Diskstream::Diskstream (Session &sess, const string &name, Flag flag) : SessionObject(sess, name) @@ -142,13 +142,13 @@ Diskstream::set_route (Route& r) _io = _route->input(); ic_connection.disconnect(); - ic_connection = _io->changed.connect (boost::bind (&Diskstream::handle_input_change, this, _1, _2)); + _io->changed.connect (ic_connection, boost::bind (&Diskstream::handle_input_change, this, _1, _2)); input_change_pending = ConfigurationChanged; non_realtime_input_change (); set_align_style_from_io (); - scoped_connect (_route->GoingAway, boost::bind (&Diskstream::route_going_away, this)); + _route->GoingAway.connect (*this, boost::bind (&Diskstream::route_going_away, this)); } void @@ -339,9 +339,9 @@ Diskstream::use_playlist (boost::shared_ptr playlist) reset_write_sources (false); } - playlist_connections.add_connection (_playlist->Modified.connect (boost::bind (&Diskstream::playlist_modified, this))); - playlist_connections.add_connection (_playlist->GoingAway.connect (boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr(_playlist)))); - playlist_connections.add_connection (_playlist->RangesMoved.connect (boost::bind (&Diskstream::playlist_ranges_moved, this, _1))); + _playlist->Modified.connect (playlist_connections, boost::bind (&Diskstream::playlist_modified, this)); + _playlist->GoingAway.connect (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr(_playlist))); + _playlist->RangesMoved.connect (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1)); } /* don't do this if we've already asked for it *or* if we are setting up diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc index 3e7c2c9a91..9f217c2cd9 100644 --- a/libs/ardour/element_importer.cc +++ b/libs/ardour/element_importer.cc @@ -32,8 +32,8 @@ using namespace std; using namespace PBD; using namespace ARDOUR; -boost::signals2::signal (string, string)> ElementImporter::Rename; -boost::signals2::signal ElementImporter::Prompt; +Signal2,string, string> ElementImporter::Rename; +Signal1 ElementImporter::Prompt; ElementImporter::ElementImporter (XMLTree const & source, ARDOUR::Session & session) : source (source), diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc index 3006fbc3ee..dfe038734b 100644 --- a/libs/ardour/export_channel.cc +++ b/libs/ardour/export_channel.cc @@ -108,7 +108,7 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio throw ExportFailed ("Unhandled type in ExportChannelFactory constructor"); } - export_connection = session->ProcessExport.connect (boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1)); + session->ProcessExport.connect (export_connection, boost::bind (&RegionExportChannelFactory::new_cycle_started, this, _1)); buffers.set_count (ChanCount (DataType::AUDIO, n_channels)); buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle); diff --git a/libs/ardour/export_format_manager.cc b/libs/ardour/export_format_manager.cc index f26f0635d8..d25877c5bc 100644 --- a/libs/ardour/export_format_manager.cc +++ b/libs/ardour/export_format_manager.cc @@ -211,13 +211,13 @@ void ExportFormatManager::add_compatibility (CompatPtr ptr) { compatibilities.push_back (ptr); - scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr))); + ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr))); } void ExportFormatManager::add_quality (QualityPtr ptr) { - scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_quality_selection, this, _1, WeakQualityPtr (ptr))); + ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_quality_selection, this, _1, WeakQualityPtr (ptr))); qualities.push_back (ptr); } @@ -225,7 +225,7 @@ void ExportFormatManager::add_format (FormatPtr ptr) { formats.push_back (ptr); - scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr))); + ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr))); universal_set = universal_set->get_union (*ptr); /* Encoding options */ @@ -233,15 +233,15 @@ ExportFormatManager::add_format (FormatPtr ptr) boost::shared_ptr hsf; if (hsf = boost::dynamic_pointer_cast (ptr)) { - scoped_connect (hsf->SampleFormatSelectChanged, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2)); - scoped_connect (hsf->DitherTypeSelectChanged, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2)); + hsf->SampleFormatSelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_sample_format_selection, this, _1, _2)); + hsf->DitherTypeSelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_dither_type_selection, this, _1, _2)); } } void ExportFormatManager::add_sample_rate (SampleRatePtr ptr) { - scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_sample_rate_selection, this, _1, WeakSampleRatePtr (ptr))); + ptr->SelectChanged.connect (*this, boost::bind (&ExportFormatManager::change_sample_rate_selection, this, _1, WeakSampleRatePtr (ptr))); sample_rates.push_back (ptr); } diff --git a/libs/ardour/export_formats.cc b/libs/ardour/export_formats.cc index b7637f3c07..a7dd544d47 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -59,10 +59,10 @@ HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format) SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format))); sample_format_states.push_back (ptr); - scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1)); + ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1)); // BOOST SIGNALS how to connect one signal to another - // scoped_connect (ptr->SelectChanged, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr)); - // scoped_connect (ptr->CompatibleChanged, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr)); + // ptr->SelectChanged.connect (*this, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr)); + // ptr->CompatibleChanged.connect (*this, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr)); } void @@ -70,10 +70,10 @@ HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustri { DitherTypePtr ptr (new DitherTypeState (type, name)); dither_type_states.push_back (ptr); - scoped_connect (ptr->SelectChanged, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1)); + ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1)); // BOOST SIGNALS how to connect one signal to another - // scoped_connect (ptr->SelectChanged, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr)); - // scoped_connect (ptr->CompatibleChanged, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr)); + // ptr->SelectChanged.connect (*this, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr)); + // ptr->CompatibleChanged.connect (*this, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr)); } HasSampleFormat::SampleFormatPtr diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 7bf231acd2..a85e41d40a 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -106,7 +106,7 @@ ExportHandler::ExportHandler (Session & session) { processor.reset (new ExportProcessor (session)); - files_written_connection = ExportProcessor::WritingFile.connect (boost::bind (&ExportHandler::add_file, this, _1)); + ExportProcessor::WritingFile.connect (files_written_connection, boost::bind (&ExportHandler::add_file, this, _1)); } ExportHandler::~ExportHandler () @@ -168,7 +168,7 @@ ExportHandler::do_export (bool rt) realtime = rt; - export_read_finished_connection = session.ExportReadFinished.connect (boost::bind (&ExportHandler::finish_timespan, this)); + session.ExportReadFinished.connect (export_read_finished_connection, boost::bind (&ExportHandler::finish_timespan, this)); start_timespan (); } @@ -505,7 +505,7 @@ ExportHandler::start_timespan () /* connect stuff and start export */ - current_timespan->process_connection = session.ProcessExport.connect (boost::bind (&ExportTimespan::process, current_timespan, _1)); + session.ProcessExport.connect (current_timespan->process_connection, boost::bind (&ExportTimespan::process, current_timespan, _1)); session.start_audio_export (current_timespan->get_start(), realtime); } @@ -566,7 +566,7 @@ ExportHandler::timespan_thread_finished () cc = current_map_it->second.channel_config; } - channel_config_connection = cc->FilesWritten.connect (boost::bind (&ExportHandler::timespan_thread_finished, this)); + cc->FilesWritten.connect (channel_config_connection, boost::bind (&ExportHandler::timespan_thread_finished, this)); ++current_map_it; } else { /* All files are written from current timespan, reset timespan and start new */ diff --git a/libs/ardour/export_processor.cc b/libs/ardour/export_processor.cc index 7d04e8f8d6..c7fcbd55aa 100644 --- a/libs/ardour/export_processor.cc +++ b/libs/ardour/export_processor.cc @@ -38,7 +38,7 @@ using namespace PBD; namespace ARDOUR { -boost::signals2::signal ExportProcessor::WritingFile; +PBD::Signal1 ExportProcessor::WritingFile; ExportProcessor::ExportProcessor (Session & session) : session (session), diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index e3e37a7107..b2f71ca6e6 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -109,7 +109,7 @@ apply_gain_to_buffer_t ARDOUR::apply_gain_to_buffer = 0; mix_buffers_with_gain_t ARDOUR::mix_buffers_with_gain = 0; mix_buffers_no_gain_t ARDOUR::mix_buffers_no_gain = 0; -boost::signals2::signal ARDOUR::BootMessage; +PBD::Signal1 ARDOUR::BootMessage; void ARDOUR::setup_enum_writer (); diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index ccee62c988..f42d3c4e80 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -27,20 +27,20 @@ using namespace std; using namespace ARDOUR; -boost::signals2::signal InternalReturn::CycleStart; +PBD::Signal1 InternalReturn::CycleStart; InternalReturn::InternalReturn (Session& s) : Return (s, true) , user_count (0) { - scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&InternalReturn::cycle_start, this, _1)); } InternalReturn::InternalReturn (Session& s, const XMLNode& node) : Return (s, node, true) , user_count (0) { - scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1)); + CycleStart.connect (*this, boost::bind (&InternalReturn::cycle_start, this, _1)); } void diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index d6489f8f49..7fc2efe9b9 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -43,8 +43,8 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr mm, boost: set_name (sendto->name()); - scoped_connect (_send_to->GoingAway, boost::bind (&InternalSend::send_to_going_away, this)); - scoped_connect (_send_to->NameChanged, boost::bind (&InternalSend::send_to_name_changed, this)); + _send_to->GoingAway.connect (*this, boost::bind (&InternalSend::send_to_going_away, this)); + _send_to->NameChanged.connect (*this, boost::bind (&InternalSend::send_to_name_changed, this)); } InternalSend::InternalSend (Session& s, boost::shared_ptr mm, const XMLNode& node) @@ -187,7 +187,7 @@ InternalSend::set_our_state (const XMLNode& node, int version) */ if (!IO::connecting_legal) { - connect_c = IO::ConnectingLegal.connect (boost::bind (&InternalSend::connect_when_legal, this)); + IO::ConnectingLegal.connect (connect_c, boost::bind (&InternalSend::connect_when_legal, this)); } else { connect_when_legal (); } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index b9fd9ccbc6..f47e147a18 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -67,8 +67,8 @@ using namespace PBD; const string IO::state_node_name = "IO"; bool IO::connecting_legal = false; -boost::signals2::signal IO::ConnectingLegal; -boost::signals2::signal IO::PortCountChanged; +PBD::Signal0 IO::ConnectingLegal; +PBD::Signal1 IO::PortCountChanged; /** @param default_type The type of port that will be created by ensure_io * and friends if no type is explicitly requested (to avoid breakage). @@ -566,7 +566,7 @@ IO::set_state (const XMLNode& node, int version) pending_state_node = new XMLNode (node); pending_state_node_version = version; pending_state_node_in = false; - connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this)); + ConnectingLegal.connect (connection_legal_c, boost::bind (&IO::connecting_became_legal, this)); } @@ -619,7 +619,7 @@ IO::set_state_2X (const XMLNode& node, int version, bool in) pending_state_node = new XMLNode (node); pending_state_node_version = version; pending_state_node_in = in; - connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this)); + ConnectingLegal.connect (connection_legal_c, boost::bind (&IO::connecting_became_legal, this)); } return 0; @@ -1399,7 +1399,7 @@ IO::bundles_connected () IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr b) { bundle = b; - changed = b->Changed.connect (boost::bind (&IO::bundle_changed, io, _1)); + b->Changed.connect (changed, boost::bind (&IO::bundle_changed, io, _1)); } std::string diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 4ad0f58580..580fd7804c 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -31,39 +31,7 @@ using namespace std; using namespace ARDOUR; -boost::signals2::signal Metering::Meter; -Glib::StaticMutex Metering::m_meter_signal_lock; - -boost::signals2::connection -Metering::connect (boost::function f) -{ - // SignalProcessor::Meter is emitted from another thread so the - // Meter signal must be protected. - Glib::Mutex::Lock guard (m_meter_signal_lock); - return Meter.connect (f); -} - -void -Metering::disconnect (boost::signals2::connection& c) -{ - Glib::Mutex::Lock guard (m_meter_signal_lock); - c.disconnect (); -} - -/** - Update the meters. - - The meter signal lock is taken to prevent modification of the - Meter signal while updating the meters, taking the meter signal - lock prior to taking the io_lock ensures that all IO will remain - valid while metering. -*/ -void -Metering::update_meters() -{ - Glib::Mutex::Lock guard (m_meter_signal_lock); - Meter(); /* EMIT SIGNAL */ -} +PBD::Signal0 Metering::Meter; PeakMeter::PeakMeter (Session& s, const XMLNode& node) : Processor (s, node) diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 12d25ac9ae..7303059207 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -43,8 +43,7 @@ using namespace MIDI; using namespace PBD; MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn) - : port_connections (0) - , ppqn (ppqn) + : ppqn (ppqn) , bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz { session = (ISlaveSessionProxy *) new SlaveSessionProxy(s); @@ -54,7 +53,6 @@ MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn) MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn) : session(session_proxy) - , port_connections (0) , ppqn (ppqn) , bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz { @@ -65,26 +63,24 @@ MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn) MIDIClock_Slave::~MIDIClock_Slave() { delete session; - delete port_connections; } void MIDIClock_Slave::rebind (MIDI::Port& p) { - delete port_connections; - port_connections = new ScopedConnectionList; - + port_connections.drop_connections(); + port = &p; #ifdef DEBUG_MIDI_CLOCK std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl; #endif - port_connections->add_connection (port->input()->timing.connect (boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2))); - port_connections->add_connection (port->input()->start.connect (boost::bind (&MIDIClock_Slave::start, this, _1, _2))); - port_connections->add_connection (port->input()->contineu.connect (boost::bind (&MIDIClock_Slave::contineu, this, _1, _2))); - port_connections->add_connection (port->input()->stop.connect (boost::bind (&MIDIClock_Slave::stop, this, _1, _2))); - port_connections->add_connection (port->input()->position.connect (boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3))); + port->input()->timing.connect (port_connections, boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2)); + port->input()->start.connect (port_connections, boost::bind (&MIDIClock_Slave::start, this, _1, _2)); + port->input()->contineu.connect (port_connections, boost::bind (&MIDIClock_Slave::contineu, this, _1, _2)); + port->input()->stop.connect (port_connections, boost::bind (&MIDIClock_Slave::stop, this, _1, _2)); + port->input()->position.connect (port_connections, boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3)); } void diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 6b181b1a27..2320bd4be4 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1024,7 +1024,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a continue; /* XXX is this OK? */ } - scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr(region))); + region->GoingAway.connect (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr(region))); _last_capture_regions.push_back (region); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 3b13d4db8d..b477dbb2f9 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -52,7 +52,7 @@ MidiRegion::MidiRegion (boost::shared_ptr src, nframes_t start, nfra : Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External)) { assert(_name.find("/") == string::npos); - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); } /* Basic MidiRegion constructor (one channel) */ @@ -60,7 +60,7 @@ MidiRegion::MidiRegion (boost::shared_ptr src, nframes_t start, nfra : Region (src, start, length, name, DataType::MIDI, layer, flags) { assert(_name.find("/") == string::npos); - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); } /* Basic MidiRegion constructor (many channels) */ @@ -68,7 +68,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t lengt : Region (srcs, start, length, name, DataType::MIDI, layer, flags) { assert(_name.find("/") == string::npos); - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); } @@ -77,14 +77,14 @@ MidiRegion::MidiRegion (boost::shared_ptr other, nframes_t off : Region (other, offset, length, name, layer, flags) { assert(_name.find("/") == string::npos); - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); } MidiRegion::MidiRegion (boost::shared_ptr other) : Region (other) { assert(_name.find("/") == string::npos); - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); } MidiRegion::MidiRegion (boost::shared_ptr src, const XMLNode& node) @@ -94,7 +94,7 @@ MidiRegion::MidiRegion (boost::shared_ptr src, const XMLNode& node) throw failed_constructor(); } - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); assert(_name.find("/") == string::npos); assert(_type == DataType::MIDI); } @@ -106,7 +106,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node) throw failed_constructor(); } - scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); + midi_source(0)->Switched.connect (*this, boost::bind (&MidiRegion::switch_source, this, _1)); assert(_name.find("/") == string::npos); assert(_type == DataType::MIDI); } diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 14b096c915..1e890170c4 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -49,7 +49,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -boost::signals2::signal MidiSource::MidiSourceCreated; +PBD::Signal1 MidiSource::MidiSourceCreated; MidiSource::MidiSource (Session& s, string name, Source::Flag flags) : Source(s, DataType::MIDI, name, flags) diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 179d0bb57c..a6c64c3c30 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -230,7 +230,7 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base) pending_state = const_cast (&node); if (_session.state_of_the_state() & Session::Loading) { - scoped_connect (_session.StateReady, boost::bind (&MidiTrack::set_state_part_two, this)); + _session.StateReady.connect (*this, boost::bind (&MidiTrack::set_state_part_two, this)); } else { set_state_part_two (); } diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc index db26ee8e83..be7a2bafc0 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -46,7 +46,7 @@ MidiControlUI::MidiControlUI (Session& s) : AbstractUI (_("midiui")) , _session (s) { - rebind_connection = MIDI::Manager::instance()->PortsChanged.connect (boost::bind (&MidiControlUI::change_midi_ports, this)); + MIDI::Manager::instance()->PortsChanged.connect (rebind_connection, boost::bind (&MidiControlUI::change_midi_ports, this)); } MidiControlUI::~MidiControlUI () diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 50ef5011ba..91ac47c883 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -52,7 +52,6 @@ const int MTC_Slave::frame_tolerance = 2; MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) : session (s) - , port_connections (0) { can_notify_on_unknown_rate = true; did_reset_tc_format = false; @@ -71,8 +70,6 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) MTC_Slave::~MTC_Slave() { - delete port_connections; - if (did_reset_tc_format) { session.config.set_timecode_format (saved_tc_format); } @@ -91,14 +88,13 @@ MTC_Slave::give_slave_full_control_over_transport_speed() const void MTC_Slave::rebind (MIDI::Port& p) { - delete port_connections; - port_connections = new ScopedConnectionList; + port_connections.drop_connections (); port = &p; - port_connections->add_connection (port->input()->mtc_time.connect ( boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3))); - port_connections->add_connection (port->input()->mtc_qtr.connect (boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3))); - port_connections->add_connection (port->input()->mtc_status.connect (boost::bind (&MTC_Slave::update_mtc_status, this, _1))); + port->input()->mtc_time.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_time, this, _1, _2, _3)); + port->input()->mtc_qtr.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_qtr, this, _1, _2, _3)); + port->input()->mtc_status.connect (port_connections, boost::bind (&MTC_Slave::update_mtc_status, this, _1)); } void diff --git a/libs/ardour/named_selection.cc b/libs/ardour/named_selection.cc index 81e9f9df8a..a829c44a50 100644 --- a/libs/ardour/named_selection.cc +++ b/libs/ardour/named_selection.cc @@ -32,7 +32,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -boost::signals2::signal NamedSelection::NamedSelectionCreated; +PBD::Signal1 NamedSelection::NamedSelectionCreated; typedef std::list > PlaylistList; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index b93e2b311a..985cd6740a 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -270,7 +270,7 @@ Playlist::init (bool hide) freeze_length = 0; _explicit_relayering = false; - scoped_connect (Modified, boost::bind (&Playlist::mark_session_dirty, this)); + Modified.connect (*this, boost::bind (&Playlist::mark_session_dirty, this)); } Playlist::~Playlist () @@ -605,8 +605,7 @@ Playlist::add_region_internal (boost::shared_ptr region, nframes_t posit } } - region_state_changed_connections.add_connection - (region->StateChanged.connect (boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr (region)))); + region->StateChanged.connect (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr (region))); return true; } diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc index cfcec40d1b..2619d0e0c4 100644 --- a/libs/ardour/playlist_factory.cc +++ b/libs/ardour/playlist_factory.cc @@ -31,7 +31,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -boost::signals2::signal, bool)> PlaylistFactory::PlaylistCreated; +PBD::Signal2, bool> PlaylistFactory::PlaylistCreated; boost::shared_ptr PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unused) diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 54701ae8d4..65517be4b1 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -56,7 +56,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -boost::signals2::signal Processor::ProcessorCreated; +PBD::Signal1 Processor::ProcessorCreated; // Always saved as Processor, but may be IOProcessor or Send in legacy sessions const string Processor::state_node_name = "Processor"; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 4fcb7de3ca..731a7c04dd 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -54,7 +54,7 @@ Change Region::LockChanged = ARDOUR::new_change (); Change Region::LayerChanged = ARDOUR::new_change (); Change Region::HiddenChanged = ARDOUR::new_change (); -boost::signals2::signal)> Region::RegionPropertyChanged; +PBD::Signal1 > Region::RegionPropertyChanged; /* derived-from-derived constructor (no sources in constructor) */ Region::Region (Session& s, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) @@ -109,7 +109,7 @@ Region::Region (boost::shared_ptr src, nframes_t start, nframes_t length _sources.push_back (src); _master_sources.push_back (src); - scoped_connect (src->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr(src))); + src->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr(src))); assert(_sources.size() > 0); _positional_lock_style = AudioTime; @@ -1586,14 +1586,14 @@ Region::use_sources (SourceList const & s) for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) { _sources.push_back (*i); - scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr(*i))); + (*i)->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr(*i))); unique_srcs.insert (*i); } for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) { _master_sources.push_back (*i); if (unique_srcs.find (*i) == unique_srcs.end()) { - scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr(*i))); + (*i)->GoingAway.connect (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr(*i))); } } } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index ff4b9d5270..6399645be1 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -34,7 +34,7 @@ using namespace ARDOUR; using namespace PBD; -boost::signals2::signal)> RegionFactory::CheckNewRegion; +PBD::Signal1 > RegionFactory::CheckNewRegion; boost::shared_ptr RegionFactory::create (boost::shared_ptr region, nframes_t start, diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 154c5fd0a0..eeb8ae83c1 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -63,7 +63,7 @@ using namespace ARDOUR; using namespace PBD; uint32_t Route::order_key_cnt = 0; -boost::signals2::signal Route::SyncOrderKeys; +PBD::Signal1 Route::SyncOrderKeys; Route::Route (Session& sess, string name, Flag flg, DataType default_type) : SessionObject (sess, name) @@ -93,7 +93,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) /* now that we have _meter, its safe to connect to this */ - scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this))); + Metering::Meter.connect (*this, (boost::bind (&Route::meter, this))); } Route::Route (Session& sess, const XMLNode& node, DataType default_type) @@ -109,7 +109,7 @@ Route::Route (Session& sess, const XMLNode& node, DataType default_type) /* now that we have _meter, its safe to connect to this */ - scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this))); + Metering::Meter.connect (*this, (boost::bind (&Route::meter, this))); } void @@ -147,8 +147,8 @@ Route::init () _input.reset (new IO (_session, _name, IO::Input, _default_type)); _output.reset (new IO (_session, _name, IO::Output, _default_type)); - scoped_connect (_input->changed, boost::bind (&Route::input_change_handler, this, _1, _2)); - scoped_connect (_output->changed, boost::bind (&Route::output_change_handler, this, _1, _2)); + _input->changed.connect (*this, boost::bind (&Route::input_change_handler, this, _1, _2)); + _output->changed.connect (*this, boost::bind (&Route::output_change_handler, this, _1, _2)); /* add amp processor */ @@ -792,7 +792,7 @@ Route::add_processor (boost::shared_ptr processor, ProcessorList::ite // XXX: do we want to emit the signal here ? change call order. processor->activate (); } - scoped_connect (processor->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false)); + processor->ActiveChanged.connect (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false)); _output->set_user_latency (0); } @@ -1047,7 +1047,7 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter return -1; } - scoped_connect ((*i)->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false)); + (*i)->ActiveChanged.connect (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false)); } _output->set_user_latency (0); diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 82953be0f8..1da2eda678 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -76,7 +76,7 @@ RouteGroup::add (boost::shared_ptr r) routes->push_back (r); r->join_route_group (this); - scoped_connect (r->GoingAway, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr (r))); + r->GoingAway.connect (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr (r))); _session.set_dirty (); changed (); /* EMIT SIGNAL */ diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d8e3b2843c..b2a1aa8da8 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -103,17 +103,17 @@ using boost::weak_ptr; bool Session::_disable_all_loaded_plugins = false; -boost::signals2::signal Session::Dialog; -boost::signals2::signal Session::AskAboutPendingState; -boost::signals2::signal Session::AskAboutSampleRateMismatch; -boost::signals2::signal Session::SendFeedback; - -boost::signals2::signal Session::TimecodeOffsetChanged; -boost::signals2::signal Session::StartTimeChanged; -boost::signals2::signal Session::EndTimeChanged; -boost::signals2::signal Session::AutoBindingOn; -boost::signals2::signal Session::AutoBindingOff; -boost::signals2::signal Session::Exported; +PBD::Signal1 Session::Dialog; +PBD::Signal0 Session::AskAboutPendingState; +PBD::Signal2 Session::AskAboutSampleRateMismatch; +PBD::Signal0 Session::SendFeedback; + +PBD::Signal0 Session::TimecodeOffsetChanged; +PBD::Signal0 Session::StartTimeChanged; +PBD::Signal0 Session::EndTimeChanged; +PBD::Signal0 Session::AutoBindingOn; +PBD::Signal0 Session::AutoBindingOff; +PBD::Signal2 Session::Exported; static void clean_up_session_event (SessionEvent* ev) { delete ev; } const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event); @@ -189,8 +189,8 @@ Session::Session (AudioEngine &eng, _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false)); - scoped_connect (config.ParameterChanged, boost::bind (&Session::config_changed, this, _1, true)); + Config->ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, false)); + config.ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, true)); if (was_dirty) { DirtyChanged (); /* EMIT SIGNAL */ @@ -326,7 +326,7 @@ Session::Session (AudioEngine &eng, _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false)); + Config->ParameterChanged.connect (*this, boost::bind (&Session::config_changed, this, _1, false)); } Session::~Session () @@ -524,7 +524,7 @@ Session::when_engine_running () /* every time we reconnect, recompute worst case output latencies */ - scoped_connect (_engine.Running, boost::bind (&Session::set_worst_io_latencies, this)); + _engine.Running.connect (*this, boost::bind (&Session::set_worst_io_latencies, this)); if (synced_to_jack()) { _engine.transport_stop (); @@ -878,7 +878,7 @@ Session::diskstream_playlist_changed (boost::weak_ptr wp) boost::shared_ptr playlist; if ((playlist = dstream->playlist()) != 0) { - scoped_connect (playlist->LengthChanged, boost::bind (&Session::playlist_length_changed, this)); + playlist->LengthChanged.connect (*this, boost::bind (&Session::playlist_length_changed, this)); } /* see comment in playlist_length_changed () */ @@ -1014,9 +1014,9 @@ Session::set_auto_punch_location (Location* location) punch_connections.drop_connections (); - punch_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_punch_start_changed, this, _1))); - punch_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_punch_end_changed, this, _1))); - punch_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_punch_changed, this, _1))); + location->start_changed.connect (punch_connections, boost::bind (&Session::auto_punch_start_changed, this, _1)); + location->end_changed.connect (punch_connections, boost::bind (&Session::auto_punch_end_changed, this, _1)); + location->changed.connect (punch_connections, boost::bind (&Session::auto_punch_changed, this, _1)); location->set_auto_punch (true, this); @@ -1052,9 +1052,9 @@ Session::set_auto_loop_location (Location* location) loop_connections.drop_connections (); - loop_connections.add_connection (location->start_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1))); - loop_connections.add_connection (location->end_changed.connect (boost::bind (&Session::auto_loop_changed, this, _1))); - loop_connections.add_connection (location->changed.connect (boost::bind (&Session::auto_loop_changed, this, _1))); + location->start_changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1)); + location->end_changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1)); + location->changed.connect (loop_connections, boost::bind (&Session::auto_loop_changed, this, _1)); location->set_auto_loop (true, this); @@ -1648,7 +1648,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m route_group->add (track); } - scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this)); + track->DiskstreamChanged.connect (*this, boost::bind (&Session::resort_routes, this)); //track->set_remote_control_id (control_id); new_routes.push_back (track); @@ -1823,7 +1823,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod track->audio_diskstream()->non_realtime_input_change(); - scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this)); + track->DiskstreamChanged.connect (*this, boost::bind (&Session::resort_routes, this)); track->set_remote_control_id (control_id); ++control_id; @@ -2150,12 +2150,12 @@ Session::add_routes (RouteList& new_routes, bool save) boost::weak_ptr wpr (*x); - scoped_connect ((*x)->listen_changed, boost::bind (&Session::route_listen_changed, this, _1, wpr)); - scoped_connect ((*x)->solo_changed, boost::bind (&Session::route_solo_changed, this, _1, wpr)); - scoped_connect ((*x)->mute_changed, boost::bind (&Session::route_mute_changed, this, _1)); - scoped_connect ((*x)->output()->changed, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2)); - scoped_connect ((*x)->processors_changed, boost::bind (&Session::route_processors_changed, this, _1)); - scoped_connect ((*x)->route_group_changed, boost::bind (&Session::route_group_changed, this)); + (*x)->listen_changed.connect (*this, boost::bind (&Session::route_listen_changed, this, _1, wpr)); + (*x)->solo_changed.connect (*this, boost::bind (&Session::route_solo_changed, this, _1, wpr)); + (*x)->mute_changed.connect (*this, boost::bind (&Session::route_mute_changed, this, _1)); + (*x)->output()->changed.connect (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2)); + (*x)->processors_changed.connect (*this, boost::bind (&Session::route_processors_changed, this, _1)); + (*x)->route_group_changed.connect (*this, boost::bind (&Session::route_group_changed, this)); if ((*x)->is_master()) { _master_out = (*x); @@ -2295,11 +2295,11 @@ Session::add_diskstream (boost::shared_ptr dstream) /* writer goes out of scope, copies ds back to main */ } - scoped_connect (dstream->PlaylistChanged, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr (dstream))); + dstream->PlaylistChanged.connect (*this, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr (dstream))); /* this will connect to future changes, and check the current length */ diskstream_playlist_changed (boost::weak_ptr (dstream)); - scoped_connect (dstream->RecordEnableChanged, boost::bind (&Session::update_have_rec_enabled_diskstream, this)); + dstream->RecordEnableChanged.connect (*this, boost::bind (&Session::update_have_rec_enabled_diskstream, this)); dstream->prepare (); @@ -2813,8 +2813,8 @@ Session::add_regions (vector >& new_regions) } } - scoped_connect (region->StateChanged, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr(region))); - scoped_connect (region->GoingAway, boost::bind (&Session::remove_region, this, boost::weak_ptr(region))); + region->StateChanged.connect (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr(region))); + region->GoingAway.connect (*this, boost::bind (&Session::remove_region, this, boost::weak_ptr(region))); update_region_name_map (region); } @@ -3002,7 +3002,7 @@ Session::add_source (boost::shared_ptr source) } if (result.second) { - scoped_connect (source->GoingAway, boost::bind (&Session::remove_source, this, boost::weak_ptr (source))); + source->GoingAway.connect (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr (source))); set_dirty(); } @@ -3393,7 +3393,7 @@ Session::add_playlist (boost::shared_ptr playlist, bool unused) bool existing = playlists->add (playlist); if (!existing) { - scoped_connect (playlist->GoingAway, boost::bind (&Session::remove_playlist, this, boost::weak_ptr(playlist))); + playlist->GoingAway.connect (*this, boost::bind (&Session::remove_playlist, this, boost::weak_ptr(playlist))); } if (unused) { @@ -3567,7 +3567,7 @@ Session::graph_reordered () void Session::add_processor (Processor* processor) { - scoped_connect (processor->GoingAway, boost::bind (&Session::remove_processor, this, processor)); + processor->GoingAway.connect (*this, boost::bind (&Session::remove_processor, this, processor)); set_dirty(); } diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 8b56271e42..1bd0c2e7c7 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -91,8 +91,8 @@ Session::pre_export () _exporting = true; export_status->running = true; - scoped_connect (export_status->Aborting, boost::bind (&Session::stop_audio_export, this)); - scoped_connect (export_status->Finished, boost::bind (&Session::finalize_audio_export, this)); + export_status->Aborting.connect (*this, boost::bind (&Session::stop_audio_export, this)); + export_status->Finished.connect (*this, boost::bind (&Session::finalize_audio_export, this)); return 0; } @@ -150,7 +150,7 @@ Session::start_audio_export (nframes_t position, bool realtime) last_process_function = process_function; process_function = &Session::process_export; } else { - export_freewheel_connection = _engine.Freewheel.connect (boost::bind (&Session::process_export_fw, this, _1)); + _engine.Freewheel.connect (export_freewheel_connection, boost::bind (&Session::process_export_fw, this, _1)); return _engine.freewheel (true); } diff --git a/libs/ardour/session_handle.cc b/libs/ardour/session_handle.cc index 03671cfa68..f1f6147960 100644 --- a/libs/ardour/session_handle.cc +++ b/libs/ardour/session_handle.cc @@ -32,7 +32,7 @@ SessionHandlePtr::SessionHandlePtr (Session* s) : _session (s) { if (_session) { - _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this))); + _session->GoingAway.connect (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this)); } } @@ -47,7 +47,7 @@ SessionHandlePtr::set_session (Session* s) if (s) { _session = s; - _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this))); + _session->GoingAway.connect (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this)); } } @@ -63,7 +63,7 @@ SessionHandlePtr::session_going_away () SessionHandleRef::SessionHandleRef (Session& s) : _session (s) { - scoped_connect (_session.GoingAway, boost::bind (&SessionHandleRef::session_going_away, this)); + _session.GoingAway.connect (*this, boost::bind (&SessionHandleRef::session_going_away, this)); } void diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index b2cece991c..4f0c70aa20 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -208,26 +208,26 @@ Session::set_mmc_port (string port_tag) mmc->set_send_device_id (old_send_device_id); } - scoped_connect (mmc->Play, boost::bind (&Session::mmc_deferred_play, this, _1)); - scoped_connect (mmc->DeferredPlay, boost::bind (&Session::mmc_deferred_play, this, _1)); - scoped_connect (mmc->Stop, boost::bind (&Session::mmc_stop, this, _1)); - scoped_connect (mmc->FastForward, boost::bind (&Session::mmc_fast_forward, this, _1)); - scoped_connect (mmc->Rewind, boost::bind (&Session::mmc_rewind, this, _1)); - scoped_connect (mmc->Pause, boost::bind (&Session::mmc_pause, this, _1)); - scoped_connect (mmc->RecordPause, boost::bind (&Session::mmc_record_pause, this, _1)); - scoped_connect (mmc->RecordStrobe, boost::bind (&Session::mmc_record_strobe, this, _1)); - scoped_connect (mmc->RecordExit, boost::bind (&Session::mmc_record_exit, this, _1)); - scoped_connect (mmc->Locate, boost::bind (&Session::mmc_locate, this, _1, _2)); - scoped_connect (mmc->Step, boost::bind (&Session::mmc_step, this, _1, _2)); - scoped_connect (mmc->Shuttle, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3)); - scoped_connect (mmc->TrackRecordStatusChange, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3)); + mmc->Play.connect (*this, boost::bind (&Session::mmc_deferred_play, this, _1)); + mmc->DeferredPlay.connect (*this, boost::bind (&Session::mmc_deferred_play, this, _1)); + mmc->Stop.connect (*this, boost::bind (&Session::mmc_stop, this, _1)); + mmc->FastForward.connect (*this, boost::bind (&Session::mmc_fast_forward, this, _1)); + mmc->Rewind.connect (*this, boost::bind (&Session::mmc_rewind, this, _1)); + mmc->Pause.connect (*this, boost::bind (&Session::mmc_pause, this, _1)); + mmc->RecordPause.connect (*this, boost::bind (&Session::mmc_record_pause, this, _1)); + mmc->RecordStrobe.connect (*this, boost::bind (&Session::mmc_record_strobe, this, _1)); + mmc->RecordExit.connect (*this, boost::bind (&Session::mmc_record_exit, this, _1)); + mmc->Locate.connect (*this, boost::bind (&Session::mmc_locate, this, _1, _2)); + mmc->Step.connect (*this, boost::bind (&Session::mmc_step, this, _1, _2)); + mmc->Shuttle.connect (*this, boost::bind (&Session::mmc_shuttle, this, _1, _2, _3)); + mmc->TrackRecordStatusChange.connect (*this, boost::bind (&Session::mmc_record_enable, this, _1, _2, _3)); /* also handle MIDI SPP because its so common */ - scoped_connect (_mmc_port->input()->start, boost::bind (&Session::spp_start, this, _1, _2)); - scoped_connect (_mmc_port->input()->contineu, boost::bind (&Session::spp_continue, this, _1, _2)); - scoped_connect (_mmc_port->input()->stop, boost::bind (&Session::spp_stop, this, _1, _2)); + _mmc_port->input()->start.connect (*this, boost::bind (&Session::spp_start, this, _1, _2)); + _mmc_port->input()->contineu.connect (*this, boost::bind (&Session::spp_continue, this, _1, _2)); + _mmc_port->input()->stop.connect (*this, boost::bind (&Session::spp_stop, this, _1, _2)); Config->set_mmc_port_name (port_tag); diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index ec9220ed41..0d32ea75d7 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -74,7 +74,7 @@ SessionPlaylists::add (boost::shared_ptr playlist) if (!existing) { playlists.insert (playlists.begin(), playlist); - scoped_connect (playlist->InUse, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr(playlist))); + playlist->InUse.connect (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr(playlist))); } return existing; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 4c7515f5e4..16cbfd1d36 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -164,7 +164,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) _base_frame_rate = _current_frame_rate; _tempo_map = new TempoMap (_current_frame_rate); - scoped_connect (_tempo_map->StateChanged, boost::bind (&Session::tempo_map_changed, this, _1)); + _tempo_map->StateChanged.connect (*this, boost::bind (&Session::tempo_map_changed, this, _1)); _non_soloed_outs_muted = false; @@ -266,21 +266,21 @@ Session::first_stage_init (string fullpath, string snapshot_name) delta_accumulator_cnt = 0; _slave_state = Stopped; - scoped_connect (_engine.GraphReordered, boost::bind (&Session::graph_reordered, this)); + _engine.GraphReordered.connect (*this, boost::bind (&Session::graph_reordered, this)); /* These are all static "per-class" signals */ - scoped_connect (RegionFactory::CheckNewRegion, boost::bind (&Session::add_region, this, _1)); - scoped_connect (SourceFactory::SourceCreated, boost::bind (&Session::add_source, this, _1)); - scoped_connect (PlaylistFactory::PlaylistCreated, boost::bind (&Session::add_playlist, this, _1, _2)); - scoped_connect (Processor::ProcessorCreated, boost::bind (&Session::add_processor, this, _1)); - scoped_connect (NamedSelection::NamedSelectionCreated, boost::bind (&Session::add_named_selection, this, _1)); - scoped_connect (AutomationList::AutomationListCreated, boost::bind (&Session::add_automation_list, this, _1)); + RegionFactory::CheckNewRegion.connect (*this, boost::bind (&Session::add_region, this, _1)); + SourceFactory::SourceCreated.connect (*this, boost::bind (&Session::add_source, this, _1)); + PlaylistFactory::PlaylistCreated.connect (*this, boost::bind (&Session::add_playlist, this, _1, _2)); + Processor::ProcessorCreated.connect (*this, boost::bind (&Session::add_processor, this, _1)); + NamedSelection::NamedSelectionCreated.connect (*this, boost::bind (&Session::add_named_selection, this, _1)); + AutomationList::AutomationListCreated.connect (*this, boost::bind (&Session::add_automation_list, this, _1)); // BOOST SIGNALS - // scoped_connect (Controllable::Destroyed, boost::bind (&Session::remove_controllable, this, _1)); + // Controllable::Destroyed.connect (*this, boost::bind (&Session::remove_controllable, this, _1)); - scoped_connect (IO::PortCountChanged, boost::bind (&Session::ensure_buffers, this, _1)); + IO::PortCountChanged.connect (*this, boost::bind (&Session::ensure_buffers, this, _1)); /* stop IO objects from doing stuff until we're ready for them */ @@ -332,15 +332,15 @@ Session::second_stage_init (bool new_session) _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave|Loading); - scoped_connect (_locations.changed, boost::bind (&Session::locations_changed, this)); - scoped_connect (_locations.added, boost::bind (&Session::locations_added, this, _1)); + _locations.changed.connect (*this, boost::bind (&Session::locations_changed, this)); + _locations.added.connect (*this, boost::bind (&Session::locations_added, this, _1)); setup_click_sounds (0); setup_midi_control (); /* Pay attention ... */ - scoped_connect (_engine.Halted, boost::bind (&Session::engine_halted, this)); - scoped_connect (_engine.Xrun, boost::bind (&Session::xrun_recovery, this)); + _engine.Halted.connect (*this, boost::bind (&Session::engine_halted, this)); + _engine.Xrun.connect (*this, boost::bind (&Session::xrun_recovery, this)); try { when_engine_running(); diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 64cad0f2b6..6805e5f6dd 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -192,8 +192,7 @@ SndFileSource::init_sndfile () _timeline_position = header_position_offset; } - AudioFileSource::HeaderPositionOffsetChanged.connect ( - boost::bind (&SndFileSource::handle_header_position_change, this)); + AudioFileSource::HeaderPositionOffsetChanged.connect (header_position_connection, boost::bind (&SndFileSource::handle_header_position_change, this)); } int diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index e401b010ea..9b9a28c698 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -50,7 +50,7 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -boost::signals2::signal)> SourceFactory::SourceCreated; +PBD::Signal1 > SourceFactory::SourceCreated; Glib::Cond* SourceFactory::PeaksToBuild; Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT; std::list > SourceFactory::files_with_peaks; diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 0a6bb8b20b..30d6c5f2d0 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -34,7 +34,7 @@ void Ticker::set_session (Session* s) SessionHandlePtr::set_session (s); if (_session) { - _session_connections.add_connection (_session->tick.connect (boost::bind (&Ticker::tick, this, _1, _2, _3))); + _session->tick.connect (_session_connections, boost::bind (&Ticker::tick, this, _1, _2, _3)); } } @@ -43,10 +43,10 @@ void MidiClockTicker::set_session (Session* s) Ticker::set_session (s); if (_session) { - _session_connections.add_connection (_session->MIDIClock_PortChanged.connect (boost::bind (&MidiClockTicker::update_midi_clock_port, this))); - _session_connections.add_connection (_session->TransportStateChange.connect (boost::bind (&MidiClockTicker::transport_state_changed, this))); - _session_connections.add_connection (_session->PositionChanged.connect (boost::bind (&MidiClockTicker::position_changed, this, _1))); - _session_connections.add_connection (_session->TransportLooped.connect (boost::bind (&MidiClockTicker::transport_looped, this))); + _session->MIDIClock_PortChanged.connect (_session_connections, boost::bind (&MidiClockTicker::update_midi_clock_port, this)); + _session->TransportStateChange.connect (_session_connections, boost::bind (&MidiClockTicker::transport_state_changed, this)); + _session->PositionChanged.connect (_session_connections, boost::bind (&MidiClockTicker::position_changed, this, _1)); + _session->TransportLooped.connect (_session_connections, boost::bind (&MidiClockTicker::transport_looped, this)); update_midi_clock_port(); } } diff --git a/libs/gtkmm2ext/binding_proxy.cc b/libs/gtkmm2ext/binding_proxy.cc index 140dea7e5b..08d215036d 100644 --- a/libs/gtkmm2ext/binding_proxy.cc +++ b/libs/gtkmm2ext/binding_proxy.cc @@ -88,7 +88,7 @@ BindingProxy::button_press_handler (GdkEventButton *ev) } prompter->set_text (prompt); prompter->touch (); // shows popup - learning_connection = controllable->LearningFinished.connect (boost::bind (&BindingProxy::learning_finished, this)); + controllable->LearningFinished.connect (learning_connection, boost::bind (&BindingProxy::learning_finished, this)); } return true; } diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index 9e339654b4..bf71b0579c 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -35,44 +35,30 @@ Channel::Channel (byte channelnum, Port &p) : _port (p) void Channel::connect_input_signals () { - add_connection (_port.input()->channel_pressure[_channel_number].connect - (boost::bind (&Channel::process_chanpress, this, _1, _2))); - add_connection (_port.input()->channel_note_on[_channel_number].connect - (boost::bind (&Channel::process_note_on, this, _1, _2))); - add_connection (_port.input()->channel_note_off[_channel_number].connect - (boost::bind (&Channel::process_note_off, this, _1, _2))); - add_connection (_port.input()->channel_poly_pressure[_channel_number].connect - (boost::bind (&Channel::process_polypress, this, _1, _2))); - add_connection (_port.input()->channel_program_change[_channel_number].connect - (boost::bind (&Channel::process_program_change, this, _1, _2))); - add_connection (_port.input()->channel_controller[_channel_number].connect - (boost::bind (&Channel::process_controller, this, _1, _2))); - add_connection (_port.input()->channel_pitchbend[_channel_number].connect - (boost::bind (&Channel::process_pitchbend, this, _1, _2))); - - add_connection (_port.input()->reset.connect (boost::bind (&Channel::process_reset, this, _1))); + _port.input()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2)); + _port.input()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2)); + _port.input()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2)); + _port.input()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2)); + _port.input()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2)); + _port.input()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2)); + _port.input()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2)); + + _port.input()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1)); } void Channel::connect_output_signals () { - add_connection (_port.output()->channel_pressure[_channel_number].connect - (boost::bind (&Channel::process_chanpress, this, _1, _2))); - add_connection (_port.output()->channel_note_on[_channel_number].connect - (boost::bind (&Channel::process_note_on, this, _1, _2))); - add_connection (_port.output()->channel_note_off[_channel_number].connect - (boost::bind (&Channel::process_note_off, this, _1, _2))); - add_connection (_port.output()->channel_poly_pressure[_channel_number].connect - (boost::bind (&Channel::process_polypress, this, _1, _2))); - add_connection (_port.output()->channel_program_change[_channel_number].connect - (boost::bind (&Channel::process_program_change, this, _1, _2))); - add_connection (_port.output()->channel_controller[_channel_number].connect - (boost::bind (&Channel::process_controller, this, _1, _2))); - add_connection (_port.output()->channel_pitchbend[_channel_number].connect - (boost::bind (&Channel::process_pitchbend, this, _1, _2))); - - add_connection (_port.output()->reset.connect (boost::bind (&Channel::process_reset, this, _1))); + _port.output()->channel_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_chanpress, this, _1, _2)); + _port.output()->channel_note_on[_channel_number].connect (*this, boost::bind (&Channel::process_note_on, this, _1, _2)); + _port.output()->channel_note_off[_channel_number].connect (*this, boost::bind (&Channel::process_note_off, this, _1, _2)); + _port.output()->channel_poly_pressure[_channel_number].connect (*this, boost::bind (&Channel::process_polypress, this, _1, _2)); + _port.output()->channel_program_change[_channel_number].connect (*this, boost::bind (&Channel::process_program_change, this, _1, _2)); + _port.output()->channel_controller[_channel_number].connect (*this, boost::bind (&Channel::process_controller, this, _1, _2)); + _port.output()->channel_pitchbend[_channel_number].connect (*this, boost::bind (&Channel::process_pitchbend, this, _1, _2)); + + _port.output()->reset.connect (*this, boost::bind (&Channel::process_reset, this, _1)); } void diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index 617ae14430..470ccd447c 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -22,8 +22,7 @@ #include -#include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "midi++/types.h" #include "midi++/parser.h" diff --git a/libs/midi++2/midi++/manager.h b/libs/midi++2/midi++/manager.h index d451d234c8..90bdde3e70 100644 --- a/libs/midi++2/midi++/manager.h +++ b/libs/midi++2/midi++/manager.h @@ -83,7 +83,7 @@ class Manager { int get_known_ports (std::vector&); - boost::signals2::signal PortsChanged; + PBD::Signal0 PortsChanged; private: /* This is a SINGLETON pattern */ diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 0b06222438..687d0e14d8 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -20,8 +20,7 @@ #ifndef __midipp_mmc_h_h__ #define __midipp_mmc_h_h__ -#include - +#include "pbd/signals.h" #include "midi++/types.h" namespace MIDI { @@ -32,7 +31,7 @@ class Parser; class MachineControl { public: - typedef boost::signals2::signal MMCSignal; + typedef PBD::Signal1 MMCSignal; typedef byte CommandSignature[60]; typedef byte ResponseSignature[60]; @@ -144,20 +143,20 @@ class MachineControl true if the direction is "forwards", false for "reverse" */ - boost::signals2::signal Shuttle; + PBD::Signal3 Shuttle; /* The second argument specifies the desired track record enabled status. */ - boost::signals2::signal + PBD::Signal3 TrackRecordStatusChange; /* The second argument specifies the desired track record enabled status. */ - boost::signals2::signal + PBD::Signal3 TrackMuteChange; /* The second argument points to a byte array containing @@ -165,11 +164,11 @@ class MachineControl format (5 bytes, roughly: hrs/mins/secs/frames/subframes) */ - boost::signals2::signal Locate; + PBD::Signal2 Locate; /* The second argument is the number of steps to jump */ - boost::signals2::signal Step; + PBD::Signal2 Step; protected: @@ -257,7 +256,7 @@ class MachineControl MIDI::Port &_port; void process_mmc_message (Parser &p, byte *, size_t len); - boost::signals2::scoped_connection mmc_connection; + PBD::ScopedConnection mmc_connection; int do_masked_write (byte *, size_t len); int do_locate (byte *, size_t len); diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index 497a50abe8..43cf80c067 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -23,7 +23,7 @@ #include #include -#include +#include "pbd/signals.h" #include "midi++/types.h" @@ -32,12 +32,12 @@ namespace MIDI { class Port; class Parser; -typedef boost::signals2::signal ZeroByteSignal; -typedef boost::signals2::signal TimestampedSignal; -typedef boost::signals2::signal OneByteSignal; -typedef boost::signals2::signal TwoByteSignal; -typedef boost::signals2::signal PitchBendSignal; -typedef boost::signals2::signal Signal; +typedef PBD::Signal1 ZeroByteSignal; +typedef PBD::Signal2 TimestampedSignal; +typedef PBD::Signal2 OneByteSignal; +typedef PBD::Signal2 TwoByteSignal; +typedef PBD::Signal2 PitchBendSignal; +typedef PBD::Signal3 Signal; class Parser { public: @@ -109,9 +109,9 @@ class Parser { void set_offline (bool); bool offline() const { return _offline; } - boost::signals2::signal OfflineStatusChanged; + PBD::Signal0 OfflineStatusChanged; - boost::signals2::signal edit; + PBD::Signal2 edit; void set_mmc_forwarding (bool yn) { _mmc_forward = yn; @@ -124,10 +124,10 @@ class Parser { const byte *mtc_current() const { return _mtc_time; } bool mtc_locked() const { return _mtc_locked; } - boost::signals2::signal mtc_qtr; - boost::signals2::signal mtc_time; - boost::signals2::signal mtc_status; - boost::signals2::signal mtc_skipped; + PBD::Signal3 mtc_qtr; + PBD::Signal3 mtc_time; + PBD::Signal1 mtc_status; + PBD::Signal0 mtc_skipped; void set_mtc_forwarding (bool yn) { _mtc_forward = yn; @@ -142,7 +142,7 @@ class Parser { std::ostream *trace_stream; std::string trace_prefix; void trace_event (Parser &p, byte *msg, size_t len); - boost::signals2::scoped_connection trace_connection; + PBD::ScopedConnection trace_connection; size_t message_counter[256]; diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 0c5fe4ae37..16db09f0e4 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -22,7 +22,6 @@ #include #include -#include #include "pbd/xml++.h" #include "midi++/types.h" diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index e496e37aa9..eb1c6cb5b0 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -206,7 +206,7 @@ MachineControl::MachineControl (Port &p, float /*version*/, _send_device_id = 0x7f; if ((parser = _port.input()) != 0) { - mmc_connection = parser->mmc.connect (boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3)); + parser->mmc.connect (mmc_connection, boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3)); } else { warning << "MMC connected to a non-input port: useless!" << endmsg; diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index 4f19c40ebe..2efa77ae0b 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -316,7 +316,7 @@ Parser::trace (bool onoff, ostream *o, const string &prefix) cerr << "enabling tracing for port " << _port.name() << endl; trace_stream = o; trace_prefix = prefix; - trace_connection = any.connect (boost::bind (&Parser::trace_event, this, _1, _2, _3)); + any.connect (trace_connection, boost::bind (&Parser::trace_event, this, _1, _2, _3)); } else { trace_prefix = ""; trace_stream = 0; diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index 369e2bd545..dd0dfd4445 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -26,15 +26,16 @@ using namespace PBD; using namespace std; -boost::signals2::signal Controllable::Destroyed; -boost::signals2::signal Controllable::StartLearning; -boost::signals2::signal Controllable::StopLearning; -boost::signals2::signal Controllable::CreateBinding; -boost::signals2::signal Controllable::DeleteBinding; +PBD::Signal1 Controllable::Destroyed; +PBD::Signal1 Controllable::StartLearning; +PBD::Signal1 Controllable::StopLearning; +PBD::Signal3 Controllable::CreateBinding; +PBD::Signal1 Controllable::DeleteBinding; Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT; Controllable::Controllables Controllable::registry; Controllable::ControllablesByURI Controllable::registry_by_uri; +PBD::ScopedConnectionList registry_connections; Controllable::Controllable (const string& name, const string& uri) : _name (name) @@ -61,7 +62,7 @@ Controllable::add (Controllable& ctl) /* Controllable::remove() is static - no need to manage this connection */ - ctl.GoingAway.connect (boost::bind (&Controllable::remove, ref (ctl))); + ctl.GoingAway.connect (registry_connections, boost::bind (&Controllable::remove, ref (ctl))); } void diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index dbec03b396..d94c58d54f 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -24,7 +24,7 @@ v it under the terms of the GNU General Public License as published by #include #include -#include +#include "pbd/signals.h" #include #include "pbd/statefuldestructible.h" @@ -44,16 +44,16 @@ class Controllable : public PBD::StatefulDestructible { virtual void set_value (float) = 0; virtual float get_value (void) const = 0; - boost::signals2::signal LearningFinished; - static boost::signals2::signal CreateBinding; - static boost::signals2::signal DeleteBinding; + PBD::Signal0 LearningFinished; + static PBD::Signal3 CreateBinding; + static PBD::Signal1 DeleteBinding; - static boost::signals2::signal StartLearning; - static boost::signals2::signal StopLearning; + static PBD::Signal1 StartLearning; + static PBD::Signal1 StopLearning; - static boost::signals2::signal Destroyed; + static PBD::Signal1 Destroyed; - boost::signals2::signal Changed; + PBD::Signal0 Changed; int set_state (const XMLNode&, int version); XMLNode& get_state (); diff --git a/libs/pbd/pbd/destructible.h b/libs/pbd/pbd/destructible.h index 241d847aff..8cc0113ff7 100644 --- a/libs/pbd/pbd/destructible.h +++ b/libs/pbd/pbd/destructible.h @@ -20,7 +20,7 @@ #ifndef __pbd_destructible_h__ #define __pbd_destructible_h__ -#include +#include "pbd/signals.h" namespace PBD { @@ -29,7 +29,7 @@ class Destructible { Destructible() : refs_dropped (false){} virtual ~Destructible () {} - boost::signals2::signal GoingAway; + PBD::Signal0 GoingAway; void drop_references () { if (!refs_dropped) { GoingAway(); } refs_dropped = true; } private: diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index c5e8b19272..b87f784334 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -42,7 +42,7 @@ public: : obj(a_object), before(a_before), after(a_after) { /* if the object dies, make sure that we die and that everyone knows about it */ - obj_death_connection = obj.GoingAway.connect (boost::bind (&MementoCommand::object_died, this)); + obj.GoingAway.connect (obj_death_connection, boost::bind (&MementoCommand::object_died, this)); } ~MementoCommand () { @@ -97,7 +97,7 @@ protected: obj_T& obj; XMLNode* before; XMLNode* after; - boost::signals2::scoped_connection obj_death_connection; + PBD::ScopedConnection obj_death_connection; }; #endif // __lib_pbd_memento_h__ diff --git a/libs/pbd/pbd/scoped_connections.h b/libs/pbd/pbd/scoped_connections.h deleted file mode 100644 index bb992e4f78..0000000000 --- a/libs/pbd/pbd/scoped_connections.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2009 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __pbd_scoped_connections_h__ -#define __pbd_scoped_connections_h__ - -#include -#include -#include - -#include "pbd/destructible.h" - -namespace PBD { - -class ScopedConnectionList -{ - public: - ScopedConnectionList(); - ~ScopedConnectionList (); - - void add_connection (const boost::signals2::connection& c); - void drop_connections (); - - template void scoped_connect (S& sig, const typename S::slot_function_type& sf) { - add_connection (sig.connect (sf)); - } - - private: - /* this class is not copyable */ - ScopedConnectionList(const ScopedConnectionList&) {} - - /* this lock is shared by all instances of a ScopedConnectionList. - We do not want one mutex per list, and since we only need the lock - when adding or dropping connections, which are generally occuring - in object creation and UI operations, the contention on this - lock is low and not of significant consequence. Even though - boost::signals2 is thread-safe, this additional list of - scoped connections needs to be protected in 2 cases: - - (1) (unlikely) we make a connection involving a callback on the - same object from 2 threads. (wouldn't that just be appalling - programming style?) - - (2) where we are dropping connections in one thread and adding - one from another. - */ - - static Glib::StaticMutex _lock; - - typedef std::list ConnectionList; - ConnectionList _list; -}; - -} /* namespace */ - -#endif /* __pbd_scoped_connections_h__ */ diff --git a/libs/pbd/pbd/signals.h b/libs/pbd/pbd/signals.h new file mode 100644 index 0000000000..4ddd72eba8 --- /dev/null +++ b/libs/pbd/pbd/signals.h @@ -0,0 +1,171 @@ +/* + Copyright (C) 2009 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __pbd_signals_h__ +#define __pbd_signals_h__ + +#include +#include +#include +#include + +namespace PBD { + +typedef boost::signals2::connection UnscopedConnection; +typedef boost::signals2::connection Connection; +typedef boost::signals2::scoped_connection ScopedConnection; + +class ScopedConnectionList : public boost::noncopyable +{ + public: + ScopedConnectionList(); + ~ScopedConnectionList (); + + void add_connection (const UnscopedConnection& c); + void drop_connections (); + + template void scoped_connect (S& sig, const typename S::slot_function_type& sf) { + add_connection (sig.connect (sf)); + } + + private: + /* this class is not copyable */ + ScopedConnectionList(const ScopedConnectionList&) {} + + /* this lock is shared by all instances of a ScopedConnectionList. + We do not want one mutex per list, and since we only need the lock + when adding or dropping connections, which are generally occuring + in object creation and UI operations, the contention on this + lock is low and not of significant consequence. Even though + boost::signals2 is thread-safe, this additional list of + scoped connections needs to be protected in 2 cases: + + (1) (unlikely) we make a connection involving a callback on the + same object from 2 threads. (wouldn't that just be appalling + programming style?) + + (2) where we are dropping connections in one thread and adding + one from another. + */ + + static Glib::StaticMutex _lock; + + typedef std::list ConnectionList; + ConnectionList _list; +}; + +template +class Signal0 { +public: + Signal0 () {} + typedef boost::signals2::signal SignalType; + + void connect (ScopedConnectionList& clist, + const typename SignalType::slot_function_type& slot) { + clist.add_connection (_signal.connect (slot)); + } + + void connect (Connection& c, + const typename SignalType::slot_function_type& slot) { + c = _signal.connect (slot); + } + + typename SignalType::result_type operator()() { + return _signal (); + } + +private: + SignalType _signal; +}; + +template +class Signal1 { +public: + Signal1 () {} + typedef boost::signals2::signal SignalType; + + void connect (ScopedConnectionList& clist, + const typename SignalType::slot_function_type& slot) { + clist.add_connection (_signal.connect (slot)); + } + + void connect (Connection& c, + const typename SignalType::slot_function_type& slot) { + c = _signal.connect (slot); + } + + typename SignalType::result_type operator()(A arg1) { + return _signal (arg1); + } + +private: + SignalType _signal; +}; + +template +class Signal2 { +public: + Signal2 () {} + typedef boost::signals2::signal SignalType; + + void connect (ScopedConnectionList& clist, + const typename SignalType::slot_function_type& slot) { + clist.add_connection (_signal.connect (slot)); + } + + void connect (Connection& c, + const typename SignalType::slot_function_type& slot) { + c = _signal.connect (slot); + } + + typename SignalType::result_type operator()(A1 arg1, A2 arg2) { + return _signal (arg1, arg2); + } + +private: + SignalType _signal; +}; + +template +class Signal3 { +public: + Signal3 () {} + typedef boost::signals2::signal SignalType; + + void connect (ScopedConnectionList& clist, + const typename SignalType::slot_function_type& slot) { + clist.add_connection (_signal.connect (slot)); + } + + void connect (Connection& c, + const typename SignalType::slot_function_type& slot) { + c = _signal.connect (slot); + } + + typename SignalType::result_type operator()(A1 arg1, A2 arg2, A3 arg3) { + return _signal (arg1, arg2, arg3); + } + +private: + SignalType _signal; +}; + +} /* namespace */ + +#endif /* __pbd_signals_h__ */ diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 6340ef04b9..bb910252c3 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -27,7 +27,7 @@ #include #include -#include "pbd/scoped_connections.h" +#include "pbd/signals.h" #include "pbd/command.h" typedef sigc::slot UndoAction; @@ -106,7 +106,7 @@ class UndoHistory : public PBD::ScopedConnectionList void set_depth (uint32_t); - boost::signals2::signal Changed; + PBD::Signal0 Changed; private: bool _clearing; diff --git a/libs/pbd/scoped_connections.cc b/libs/pbd/scoped_connections.cc deleted file mode 100644 index 68788737e3..0000000000 --- a/libs/pbd/scoped_connections.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2009 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "pbd/scoped_connections.h" - -using namespace PBD; - -Glib::StaticMutex ScopedConnectionList::_lock = GLIBMM_STATIC_MUTEX_INIT; - -ScopedConnectionList::ScopedConnectionList() -{ -} - -ScopedConnectionList::~ScopedConnectionList() -{ - drop_connections (); -} - -void -ScopedConnectionList::add_connection (const boost::signals2::connection& c) -{ - Glib::Mutex::Lock lm (_lock); - _list.push_back (new boost::signals2::scoped_connection (c)); -} - -void -ScopedConnectionList::drop_connections () -{ - Glib::Mutex::Lock lm (_lock); - - for (ConnectionList::iterator i = _list.begin(); i != _list.end(); ++i) { - delete *i; - } - - _list.clear (); -} - diff --git a/libs/pbd/signals.cc b/libs/pbd/signals.cc new file mode 100644 index 0000000000..62cabff091 --- /dev/null +++ b/libs/pbd/signals.cc @@ -0,0 +1,53 @@ +/* + Copyright (C) 2009 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "pbd/signals.h" + +using namespace PBD; + +Glib::StaticMutex ScopedConnectionList::_lock = GLIBMM_STATIC_MUTEX_INIT; + +ScopedConnectionList::ScopedConnectionList() +{ +} + +ScopedConnectionList::~ScopedConnectionList() +{ + drop_connections (); +} + +void +ScopedConnectionList::add_connection (const UnscopedConnection& c) +{ + Glib::Mutex::Lock lm (_lock); + _list.push_back (new ScopedConnection (c)); +} + +void +ScopedConnectionList::drop_connections () +{ + Glib::Mutex::Lock lm (_lock); + + for (ConnectionList::iterator i = _list.begin(); i != _list.end(); ++i) { + delete *i; + } + + _list.clear (); +} + diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index 78c16291b7..d3f01d5ada 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -82,7 +82,7 @@ UndoTransaction::add_command (Command *const action) so there is no need to manage this connection. */ - scoped_connect (action->GoingAway, boost::bind (&command_death, this, action)); + action->GoingAway.connect (*this, boost::bind (&command_death, this, action)); actions.push_back (action); } @@ -185,7 +185,7 @@ UndoHistory::add (UndoTransaction* const ut) { uint32_t current_depth = UndoList.size(); - scoped_connect (ut->GoingAway, boost::bind (&UndoHistory::remove, this, ut)); + ut->GoingAway.connect (*this, boost::bind (&UndoHistory::remove, this, ut)); /* if the current undo history is larger than or equal to the currently requested depth, then pop off at least 1 element to make space diff --git a/libs/pbd/wscript b/libs/pbd/wscript index aacbd990ad..d7e456ada7 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -73,9 +73,9 @@ def build(bld): pool.cc pthread_utils.cc receiver.cc - scoped_connections.cc search_path.cc shortpath.cc + signals.cc stacktrace.cc stateful.cc strreplace.cc 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 BasicUI::AccessAction; +PBD::Signal2 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 ControlProtocol::ZoomToSession; -sigc::signal ControlProtocol::ZoomOut; -sigc::signal ControlProtocol::ZoomIn; -sigc::signal ControlProtocol::Enter; -sigc::signal ControlProtocol::ScrollTimeline; +PBD::Signal0 ControlProtocol::ZoomToSession; +PBD::Signal0 ControlProtocol::ZoomOut; +PBD::Signal0 ControlProtocol::ZoomIn; +PBD::Signal0 ControlProtocol::Enter; +PBD::Signal1 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 - +#include "pbd/signals.h" #include @@ -46,7 +46,7 @@ class BasicUI { void loop_toggle (); void access_action ( std::string action_path ); - static sigc::signal AccessAction; + static PBD::Signal2 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 #include #include -#include -#include +#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 ActiveChanged; + PBD::Signal0 ActiveChanged; /* signals that a control protocol can emit and other (presumably graphical) user interfaces can respond to */ - static sigc::signal ZoomToSession; - static sigc::signal ZoomIn; - static sigc::signal ZoomOut; - static sigc::signal Enter; - static sigc::signal ScrollTimeline; + static PBD::Signal0 ZoomToSession; + static PBD::Signal0 ZoomIn; + static PBD::Signal0 ZoomOut; + static PBD::Signal0 Enter; + static PBD::Signal1 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 -#include - #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 #include -#include +#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 -#include - #include +#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 trk = boost::dynamic_pointer_cast(_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 #include -#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 #include +#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 control_event; + PBD::Signal3 control_event; // emitted just before the port goes into initialisation // where it tries to establish that its device is connected - boost::signals2::signal init_event; + PBD::Signal0 init_event; // emitted when the port completes initialisation successfully - boost::signals2::signal active_event; + PBD::Signal0 active_event; // emitted when the port goes inactive (ie a read or write failed) - boost::signals2::signal inactive_event; + PBD::Signal0 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, lo_address addr) */ if (!route_exists) { - scoped_connect (route->GoingAway, (boost::bind (&OSC::drop_route, this, boost::weak_ptr (route)))); + route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr (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 #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 +class OSC : public ARDOUR::ControlProtocol, public AbstractUI { 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 controllable; + PBD::ScopedConnection changed_connection; lo_address addr; std::string path; -- cgit v1.2.3