diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-17 18:24:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-17 18:24:23 +0000 |
commit | f6fdd8dcbf41f864e9f0cc32dabe81fe3533ddfe (patch) | |
tree | 5214c580b9e6c17a499fa587660dbf949e892bf2 /libs | |
parent | da762129f19c28aff64f833b6ec09fba946faef6 (diff) |
switch to using boost::signals2 instead of sigc++, at least for libardour. not finished yet, but compiles, loads sessions, records and can close a session without a crash
git-svn-id: svn://localhost/ardour2/branches/3.0@6372 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
177 files changed, 1169 insertions, 1155 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index a1b3d06f62..1333b58d6f 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -26,6 +26,8 @@ #include <limits.h> #include <signal.h> +#include <boost/signals2.hpp> + #include "pbd/error.h" #include "pbd/failed_constructor.h" #include "pbd/locale_guard.h" @@ -44,7 +46,7 @@ namespace ARDOUR { class AudioEngine; static const nframes_t max_frames = JACK_MAX_FRAMES; - extern sigc::signal<void,std::string> BootMessage; + extern boost::signals2::signal<void(std::string)> BootMessage; int init (bool with_vst, bool try_optimization); void init_post_engine (); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 838c9406ee..4d2209d79b 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -19,7 +19,6 @@ #ifndef __ardour_audio_diskstream_h__ #define __ardour_audio_diskstream_h__ -#include <sigc++/signal.h> #include <cmath> #include <string> diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index a9c414e566..ac367ddd64 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -26,17 +26,19 @@ #include <exception> #include <string> -#include <sigc++/signal.h> #include <glibmm/thread.h> #include "pbd/rcu.h" +#include "pbd/scoped_connections.h" #include "ardour/ardour.h" #include <jack/jack.h> #include <jack/transport.h> -#include "ardour/types.h" + #include "ardour/data_type.h" +#include "ardour/session_handle.h" +#include "ardour/types.h" namespace ARDOUR { @@ -45,7 +47,7 @@ class MidiPort; class Port; class Session; -class AudioEngine : public sigc::trackable +class AudioEngine : public SessionHandlePtr { public: typedef std::set<Port*> Ports; @@ -110,7 +112,7 @@ class AudioEngine : public sigc::trackable } void set_session (Session *); - void remove_session (); + void remove_session (); // not a replacement for SessionHandle::session_going_away() class PortRegistrationFailure : public std::exception { public: @@ -185,32 +187,32 @@ class AudioEngine : public sigc::trackable _ the regular process() call to session->process() is not made. */ - sigc::signal<int,nframes_t> Freewheel; + boost::signals2::signal<int(nframes_t)> Freewheel; - sigc::signal<void> Xrun; + boost::signals2::signal<void()> Xrun; /* this signal is if JACK notifies us of a graph order event */ - sigc::signal<void> GraphReordered; + boost::signals2::signal<void()> GraphReordered; /* this signal is emitted if the sample rate changes */ - sigc::signal<void,nframes_t> SampleRateChanged; + boost::signals2::signal<void(nframes_t)> SampleRateChanged; /* this signal is sent if JACK ever disconnects us */ - sigc::signal<void> Halted; + boost::signals2::signal<void()> Halted; /* these two are emitted when the engine itself is started and stopped */ - sigc::signal<void> Running; - sigc::signal<void> Stopped; + boost::signals2::signal<void()> Running; + boost::signals2::signal<void()> Stopped; /* this signal is emitted if a JACK port is registered or unregistered */ - sigc::signal<void> PortRegisteredOrUnregistered; + boost::signals2::signal<void()> PortRegisteredOrUnregistered; std::string make_port_name_relative (std::string); std::string make_port_name_non_relative (std::string); @@ -221,7 +223,6 @@ _ the regular process() call to session->process() is not made. private: static AudioEngine* _instance; - ARDOUR::Session* session; jack_client_t* volatile _jack; /* could be reset to null by SIGPIPE or another thread */ std::string jack_client_name; Glib::Mutex _process_lock; @@ -241,7 +242,7 @@ _ the regular process() call to session->process() is not made. bool _freewheeling; bool _freewheel_pending; bool _freewheel_thread_registered; - sigc::slot<int,nframes_t> freewheel_action; + boost::function<int(nframes_t)> freewheel_action; bool reconnect_on_halt; int _usecs_per_cycle; diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 6c04ebffb1..3312bc889d 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 sigc::signal<void> HeaderPositionOffsetChanged; + static boost::signals2::signal<void()> 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 277fe5a8e1..927ccfbe11 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -52,9 +52,9 @@ class AudioPlaylist : public ARDOUR::Playlist int set_state (const XMLNode&, int version); - sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade; - - void foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> >); + boost::signals2::signal<void(boost::shared_ptr<Crossfade>)> NewCrossfade; + + void foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)>); void crossfades_at (nframes_t frame, Crossfades&); bool destroy_region (boost::shared_ptr<Region>); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 328a23ac19..dfa103f2e3 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -27,8 +27,7 @@ #include <glibmm/thread.h> #include <glibmm/ustring.h> - -#include <sigc++/signal.h> +#include <boost/function.hpp> #include "ardour/source.h" #include "ardour/ardour.h" @@ -73,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 (sigc::slot<void>, sigc::connection&) const; + bool peaks_ready (boost::function<void()> callWhenReady, boost::signals2::connection& connection_established_if_not_ready) const; - mutable sigc::signal<void> PeaksReady; - mutable sigc::signal<void,nframes_t,nframes_t> PeakRangeReady; + mutable boost::signals2::signal<void()> PeaksReady; + mutable boost::signals2::signal<void(nframes_t,nframes_t)> 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 69c8e38c95..c75abda0b7 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -24,7 +24,6 @@ #include <list> #include <cmath> -#include <sigc++/signal.h> #include <glibmm/thread.h> #include "pbd/undo.h" @@ -57,11 +56,11 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL void set_automation_state (AutoState); AutoState automation_state() const { return _state; } - sigc::signal<void> automation_state_changed; + boost::signals2::signal<void()> automation_state_changed; void set_automation_style (AutoStyle m); AutoStyle automation_style() const { return _style; } - sigc::signal<void> automation_style_changed; + boost::signals2::signal<void()> automation_style_changed; bool automation_playback() const { return (_state & Play) || ((_state & Touch) && !_touching); @@ -70,10 +69,10 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL return (_state & Write) || ((_state & Touch) && _touching); } - sigc::signal<void> StateChanged; + boost::signals2::signal<void()> StateChanged; - static sigc::signal<void, AutomationList*> AutomationListCreated; - mutable sigc::signal<void> Dirty; + static boost::signals2::signal<void(AutomationList*)> AutomationListCreated; + mutable boost::signals2::signal<void()> Dirty; void start_touch (); void stop_touch (); diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 196b1f2a09..662c3799a5 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -23,8 +23,10 @@ #include <string> #include <vector> #include <glibmm/thread.h> -#include <sigc++/signal.h> #include <boost/shared_ptr.hpp> + +#include "pbd/scoped_connections.h" + #include "ardour/data_type.h" namespace ARDOUR { @@ -37,7 +39,7 @@ class AudioEngine; * `Channel' is a rather overloaded term but I can't think of a better * one right now. */ -class Bundle : public sigc::trackable +class Bundle : public PBD::ScopedConnectionList { public: @@ -118,7 +120,7 @@ class Bundle : public sigc::trackable DirectionChanged = 0x10 ///< the direction (whether ports are inputs or outputs) has changed }; - sigc::signal<void, Change> Changed; + boost::signals2::signal<void(Change)> Changed; protected: diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h index b88b820736..60697517fb 100644 --- a/libs/ardour/ardour/butler.h +++ b/libs/ardour/ardour/butler.h @@ -21,17 +21,18 @@ #define __ardour_butler_h__ #include <glibmm/thread.h> + #include "ardour/types.h" +#include "ardour/session_handle.h" namespace ARDOUR { -class Session; - -class Butler { -public: - Butler(Session* session); +class Butler : public SessionHandleRef +{ + public: + Butler (Session& session); ~Butler(); - + int start_thread(); void terminate_thread(); void schedule_transport_work(); @@ -58,7 +59,6 @@ public: }; }; - Session* session; pthread_t thread; Glib::Mutex request_lock; Glib::Cond paused; diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 02bbcaca23..1c82309d87 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -19,7 +19,9 @@ #ifndef __ardour_configuration_h__ #define __ardour_configuration_h__ + #include <boost/function.hpp> +#include <boost/signals2.hpp> #include "pbd/stateful.h" #include "ardour/configuration_variable.h" @@ -39,7 +41,7 @@ class Configuration : public PBD::Stateful virtual XMLNode & get_variables () = 0; virtual void set_variables (XMLNode const &) = 0; - sigc::signal<void, std::string> ParameterChanged; + boost::signals2::signal<void(std::string)> ParameterChanged; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index d2b1796b18..6fedc95c6c 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -23,11 +23,11 @@ #include <string> #include <list> -#include <sigc++/sigc++.h> #include <glibmm/thread.h> #include "pbd/stateful.h" +#include "ardour/session_handle.h" namespace ARDOUR { @@ -49,16 +49,16 @@ struct ControlProtocolInfo { ~ControlProtocolInfo() { if (state) { delete state; } } }; - class ControlProtocolManager : public sigc::trackable, public PBD::Stateful +class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr { public: ~ControlProtocolManager (); static ControlProtocolManager& instance(); - void set_session (Session&); + void set_session (Session*); void discover_control_protocols (); - void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>); + void foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)>); void load_mandatory_protocols (); ControlProtocol* instantiate (ControlProtocolInfo&); @@ -77,11 +77,10 @@ struct ControlProtocolInfo { ControlProtocolManager (); static ControlProtocolManager* _instance; - Session* _session; Glib::Mutex protocols_lock; std::list<ControlProtocol*> control_protocols; - void drop_session (); + void session_going_away (); int control_protocol_discover (std::string path); ControlProtocolDescriptor* get_descriptor (std::string path); diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 5d8e0235fb..1a492b742b 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -24,7 +24,6 @@ #include <algorithm> #include <boost/shared_ptr.hpp> -#include <sigc++/signal.h> #include "pbd/undo.h" #include "pbd/statefuldestructible.h" @@ -106,8 +105,8 @@ class Crossfade : public ARDOUR::AudioRegion nframes_t overlap_length() const; - sigc::signal<void,boost::shared_ptr<Region> > Invalidated; - sigc::signal<void,Change> StateChanged; + boost::signals2::signal<void(boost::shared_ptr<Region>)> Invalidated; + boost::signals2::signal<void(Change)> 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 1b1a217466..7a5931c5fb 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -20,6 +20,7 @@ #define __ardour_delivery_h__ #include <string> + #include "ardour/types.h" #include "ardour/chan_count.h" #include "ardour/io_processor.h" @@ -31,7 +32,8 @@ class IO; class MuteMaster; class Panner; -class Delivery : public IOProcessor { +class Delivery : public IOProcessor +{ public: enum Role { /* main outputs - delivers out-of-place to port buffers, and cannot be removed */ @@ -83,9 +85,9 @@ public: BufferSet& output_buffers() { return *_output_buffers; } - sigc::signal<void> MuteChange; + boost::signals2::signal<void()> MuteChange; - static sigc::signal<void,nframes_t> CycleStart; + static boost::signals2::signal<void(nframes_t)> CycleStart; XMLNode& state (bool full); int set_state (const XMLNode&, int version); @@ -118,10 +120,10 @@ public: boost::shared_ptr<Panner> _panner; static bool panners_legal; - static sigc::signal<int> PannersLegal; + static boost::signals2::signal<int()> PannersLegal; int panners_became_legal (); - sigc::connection panner_legal_c; + boost::signals2::scoped_connection 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 87fffb92f7..a9664daa32 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -27,8 +27,6 @@ #include <cmath> #include <time.h> -#include <sigc++/signal.h> - #include <boost/utility.hpp> #include "evoral/types.hpp" @@ -145,15 +143,15 @@ class Diskstream : public SessionObject, public boost::noncopyable void move_processor_automation (boost::weak_ptr<Processor>, std::list< Evoral::RangeMove<nframes_t> > const &); - sigc::signal<void> RecordEnableChanged; - sigc::signal<void> SpeedChanged; - sigc::signal<void> ReverseChanged; - sigc::signal<void> PlaylistChanged; - sigc::signal<void> AlignmentStyleChanged; - sigc::signal<void,Location *> LoopSet; + boost::signals2::signal<void()> RecordEnableChanged; + boost::signals2::signal<void()> SpeedChanged; + boost::signals2::signal<void()> ReverseChanged; + boost::signals2::signal<void()> PlaylistChanged; + boost::signals2::signal<void()> AlignmentStyleChanged; + boost::signals2::signal<void(Location *)> LoopSet; - static sigc::signal<void> DiskOverrun; - static sigc::signal<void> DiskUnderrun; + static boost::signals2::signal<void()> DiskOverrun; + static boost::signals2::signal<void()> DiskUnderrun; protected: friend class Session; @@ -306,11 +304,9 @@ class Diskstream : public SessionObject, public boost::noncopyable nframes_t scrub_buffer_size; nframes_t scrub_offset; - sigc::connection ports_created_c; - sigc::connection plmod_connection; - sigc::connection plgone_connection; - sigc::connection plregion_connection; - sigc::connection ic_connection; + PBD::ScopedConnectionList playlist_connections; + + boost::signals2::scoped_connection ic_connection; Flag _flags; diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index a203c5d37b..d728a4b989 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -24,8 +24,7 @@ #include <string> #include <utility> -#include <sigc++/signal.h> - +#include <boost/signals2.hpp> #include "ardour/types.h" class XMLTree; @@ -73,10 +72,10 @@ class ElementImporter bool broken () { return _broken; } /// Signal that requests for anew name - static sigc::signal <std::pair<bool, std::string>, std::string, std::string> Rename; + static boost::signals2::signal <std::pair<bool, std::string> (std::string, std::string)> Rename; /// Signal for ok/cancel prompting - static sigc::signal <bool, std::string> Prompt; + static boost::signals2::signal <bool(std::string)> Prompt; protected: diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index 78a0e9abb0..055168118d 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -24,7 +24,6 @@ #include <vector> #include <string> -#include <sigc++/signal.h> #include <sndfile.h> #include <samplerate.h> @@ -39,7 +38,7 @@ namespace ARDOUR typedef std::pair<Port *, uint32_t> PortChannelPair; typedef std::map<uint32_t, std::vector<PortChannelPair> > ExportPortMap; - struct ExportSpecification : public SF_INFO, public sigc::trackable { + struct ExportSpecification : public SF_INFO, public PBD::ScopedConnectionList { ExportSpecification(); ~ExportSpecification (); @@ -85,7 +84,7 @@ namespace ARDOUR SRC_STATE* src_state; nframes_t pos; - sigc::connection freewheel_connection; + boost::signals2::scoped_connection 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 fdb466a06e..4a2f74b775 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -21,13 +21,13 @@ #ifndef __ardour_export_channel_h__ #define __ardour_export_channel_h__ -#include "ardour/audioregion.h" -#include "ardour/buffer_set.h" - #include <set> +#include <boost/signals2.hpp> #include <boost/shared_ptr.hpp> -#include <sigc++/signal.h> + +#include "ardour/audioregion.h" +#include "ardour/buffer_set.h" namespace ARDOUR { @@ -89,7 +89,7 @@ class PortExportChannel : public ExportChannel }; /// Handles RegionExportChannels and does actual reading from region -class RegionExportChannelFactory : public sigc::trackable +class RegionExportChannelFactory { public: enum Type { @@ -106,7 +106,7 @@ class RegionExportChannelFactory : public sigc::trackable private: - int new_cycle_started () { buffers_up_to_date = false; return 0; } + int new_cycle_started (nframes_t) { buffers_up_to_date = false; return 0; } void update_buffers (nframes_t frames); AudioRegion const & region; @@ -122,6 +122,8 @@ class RegionExportChannelFactory : public sigc::trackable Sample * mixdown_buffer; Sample * gain_buffer; + + boost::signals2::scoped_connection 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 8ef9bba6dc..b8d7fa6bf1 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -24,7 +24,6 @@ #include <list> #include <glibmm/ustring.h> -#include <sigc++/signal.h> #include "ardour/export_channel.h" #include "ardour/export_status.h" @@ -96,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<ExportProcessor> new_processor); - sigc::signal<void> FilesWritten; + boost::signals2::signal<void()> 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 7bc0125004..ceb11a2cc9 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 () {} - sigc::signal<void, bool> SelectChanged; - sigc::signal<void, bool> CompatibleChanged; + boost::signals2::signal<void(bool)> SelectChanged; + boost::signals2::signal<void(bool)> 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 705b9dcf17..52463350fe 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -26,8 +26,8 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -#include <sigc++/signal.h> -#include <sigc++/trackable.h> + +#include "pbd/scoped_connections.h" #include "ardour/export_formats.h" @@ -39,7 +39,7 @@ class ExportFormatCompatibility; class ExportFormatSpecification; class AnyTime; -class ExportFormatManager : public sigc::trackable +class ExportFormatManager : public PBD::ScopedConnectionList { public: @@ -92,7 +92,7 @@ class ExportFormatManager : public sigc::trackable /* Signals */ - sigc::signal<void, bool> CompleteChanged; + boost::signals2::signal<void(bool)> CompleteChanged; /* Access to lists */ diff --git a/libs/ardour/ardour/export_formats.h b/libs/ardour/ardour/export_formats.h index 3312e9abd6..3ef207097b 100644 --- a/libs/ardour/ardour/export_formats.h +++ b/libs/ardour/ardour/export_formats.h @@ -21,12 +21,14 @@ #ifndef __ardour_export_formats_h__ #define __ardour_export_formats_h__ -#include "ardour/export_format_base.h" -#include "ardour/export_format_compatibility.h" - #include <list> #include <boost/weak_ptr.hpp> + #include "pbd/failed_constructor.h" +#include "pbd/scoped_connections.h" + +#include "ardour/export_format_base.h" +#include "ardour/export_format_compatibility.h" namespace ARDOUR { @@ -84,7 +86,7 @@ class ExportFormat : public ExportFormatBase, public ExportFormatBase::Selectabl }; /// Class to be inherited by export formats that have a selectable sample format -class HasSampleFormat { +class HasSampleFormat : public PBD::ScopedConnectionList { public: class SampleFormatState : public ExportFormatBase::SelectableCompatible { @@ -126,11 +128,11 @@ class HasSampleFormat { /* Proxies for signals from sample formats and dither types */ - sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatSelectChanged; - sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatCompatibleChanged; + boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatSelectChanged; + boost::signals2::signal<void(bool, WeakSampleFormatPtr)> SampleFormatCompatibleChanged; - sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeSelectChanged; - sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeCompatibleChanged; + boost::signals2::signal<void(bool, WeakDitherTypePtr)> DitherTypeSelectChanged; + boost::signals2::signal<void(bool, WeakDitherTypePtr)> 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 fad21ac780..ded6ed5b02 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -68,7 +68,7 @@ class ExportElementFactory Session & session; }; -class ExportHandler : public ExportElementFactory, public sigc::trackable +class ExportHandler : public ExportElementFactory { private: @@ -118,8 +118,10 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable bool realtime; - sigc::connection files_written_connection; + boost::signals2::scoped_connection files_written_connection; + boost::signals2::scoped_connection export_read_finished_connection; std::list<Glib::ustring> files_written; + void add_file (const Glib::ustring&); /* CD Marker stuff */ @@ -175,7 +177,7 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable TimespanPtr current_timespan; ConfigMap::iterator current_map_it; TimespanBounds timespan_bounds; - sigc::connection channel_config_connection; + boost::signals2::scoped_connection channel_config_connection; }; diff --git a/libs/ardour/ardour/export_multiplication.h b/libs/ardour/ardour/export_multiplication.h index 4826a35668..aace72cc42 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); - sigc::signal<void, bool> SelectChanged; + boost::signals2::signal<void(bool)> SelectChanged; protected: @@ -151,7 +151,7 @@ void split_node (GraphNode * node, float position); void remove_node (GraphNode * node); - sigc::signal<void> GraphChanged; + boost::signals2::signal<void()> GraphChanged; private: diff --git a/libs/ardour/ardour/export_processor.h b/libs/ardour/ardour/export_processor.h index c2cb5034c7..8e7918d7c5 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 sigc::signal<void, Glib::ustring> WritingFile; + static boost::signals2::signal<void(const Glib::ustring&)> WritingFile; private: diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 47acacd387..30bb3c5b91 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -28,7 +28,6 @@ #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> -#include <sigc++/signal.h> #include <glibmm/ustring.h> #include "pbd/uuid.h" @@ -207,7 +206,7 @@ class ExportProfileManager void remove_format_profile (FormatPtr format); FormatPtr get_new_format (FormatPtr original); - sigc::signal<void> FormatListChanged; + boost::signals2::signal<void()> FormatListChanged; private: diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 3322ca639c..9fd3c84ecc 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -22,9 +22,9 @@ #define __ardour_export_status_h__ #include <list> +#include <boost/signals2.hpp> #include <stdint.h> -#include <sigc++/signal.h> namespace ARDOUR { @@ -36,7 +36,7 @@ enum ExportStage { export_Write }; -struct ExportStatus : public sigc::trackable { +struct ExportStatus { ExportStatus (); void init (); @@ -46,12 +46,12 @@ struct ExportStatus : public sigc::trackable { volatile bool stop; volatile bool running; - sigc::signal<void> Aborting; + boost::signals2::signal<void()> Aborting; void abort (bool error_occurred = false); bool aborted () const { return _aborted; } bool errors () const { return _errors; } - sigc::signal<void> Finished; + boost::signals2::signal<void()> 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 255d1e377d..461caf6dd8 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -36,7 +36,7 @@ namespace ARDOUR class ExportChannel; class ExportTempFile; -class ExportTimespan : public sigc::trackable +class ExportTimespan { private: typedef boost::shared_ptr<ExportTempFile> TempFilePtr; @@ -69,7 +69,7 @@ class ExportTimespan : public sigc::trackable /// Reads data from each channel and writes to tempfile int process (nframes_t frames); - sigc::connection process_connection; + boost::signals2::scoped_connection 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/import_status.h b/libs/ardour/ardour/import_status.h index 25a14f3fae..e6207c6ee8 100644 --- a/libs/ardour/ardour/import_status.h +++ b/libs/ardour/ardour/import_status.h @@ -24,7 +24,6 @@ #include <vector> #include <stdint.h> -#include <sigc++/signal.h> #include "ardour/types.h" diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 205559fe4e..498c9f3605 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -20,7 +20,6 @@ #ifndef __ardour_internal_return_h__ #define __ardour_internal_return_h__ -#include <sigc++/signal.h> #include "ardour/ardour.h" #include "ardour/return.h" @@ -48,7 +47,7 @@ class InternalReturn : public Return BufferSet* get_buffers(); void release_buffers(); - static sigc::signal<void,nframes_t> CycleStart; + static boost::signals2::signal<void(nframes_t)> CycleStart; private: BufferSet buffers; diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 12279b166e..7573efd685 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<Route> _send_to; PBD::ID _send_to_id; - sigc::connection connect_c; + boost::signals2::scoped_connection 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 da0b88e5fe..eeb7ed64f0 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -23,7 +23,6 @@ #include <string> #include <vector> #include <cmath> -#include <sigc++/signal.h> #include <jack/jack.h> #include <glibmm/thread.h> @@ -133,7 +132,7 @@ class IO : public SessionObject, public Latent const ChanCount& n_ports () const { return _ports.count(); } - sigc::signal<void,IOChange,void*> changed; + boost::signals2::signal<void(IOChange,void*)> changed; virtual XMLNode& state (bool full); XMLNode& get_state (void); @@ -145,7 +144,7 @@ class IO : public SessionObject, public Latent static int disable_ports (void); static int enable_ports (void); - static sigc::signal<void,ChanCount> PortCountChanged; // emitted when the number of ports changes + static boost::signals2::signal<void(ChanCount)> 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&); @@ -153,7 +152,7 @@ class IO : public SessionObject, public Latent /* we have to defer/order port connection. this is how we do it. */ - static sigc::signal<int> ConnectingLegal; + static boost::signals2::signal<int()> ConnectingLegal; static bool connecting_legal; XMLNode *pending_state_node; @@ -180,20 +179,18 @@ class IO : public SessionObject, public Latent bool _active; private: - int connecting_became_legal (); - sigc::connection connection_legal_c; + boost::signals2::scoped_connection connection_legal_c; boost::shared_ptr<Bundle> _bundle; ///< a bundle representing our ports struct UserBundleInfo { - UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b); - - boost::shared_ptr<UserBundle> bundle; - sigc::connection changed; + UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b); + boost::shared_ptr<UserBundle> bundle; + boost::signals2::scoped_connection changed; }; - - std::vector<UserBundleInfo> _bundles_connected; ///< user bundles connected to our ports + + std::vector<UserBundleInfo*> _bundles_connected; ///< user bundles connected to our ports static int parse_io_string (const std::string&, std::vector<std::string>& chns); static int parse_gain_string (const std::string&, std::vector<std::string>& chns); @@ -201,7 +198,7 @@ class IO : public SessionObject, public Latent int ensure_ports (ChanCount, bool clear, bool lockit, void *src); void check_bundles_connected (); - void check_bundles (std::vector<UserBundleInfo>&, const PortSet&); + void check_bundles (std::vector<UserBundleInfo*>&, const PortSet&); void bundle_changed (Bundle::Change); diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index 0d564bb00c..e4a42a80e2 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -22,7 +22,6 @@ #include <string> #include <boost/shared_ptr.hpp> -#include <sigc++/signal.h> #include <glibmm/thread.h> @@ -68,8 +67,8 @@ class IOProcessor : public Processor virtual bool feeds (boost::shared_ptr<Route> other) const; - sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged; - sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged; + boost::signals2::signal<void(IOProcessor*,bool)> AutomationPlaybackChanged; + boost::signals2::signal<void(IOProcessor*,uint32_t)> AutomationChanged; XMLNode& state (bool full_state); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/jack_port.h b/libs/ardour/ardour/jack_port.h index 3101ce9523..0bb0752d55 100644 --- a/libs/ardour/ardour/jack_port.h +++ b/libs/ardour/ardour/jack_port.h @@ -20,7 +20,6 @@ #ifndef __ardour_jack_port_h__ #define __ardour_jack_port_h__ -#include <sigc++/signal.h> #include "pbd/failed_constructor.h" #include "ardour/port.h" #include <jack/jack.h> diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 656c13afae..00f00c99b6 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -25,7 +25,6 @@ #include <string> #include <dlfcn.h> -#include <sigc++/signal.h> #include "pbd/stateful.h" diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 149a559d85..b50a645a93 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -26,7 +26,6 @@ #include <map> #include <sys/types.h> -#include <sigc++/signal.h> #include <glibmm/thread.h> @@ -109,15 +108,15 @@ class Location : public PBD::StatefulDestructible bool is_range_marker() const { return _flags & IsRangeMarker; } bool matches (Flags f) const { return _flags & f; } - sigc::signal<void,Location*> name_changed; - sigc::signal<void,Location*> end_changed; - sigc::signal<void,Location*> start_changed; + boost::signals2::signal<void(Location*)> name_changed; + boost::signals2::signal<void(Location*)> end_changed; + boost::signals2::signal<void(Location*)> start_changed; - sigc::signal<void,Location*,void*> FlagsChanged; + boost::signals2::signal<void(Location*,void*)> FlagsChanged; /* this is sent only when both start&end change at the same time */ - sigc::signal<void,Location*> changed; + boost::signals2::signal<void(Location*)> changed; /* CD Track / CD-Text info */ @@ -176,11 +175,11 @@ class Locations : public PBD::StatefulDestructible void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags); - sigc::signal<void,Location*> current_changed; - sigc::signal<void> changed; - sigc::signal<void,Location*> added; - sigc::signal<void,Location*> removed; - sigc::signal<void,Change> StateChanged; + boost::signals2::signal<void(Location*)> current_changed; + boost::signals2::signal<void()> changed; + boost::signals2::signal<void(Location*)> added; + boost::signals2::signal<void(Location*)> removed; + boost::signals2::signal<void(Change)> StateChanged; template<class T> void apply (T& obj, void (T::*method)(LocationList&)) { Glib::Mutex::Lock lm (lock); diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 9705459ee1..157d9144b8 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -26,7 +26,6 @@ #include <string> #include <dlfcn.h> -#include <sigc++/signal.h> #include "pbd/stateful.h" diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index ae0a1672db..1f5e3307d6 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -20,7 +20,6 @@ #define __ardour_meter_h__ #include <vector> -#include <sigc++/slot.h> #include "ardour/types.h" #include "ardour/processor.h" #include "pbd/fastlog.h" @@ -34,10 +33,10 @@ class Session; class Metering { public: static void update_meters (); - static sigc::signal<void> Meter; + static boost::signals2::signal<void()> Meter; - static sigc::connection connect (sigc::slot<void> the_slot); - static void disconnect (sigc::connection& c); + static boost::signals2::connection connect (boost::function<void()>); + static void disconnect (boost::signals2::connection& c); private: /* this object is not meant to be instantiated */ diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 930d37330a..72667ca662 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -21,7 +21,6 @@ #ifndef __ardour_midi_diskstream_h__ #define __ardour_midi_diskstream_h__ -#include <sigc++/signal.h> #include <cmath> #include <cassert> diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index b099f575a1..9961b51528 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; } - sigc::signal<void> ContentsChanged; + boost::signals2::signal<void()> 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 a48c9ddfe7..8c4ff43d5c 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -22,6 +22,8 @@ #define MIDI_PATCH_MANAGER_H_ #include "midi++/midnam_patch.h" +#include "pbd/scoped_connections.h" +#include "ardour/session_handle.h" namespace ARDOUR { class Session; @@ -33,7 +35,7 @@ namespace MIDI namespace Name { -class MidiPatchManager +class MidiPatchManager : public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr { /// Singleton private: @@ -55,7 +57,7 @@ public: return *_manager; } - void set_session (ARDOUR::Session&); + void set_session (ARDOUR::Session*); boost::shared_ptr<MIDINameDocument> document_by_model(std::string model_name) { return _documents[model_name]; } @@ -76,7 +78,6 @@ public: } } - boost::shared_ptr<Patch> find_patch( std::string model, std::string custom_device_mode, @@ -133,10 +134,9 @@ public: const MasterDeviceNames::Models& all_models() const { return _all_models; } private: - void drop_session(); + void session_going_away(); void refresh(); - ARDOUR::Session* _session; MidiNameDocuments _documents; MIDINameDocument::MasterDeviceNamesList _master_devices_by_model; MasterDeviceNames::Models _all_models; @@ -145,4 +145,5 @@ private: } // namespace Name } // namespace MIDI + #endif /* MIDI_PATCH_MANAGER_H_ */ diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index dfbd5ea6a2..74448991d9 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -22,7 +22,6 @@ #include <string> #include <time.h> -#include <sigc++/signal.h> #include <glibmm/thread.h> #include "pbd/stateful.h" #include "pbd/xml++.h" @@ -87,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 sigc::signal<void,MidiSource*> MidiSourceCreated; + static boost::signals2::signal<void(MidiSource*)> MidiSourceCreated; // Signal a range of recorded data is available for reading from model() - mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady; + mutable boost::signals2::signal<void(sframes_t,nframes_t)> 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 2daec06774..0ecf1b0589 100644 --- a/libs/ardour/ardour/midi_ui.h +++ b/libs/ardour/ardour/midi_ui.h @@ -2,6 +2,7 @@ #define __libardour_midi_ui_h__ #include <list> +#include <boost/signals2.hpp> #include "pbd/abstract_ui.h" namespace MIDI { @@ -41,7 +42,8 @@ class MidiControlUI : public AbstractUI<MidiUIRequest> typedef std::list<GSource*> PortSources; PortSources port_sources; ARDOUR::Session& _session; - + boost::signals2::scoped_connection rebind_connection; + bool midi_input_handler (Glib::IOCondition, MIDI::Port*); void reset_ports (); void clear_ports (); diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index ef65e69aba..a76775c710 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; - sigc::signal<void> MutePointChanged; + boost::signals2::signal<void()> 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 d41f104e1a..0c930d5b72 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 sigc::signal<void,NamedSelection*> NamedSelectionCreated; + static boost::signals2::signal<void(NamedSelection*)> NamedSelectionCreated; }; }/* namespace ARDOUR */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 7ea37e9974..bf5a04c745 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -25,7 +25,6 @@ #include <vector> #include <string> #include <iostream> -#include <sigc++/signal.h> #include "pbd/stateful.h" #include "pbd/controllable.h" @@ -41,7 +40,7 @@ class Panner; class BufferSet; class AudioBuffer; -class StreamPanner : public sigc::trackable, public PBD::Stateful +class StreamPanner : public PBD::Stateful { public: StreamPanner (Panner& p, Evoral::Parameter param); @@ -82,8 +81,8 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful boost::shared_ptr<AutomationControl> pan_control() { return _control; } - sigc::signal<void> Changed; /* for position */ - sigc::signal<void> StateChanged; /* for mute */ + boost::signals2::signal<void()> Changed; /* for position */ + boost::signals2::signal<void()> StateChanged; /* for mute */ int set_state (const XMLNode&, int version); virtual XMLNode& state (bool full_state) = 0; @@ -271,9 +270,9 @@ public: StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; } uint32_t npanners() const { return _streampanners.size(); } - sigc::signal<void> Changed; - sigc::signal<void> LinkStateChanged; - sigc::signal<void> StateChanged; /* for bypass */ + boost::signals2::signal<void()> Changed; + boost::signals2::signal<void()> LinkStateChanged; + boost::signals2::signal<void()> StateChanged; /* for bypass */ /* only StreamPanner should call these */ diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 3ed32f0984..9c089c2f05 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -32,7 +32,6 @@ #include <glib.h> -#include <sigc++/signal.h> #include "pbd/undo.h" #include "pbd/stateful.h" @@ -51,9 +50,9 @@ namespace ARDOUR { class Session; class Region; -class Playlist : public SessionObject, - public boost::noncopyable, - public boost::enable_shared_from_this<Playlist> { +class Playlist : public SessionObject + , public boost::noncopyable + , public boost::enable_shared_from_this<Playlist> { public: typedef std::list<boost::shared_ptr<Region> > RegionList; @@ -125,19 +124,19 @@ class Playlist : public SessionObject, nframes64_t find_next_transient (nframes64_t position, int dir); - void foreach_region (sigc::slot<void, boost::shared_ptr<Region> >); + void foreach_region (boost::function<void (boost::shared_ptr<Region>)>); XMLNode& get_state (); int set_state (const XMLNode&, int version); XMLNode& get_template (); - sigc::signal<void,bool> InUse; - sigc::signal<void> Modified; - sigc::signal<void, boost::weak_ptr<Region> > RegionAdded; - sigc::signal<void, boost::weak_ptr<Region> > RegionRemoved; - sigc::signal<void> NameChanged; - sigc::signal<void> LengthChanged; - sigc::signal<void, std::list< Evoral::RangeMove<nframes_t> > const &> RangesMoved; + boost::signals2::signal<void(bool)> InUse; + boost::signals2::signal<void()> Modified; + boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionAdded; + boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionRemoved; + boost::signals2::signal<void()> NameChanged; + boost::signals2::signal<void()> LengthChanged; + boost::signals2::signal<void(std::list< Evoral::RangeMove<nframes_t> > const &)> RangesMoved; static std::string bump_name (std::string old_name, Session&); @@ -195,7 +194,7 @@ class Playlist : public SessionObject, RegionList regions; /* the current list of regions in the playlist */ std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */ - std::list<sigc::connection> region_state_changed_connections; + PBD::ScopedConnectionList region_state_changed_connections; DataType _type; mutable gint block_notifications; mutable gint ignore_state_changes; diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h index 02bd68ae7a..4c3680ae8e 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 sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistCreated; + static boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistCreated; static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false); static boost::shared_ptr<Playlist> 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 5a86b6e005..ea8f95d8f5 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -21,7 +21,6 @@ #define __ardour_plugin_h__ #include <boost/shared_ptr.hpp> -#include <sigc++/signal.h> #include <glibmm/ustring.h> #include "pbd/statefuldestructible.h" @@ -144,7 +143,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual bool has_editor() const = 0; - sigc::signal<void,uint32_t,float> ParameterChanged; + boost::signals2::signal<void(uint32_t,float)> 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 593db1ff0d..6be8f1dda6 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -25,7 +25,6 @@ #include <boost/weak_ptr.hpp> -#include <sigc++/signal.h> #include "ardour/ardour.h" #include "ardour/types.h" #include "ardour/processor.h" @@ -107,7 +106,7 @@ class PluginInsert : public Processor void collect_signal_for_analysis(nframes_t nframes); - sigc::signal<void, BufferSet*, BufferSet*> AnalysisDataGathered; + boost::signals2::signal<void(BufferSet*, BufferSet*)> AnalysisDataGathered; private: /* disallow copy construction */ diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 0a056b574a..44c529835e 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 */ - sigc::signal<void> PluginListChanged; + boost::signals2::signal<void()> PluginListChanged; private: struct PluginStatus { diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 2597fa9601..be4df6bd02 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -25,7 +25,8 @@ #include <vector> #include <jack/jack.h> #include <boost/utility.hpp> -#include <sigc++/trackable.h> +#include <boost/signals2.hpp> + #include "ardour/data_type.h" #include "ardour/types.h" @@ -34,7 +35,7 @@ namespace ARDOUR { class AudioEngine; class Buffer; -class Port : public sigc::trackable, public boost::noncopyable +class Port : public boost::noncopyable { public: enum Flags { @@ -117,7 +118,7 @@ public: static void set_engine (AudioEngine *); - sigc::signal<void, bool> MonitorInputChanged; + boost::signals2::signal<void(bool)> MonitorInputChanged; protected: diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 97f930df6e..5e50b4775e 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -24,7 +24,6 @@ #include <string> #include <exception> -#include <sigc++/signal.h> #include "ardour/ardour.h" #include "ardour/io_processor.h" #include "ardour/types.h" diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index c57eb4354c..5962e8f44e 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -26,7 +26,6 @@ #include "pbd/statefuldestructible.h" -#include <sigc++/signal.h> #include "ardour/ardour.h" #include "ardour/automatable_controls.h" @@ -99,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 sigc::signal<void,Processor*> ProcessorCreated; + static boost::signals2::signal<void(Processor*)> ProcessorCreated; - sigc::signal<void> ActiveChanged; - sigc::signal<void,ChanCount,ChanCount> ConfigurationChanged; + boost::signals2::signal<void()> ActiveChanged; + boost::signals2::signal<void(ChanCount,ChanCount)> ConfigurationChanged; protected: int _pending_active; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 7bae98e573..a276fb19ee 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -26,6 +26,7 @@ #include <boost/utility.hpp> #include "pbd/undo.h" +#include "pbd/scoped_connections.h" #include "ardour/ardour.h" #include "ardour/data_type.h" @@ -95,8 +96,8 @@ class Region static Change LayerChanged; static Change HiddenChanged; - sigc::signal<void,Change> StateChanged; - static sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged; + boost::signals2::signal<void(Change)> StateChanged; + static boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> RegionPropertyChanged; void unlock_property_changes () { _flags = Flag (_flags & ~DoNotSendPropertyChanges); } void block_property_changes () { _flags = Flag (_flags | DoNotSendPropertyChanges); } @@ -218,7 +219,7 @@ class Region boost::shared_ptr<ARDOUR::Playlist> playlist() const { return _playlist.lock(); } virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>); - void source_deleted (boost::shared_ptr<Source>); + void source_deleted (boost::weak_ptr<Source>); boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; } uint32_t n_channels() const { return _sources.size(); } diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index e702a2433f..51858e4926 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 sigc::signal<void,boost::shared_ptr<Region> > CheckNewRegion; + static boost::signals2::signal<void(boost::shared_ptr<Region>)> CheckNewRegion; static boost::shared_ptr<Region> create (boost::shared_ptr<const Region>); diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index a3d3859899..f663c109a5 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -21,7 +21,6 @@ #ifndef __ardour_return_h__ #define __ardour_return_h__ -#include <sigc++/signal.h> #include <string> diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 92a3c8c6b8..dd6173e963 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -163,7 +163,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void flush_processors (); - void foreach_processor (sigc::slot<void, boost::weak_ptr<Processor> > method) { + void foreach_processor (boost::function<void(boost::weak_ptr<Processor>)> method) { Glib::RWLock::ReaderLock lm (_processor_lock); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { method (boost::weak_ptr<Processor> (*i)); @@ -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; } - sigc::signal<void> active_changed; - sigc::signal<void> phase_invert_changed; - sigc::signal<void> denormal_protection_changed; - sigc::signal<void,void*> listen_changed; - sigc::signal<void,void*> solo_changed; - sigc::signal<void,void*> solo_safe_changed; - sigc::signal<void,void*> solo_isolated_changed; - sigc::signal<void,void*> comment_changed; - sigc::signal<void,void*> mute_changed; - sigc::signal<void> mute_points_changed; + boost::signals2::signal<void()> active_changed; + boost::signals2::signal<void()> phase_invert_changed; + boost::signals2::signal<void()> denormal_protection_changed; + boost::signals2::signal<void(void*)> listen_changed; + boost::signals2::signal<void(void*)> solo_changed; + boost::signals2::signal<void(void*)> solo_safe_changed; + boost::signals2::signal<void(void*)> solo_isolated_changed; + boost::signals2::signal<void(void*)> comment_changed; + boost::signals2::signal<void(void*)> mute_changed; + boost::signals2::signal<void()> mute_points_changed; /** the processors have changed; the parameter indicates what changed */ - sigc::signal<void, RouteProcessorChange> processors_changed; - sigc::signal<void,void*> record_enable_changed; + boost::signals2::signal<void(RouteProcessorChange)> processors_changed; + boost::signals2::signal<void(void*)> record_enable_changed; /** the metering point has changed */ - sigc::signal<void,void*> meter_change; - sigc::signal<void> signal_latency_changed; - sigc::signal<void> initial_delay_changed; + boost::signals2::signal<void(void*)> meter_change; + boost::signals2::signal<void()> signal_latency_changed; + boost::signals2::signal<void()> initial_delay_changed; /* gui's call this for their own purposes. */ - sigc::signal<void,std::string,void*> gui_changed; + boost::signals2::signal<void(std::string,void*)> 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); - sigc::signal<void,void*> SelectedChanged; + boost::signals2::signal<void(void*)> SelectedChanged; int listen_via (boost::shared_ptr<Route>, Placement p, bool active, bool aux); void drop_listen (boost::shared_ptr<Route>); @@ -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; - sigc::signal<void> RemoteControlIDChanged; + boost::signals2::signal<void()> RemoteControlIDChanged; void sync_order_keys (std::string const &); - static sigc::signal<void, std::string const &> SyncOrderKeys; + static boost::signals2::signal<void(std::string const &)> SyncOrderKeys; protected: friend class Session; @@ -379,8 +379,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void silence (nframes_t nframes); - sigc::connection input_signal_connection; - ChanCount processor_max_streams; uint32_t _remote_control_id; @@ -391,7 +389,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou boost::shared_ptr<Amp> _amp; boost::shared_ptr<PeakMeter> _meter; - sigc::connection _meter_connection; private: void init (); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index bec9a7e8a9..fe4079050d 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -24,9 +24,11 @@ #include <set> #include <string> #include <stdint.h> -#include <sigc++/signal.h> +#include <boost/signals2.hpp> #include "pbd/stateful.h" +#include "pbd/scoped_connections.h" + #include "ardour/types.h" namespace ARDOUR { @@ -36,7 +38,7 @@ class Track; class AudioTrack; class Session; -class RouteGroup : public PBD::Stateful, public sigc::trackable { +class RouteGroup : public PBD::Stateful, public PBD::ScopedConnectionList { public: enum Flag { Relative = 0x1, @@ -126,8 +128,8 @@ public: boost::shared_ptr<RouteList> route_list() { return routes; } - sigc::signal<void> changed; - sigc::signal<void,void*> FlagsChanged; + boost::signals2::signal<void()> changed; + boost::signals2::signal<void(void*)> FlagsChanged; XMLNode& get_state (); diff --git a/libs/ardour/ardour/route_group_member.h b/libs/ardour/ardour/route_group_member.h index 4b577121a6..8743423b18 100644 --- a/libs/ardour/ardour/route_group_member.h +++ b/libs/ardour/ardour/route_group_member.h @@ -20,7 +20,6 @@ #ifndef __libardour_route_group_member_h__ #define __libardour_route_group_member_h__ -#include <sigc++/signal.h> namespace ARDOUR { @@ -34,7 +33,7 @@ class RouteGroupMember RouteGroup* route_group () const { return _route_group; } - sigc::signal<void> route_group_changed; + boost::signals2::signal<void()> route_group_changed; protected: RouteGroup* _route_group; diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 78a82820df..8b39d12727 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -20,7 +20,6 @@ #ifndef __ardour_send_h__ #define __ardour_send_h__ -#include <sigc++/signal.h> #include <string> #include "pbd/stateful.h" diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 192dc09908..273f251f3d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -38,14 +38,12 @@ #include "pbd/error.h" #include "pbd/rcu.h" #include "pbd/statefuldestructible.h" +#include "pbd/scoped_connections.h" #include "pbd/undo.h" #include "midi++/mmc.h" #include "midi++/types.h" -#include "pbd/destructible.h" -#include "pbd/stateful.h" - #include "ardour/ardour.h" #include "ardour/click.h" #include "ardour/chan_count.h" @@ -120,7 +118,7 @@ class VSTPlugin; extern void setup_enum_writer (); -class Session : public PBD::StatefulDestructible, public SessionEventManager, public boost::noncopyable +class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public boost::noncopyable { public: enum RecordState { @@ -166,14 +164,14 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void set_deletion_in_progress (); void clear_deletion_in_progress (); bool deletion_in_progress() const { return _state_of_the_state & Deletion; } - sigc::signal<void> DirtyChanged; + boost::signals2::signal<void()> DirtyChanged; const SessionDirectory& session_directory () const { return *(_session_dir.get()); } - static sigc::signal<void> AutoBindingOn; - static sigc::signal<void> AutoBindingOff; + static boost::signals2::signal<void()> AutoBindingOn; + static boost::signals2::signal<void()> AutoBindingOff; - static sigc::signal<void,std::string> Dialog; + static boost::signals2::signal<void(std::string)> Dialog; std::string sound_dir (bool with_path = true) const; std::string peak_dir () const; @@ -274,29 +272,29 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu /* Proxy signal for region hidden changes */ - sigc::signal<void,boost::shared_ptr<Region> > RegionHiddenChange; + boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionHiddenChange; /* Emitted when all i/o connections are complete */ - sigc::signal<void> IOConnectionsComplete; + boost::signals2::signal<void()> IOConnectionsComplete; /* Record status signals */ - sigc::signal<void> RecordStateChanged; + boost::signals2::signal<void()> RecordStateChanged; /* Transport mechanism signals */ - sigc::signal<void> TransportStateChange; /* generic */ - sigc::signal<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */ - sigc::signal<void> DurationChanged; - sigc::signal<void,nframes64_t> Xrun; - sigc::signal<void> TransportLooped; + boost::signals2::signal<void()> TransportStateChange; /* generic */ + boost::signals2::signal<void(nframes64_t)> PositionChanged; /* sent after any non-sequential motion */ + boost::signals2::signal<void()> DurationChanged; + boost::signals2::signal<void(nframes64_t)> Xrun; + boost::signals2::signal<void()> TransportLooped; /** emitted when a locate has occurred */ - sigc::signal<void> Located; + boost::signals2::signal<void()> Located; - sigc::signal<void,RouteList&> RouteAdded; - sigc::signal<void> RouteGroupChanged; + boost::signals2::signal<void(RouteList&)> RouteAdded; + boost::signals2::signal<void()> RouteGroupChanged; void queue_event (SessionEvent*); @@ -350,9 +348,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu Locations *locations() { return &_locations; } - sigc::signal<void,Location*> auto_loop_location_changed; - sigc::signal<void,Location*> auto_punch_location_changed; - sigc::signal<void> locations_modified; + boost::signals2::signal<void(Location*)> auto_loop_location_changed; + boost::signals2::signal<void(Location*)> auto_punch_location_changed; + boost::signals2::signal<void()> locations_modified; void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); @@ -377,8 +375,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu static int rename_template (std::string old_name, std::string new_name); static int delete_template (std::string name); - sigc::signal<void,std::string> StateSaved; - sigc::signal<void> StateReady; + boost::signals2::signal<void(std::string)> StateSaved; + boost::signals2::signal<void()> StateReady; std::vector<std::string*>* possible_states() const; static std::vector<std::string*>* possible_states (std::string path); @@ -408,12 +406,12 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu RouteGroup *route_group_by_name (std::string); - sigc::signal<void,RouteGroup*> route_group_added; - sigc::signal<void> route_group_removed; + boost::signals2::signal<void(RouteGroup*)> route_group_added; + boost::signals2::signal<void()> route_group_removed; - void foreach_route_group (sigc::slot<void,RouteGroup*> sl) { + void foreach_route_group (boost::function<void(RouteGroup*)> f) { for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) { - sl (*i); + f (*i); } } @@ -478,9 +476,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu nframes_t convert_to_frames_at (nframes_t position, AnyTime const &); - static sigc::signal<void> StartTimeChanged; - static sigc::signal<void> EndTimeChanged; - static sigc::signal<void> TimecodeOffsetChanged; + static boost::signals2::signal<void()> StartTimeChanged; + static boost::signals2::signal<void()> EndTimeChanged; + static boost::signals2::signal<void()> TimecodeOffsetChanged; std::vector<SyncSource> get_available_sync_options() const; void request_sync_source (Slave*); @@ -498,15 +496,15 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu TempoMap& tempo_map() { return *_tempo_map; } /// signals the current transport position in frames, bbt and timecode time (in that order) - sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick; + boost::signals2::signal<void(const nframes_t&, const BBT_Time&, const Timecode::Time&)> tick; /* region info */ void add_regions (std::vector<boost::shared_ptr<Region> >&); - sigc::signal<void,boost::weak_ptr<Region> > RegionAdded; - sigc::signal<void,std::vector<boost::weak_ptr<Region> >& > RegionsAdded; - sigc::signal<void,boost::weak_ptr<Region> > RegionRemoved; + boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionAdded; + boost::signals2::signal<void(std::vector<boost::weak_ptr<Region> >&)> RegionsAdded; + boost::signals2::signal<void(boost::weak_ptr<Region>)> RegionRemoved; int region_name (std::string& result, std::string base = std::string(""), bool newlevel = false); std::string new_region_name (std::string); @@ -531,9 +529,9 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu int start_audio_export (nframes_t position, bool realtime); - sigc::signal<int, nframes_t> ProcessExport; - sigc::signal<void> ExportReadFinished; - static sigc::signal<void, std::string, std::string> Exported; + boost::signals2::signal<int(nframes_t)> ProcessExport; + boost::signals2::signal<void()> ExportReadFinished; + static boost::signals2::signal<void(std::string, std::string)> Exported; void add_source (boost::shared_ptr<Source>); void remove_source (boost::weak_ptr<Source>); @@ -550,16 +548,16 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu 0 for "yes, delete this playlist", 1 for "no, don't delete this playlist". */ - sigc::signal<int,boost::shared_ptr<Playlist> > AskAboutPlaylistDeletion; + boost::signals2::signal<void(boost::shared_ptr<Playlist>)> AskAboutPlaylistDeletion; /** handlers should return 0 for "ignore the rate mismatch", !0 for "do not use this session" */ - static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch; + static boost::signals2::signal<int(nframes_t, nframes_t)> AskAboutSampleRateMismatch; /** handlers should return !0 for use pending state, 0 for ignore it. */ - static sigc::signal<int> AskAboutPendingState; + static boost::signals2::signal<int()> AskAboutPendingState; boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); @@ -577,8 +575,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void remove_named_selection (NamedSelection *); template<class T> void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&)); - sigc::signal<void> NamedSelectionAdded; - sigc::signal<void> NamedSelectionRemoved; + boost::signals2::signal<void()> NamedSelectionAdded; + boost::signals2::signal<void()> NamedSelectionRemoved; /* Curves and AutomationLists (TODO when they go away) */ void add_automation_list(AutomationList*); @@ -597,7 +595,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void cancel_audition (); bool is_auditioning () const; - sigc::signal<void,bool> AuditionActive; + boost::signals2::signal<void(bool)> AuditionActive; /* flattening stuff */ @@ -619,8 +617,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); - sigc::signal<void,bool> SoloActive; - sigc::signal<void> SoloChanged; + boost::signals2::signal<void(bool)> SoloActive; + boost::signals2::signal<void()> SoloChanged; /* control/master out */ @@ -658,8 +656,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void remove_bundle (boost::shared_ptr<Bundle>); boost::shared_ptr<Bundle> bundle_by_name (std::string) const; - sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded; - sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved; + boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleAdded; + boost::signals2::signal<void(boost::shared_ptr<Bundle>)> BundleRemoved; /* MIDI control */ @@ -673,10 +671,10 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu MIDI::Port *midi_port() const { return _midi_port; } MIDI::Port *midi_clock_port() const { return _midi_clock_port; } - sigc::signal<void> MTC_PortChanged; - sigc::signal<void> MMC_PortChanged; - sigc::signal<void> MIDI_PortChanged; - sigc::signal<void> MIDIClock_PortChanged; + boost::signals2::signal<void()> MTC_PortChanged; + boost::signals2::signal<void()> MMC_PortChanged; + boost::signals2::signal<void()> MIDI_PortChanged; + boost::signals2::signal<void()> MIDIClock_PortChanged; void set_trace_midi_input (bool, MIDI::Port* port = 0); void set_trace_midi_output (bool, MIDI::Port* port = 0); @@ -693,7 +691,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void stop_scrub (); void set_scrub_speed (float); nframes_t scrub_buffer_size() const; - sigc::signal<void> ScrubReady; + boost::signals2::signal<void()> ScrubReady; /* History (for editors, mixers, UIs etc.) */ @@ -726,11 +724,11 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu _current_trans.top()->add_command (cmd); } - std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry; + std::map<PBD::ID,PBD::StatefulDestructible*> registry; // these commands are implemented in libs/ardour/session_command.cc Command* memento_command_factory(XMLNode* n); - void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway*); + void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible*); /* clicking */ @@ -767,7 +765,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void* ptr, float opt); - static sigc::signal<void> SendFeedback; + static boost::signals2::signal<void()> SendFeedback; /* Controllables */ @@ -945,7 +943,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu int stop_audio_export (); void finalize_audio_export (); - sigc::connection export_freewheel_connection; + boost::signals2::scoped_connection export_freewheel_connection; void prepare_diskstreams (); void commit_diskstreams (nframes_t, bool& session_requires_butler); @@ -1069,16 +1067,12 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu void locations_added (Location*); void handle_locations_changed (Locations::LocationList&); - sigc::connection auto_punch_start_changed_connection; - sigc::connection auto_punch_end_changed_connection; - sigc::connection auto_punch_changed_connection; + PBD::ScopedConnectionList punch_connections; void auto_punch_start_changed (Location *); void auto_punch_end_changed (Location *); void auto_punch_changed (Location *); - sigc::connection auto_loop_start_changed_connection; - sigc::connection auto_loop_end_changed_connection; - sigc::connection auto_loop_changed_connection; + PBD::ScopedConnectionList loop_connections; void auto_loop_changed (Location *); void first_stage_init (std::string path, std::string snapshot_name); @@ -1143,7 +1137,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu struct timeval last_mmc_step; double step_speed; - typedef sigc::slot<bool> MidiTimeoutCallback; + typedef boost::function<bool()> MidiTimeoutCallback; typedef std::list<MidiTimeoutCallback> MidiTimeoutList; MidiTimeoutList midi_timeouts; diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 1a3303087d..66c8720186 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -4,7 +4,6 @@ #include <list> #include <boost/function.hpp> #include <boost/shared_ptr.hpp> -#include <sigc++/signal.h> #include "pbd/pool.h" #include "pbd/ringbuffer.h" diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h new file mode 100644 index 0000000000..c747ee9976 --- /dev/null +++ b/libs/ardour/ardour/session_handle.h @@ -0,0 +1,57 @@ +/* + 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 __libardour_session_handle_h__ +#define __libardour_session_handle_h__ + +#include "pbd/scoped_connections.h" + +namespace ARDOUR { + class Session; + +class SessionHandleRef : public PBD::ScopedConnectionList +{ + public: + SessionHandleRef (ARDOUR::Session& s); + virtual ~SessionHandleRef () {} + + protected: + ARDOUR::Session& _session; + virtual void session_going_away (); +}; + +class SessionHandlePtr +{ + public: + SessionHandlePtr (ARDOUR::Session* s); + SessionHandlePtr () : _session (0) {} + virtual ~SessionHandlePtr () {} + + virtual void set_session (ARDOUR::Session *); + + protected: + ARDOUR::Session* _session; + PBD::ScopedConnectionList _session_connections; + + virtual void session_going_away (); +}; + +} /* namespace */ + +#endif /* __libardour_session_handle_h__ */ diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h index 3a796c75b5..eb1a7c3e30 100644 --- a/libs/ardour/ardour/session_object.h +++ b/libs/ardour/ardour/session_object.h @@ -22,24 +22,26 @@ #include <string> #include "pbd/statefuldestructible.h" +#include "pbd/scoped_connections.h" + +#include "ardour/session_handle.h" namespace ARDOUR { class Session; -/** An object associated with a Session. - * - * This is a few common things factored out of IO which weren't IO specific - * (to fix the problem with e.g. PluginInsert being an IO which it shouldn't be). +/** A named object associated with a Session. Objects derived from this class are + expected to be destroyed before the session calls drop_references(). */ -class SessionObject : public PBD::StatefulDestructible + +class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible { -public: - SessionObject(Session& session, const std::string& name) - : _session(session) + public: + SessionObject (Session& session, const std::string& name) + : SessionHandleRef (session) , _name(name) {} - + Session& session() const { return _session; } const std::string& name() const { return _name; } @@ -51,10 +53,9 @@ public: return true; } - sigc::signal<void> NameChanged; + boost::signals2::signal<void()> NameChanged; -protected: - Session& _session; + protected: std::string _name; }; diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h index 83f469cfd4..8870794cc0 100644 --- a/libs/ardour/ardour/session_playlists.h +++ b/libs/ardour/ardour/session_playlists.h @@ -25,7 +25,9 @@ #include <string> #include <glibmm/thread.h> #include <boost/shared_ptr.hpp> -#include <sigc++/trackable.h> +#include <boost/function.hpp> + +#include "pbd/scoped_connections.h" class XMLNode; @@ -36,7 +38,7 @@ class Region; class Source; class Session; -class SessionPlaylists : public sigc::trackable +class SessionPlaylists : public PBD::ScopedConnectionList { public: ~SessionPlaylists (); @@ -58,7 +60,7 @@ private: void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result); void update_after_tempo_map_change (); void add_state (XMLNode *, bool); - bool maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> >); + bool maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)>); int load (Session &, const XMLNode&); int load_unused (Session &, const XMLNode&); boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&); diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 1125e920a0..4fe8e1ec46 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -23,10 +23,12 @@ #include <vector> #include <glibmm/thread.h> +#include <boost/signals2.hpp> #include <jack/jack.h> -#include <sigc++/signal.h> +#include "pbd/scoped_connections.h" + #include "ardour/types.h" #include "midi++/parser.h" #include "midi++/types.h" @@ -220,7 +222,7 @@ struct SafeTime { } }; -class MTC_Slave : public Slave, public sigc::trackable { +class MTC_Slave : public Slave { public: MTC_Slave (Session&, MIDI::Port&); ~MTC_Slave (); @@ -240,7 +242,7 @@ class MTC_Slave : public Slave, public sigc::trackable { private: Session& session; MIDI::Port* port; - std::vector<sigc::connection> connections; + PBD::ScopedConnectionList* port_connections; bool can_notify_on_unknown_rate; PIChaser* pic; @@ -277,7 +279,7 @@ class MTC_Slave : public Slave, public sigc::trackable { void process_apparent_speed (double); }; -class MIDIClock_Slave : public Slave, public sigc::trackable { +class MIDIClock_Slave : public Slave { public: MIDIClock_Slave (Session&, MIDI::Port&, int ppqn = 24); @@ -301,7 +303,7 @@ class MIDIClock_Slave : public Slave, public sigc::trackable { private: ISlaveSessionProxy* session; MIDI::Port* port; - std::vector<sigc::connection> connections; + PBD::ScopedConnectionList* port_connections; /// pulses per quarter note for one MIDI clock frame (default 24) int ppqn; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index b2e1381e43..a7a6e2207c 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -24,7 +24,6 @@ #include <set> #include <boost/utility.hpp> -#include <sigc++/signal.h> #include "pbd/statefuldestructible.h" #include "ardour/ardour.h" @@ -82,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 sigc::signal<void,Source*> SourceCreated; - sigc::signal<void,boost::shared_ptr<Source> > Switched; + static boost::signals2::signal<void(Source*)> SourceCreated; + boost::signals2::signal<void(boost::shared_ptr<Source>)> 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(); - sigc::signal<void> AnalysisChanged; + boost::signals2::signal<void()> 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 21af4ece75..4da285e980 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -22,7 +22,6 @@ #include <string> #include <stdint.h> -#include <sigc++/sigc++.h> #include <boost/shared_ptr.hpp> #include "ardour/source.h" @@ -38,7 +37,7 @@ class SourceFactory { public: static void init (); - static sigc::signal<void,boost::shared_ptr<Source> > SourceCreated; + static boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceCreated; static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 28c974bff1..ba7bbbcf7e 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -30,7 +30,6 @@ #include "pbd/stateful.h" #include "pbd/statefuldestructible.h" -#include <sigc++/signal.h> #include "ardour/ardour.h" @@ -259,7 +258,7 @@ class TempoMap : public PBD::StatefulDestructible nframes_t frame_rate () const { return _frame_rate; } - sigc::signal<void,ARDOUR::Change> StateChanged; + boost::signals2::signal<void(ARDOUR::Change)> StateChanged; private: static Tempo _default_tempo; diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index 3e0f1844a6..9a26d4d3ff 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -18,10 +18,13 @@ $Id$ */ -#include <sigc++/sigc++.h> -#include "ardour/types.h" #include "midi++/jack.h" +#include "pbd/scoped_connections.h" + +#include "ardour/types.h" +#include "ardour/session_handle.h" + #ifndef TICKER_H_ #define TICKER_H_ @@ -31,22 +34,18 @@ namespace ARDOUR class Session; -class Ticker : public sigc::trackable +class Ticker : public SessionHandlePtr { public: - Ticker() : _session(0) {}; - virtual ~Ticker() {}; + Ticker() {}; + virtual ~Ticker() {} virtual void tick( const nframes_t& transport_frames, const BBT_Time& transport_bbt, const Timecode::Time& transport_timecode) = 0; - virtual void set_session(Session& s); - virtual void going_away() { _session = 0; } - -protected: - Session* _session; + void set_session (Session* s); }; class MidiClockTicker : public Ticker @@ -70,8 +69,8 @@ public: const BBT_Time& transport_bbt, const Timecode::Time& transport_timecode); - void set_session(Session& s); - void going_away() { _midi_port = 0; Ticker::going_away(); } + void set_session (Session* s); + void session_going_away(); /// slot for the signal session::MIDIClock_PortChanged void update_midi_clock_port(); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 5d8e2dbbd5..c23e159684 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; } - sigc::signal<void> TrackModeChanged; + boost::signals2::signal<void()> 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); - sigc::signal<void> DiskstreamChanged; - sigc::signal<void> FreezeChange; + boost::signals2::signal<void()> DiskstreamChanged; + boost::signals2::signal<void()> FreezeChange; protected: Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO); @@ -141,7 +141,7 @@ class Track : public Route FreezeRecord _freeze_record; XMLNode* pending_state; - sigc::connection recenable_connection; + boost::signals2::scoped_connection recenable_connection; bool _destructive; boost::shared_ptr<RecEnableControllable> _rec_enable_control; diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 2d9875df57..753d94294f 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -27,7 +27,6 @@ #include <string> #include <dlfcn.h> -#include <sigc++/signal.h> #include "pbd/stateful.h" #include <jack/types.h> #include "ardour/plugin.h" diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 40411f4133..2ad323ca1c 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -126,8 +126,6 @@ AudioDiskstream::~AudioDiskstream () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("Audio Diskstream %1 destructor\n", _name)); - notify_callbacks (); - { RCUWriter<ChannelList> writer (channels); boost::shared_ptr<ChannelList> c = writer.get_copy(); @@ -1506,7 +1504,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca continue; /* XXX is this OK? */ } - region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region))); + scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region))); _last_capture_regions.push_back (region); diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 63013426cb..acb44e43c4 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -21,7 +21,6 @@ #include <cstdlib> -#include <sigc++/bind.h> #include "ardour/types.h" #include "ardour/configuration.h" @@ -103,12 +102,10 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra AudioPlaylist::~AudioPlaylist () { - GoingAway (); /* EMIT SIGNAL */ + drop_references (); /* drop connections to signals */ - notify_callbacks (); - _crossfades.clear (); } @@ -531,8 +528,8 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade) } else { _crossfades.push_back (xfade); - xfade->Invalidated.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated)); - xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed)); + scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); + scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); notify_crossfade_added (xfade); } @@ -587,8 +584,8 @@ AudioPlaylist::set_state (const XMLNode& node, int version) try { boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child)); _crossfades.push_back (xfade); - xfade->Invalidated.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_invalidated)); - xfade->StateChanged.connect (sigc::mem_fun (*this, &AudioPlaylist::crossfade_changed)); + scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1)); + scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1)); NewCrossfade(xfade); } @@ -791,7 +788,7 @@ AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist) } void -AudioPlaylist::foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> > s) +AudioPlaylist::foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)> s) { RegionLock rl (this, false); for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) { diff --git a/libs/ardour/audio_playlist_importer.cc b/libs/ardour/audio_playlist_importer.cc index cb6bbed907..3f773fc0a9 100644 --- a/libs/ardour/audio_playlist_importer.cc +++ b/libs/ardour/audio_playlist_importer.cc @@ -170,7 +170,7 @@ AudioPlaylistImporter::_prepare_move () { // Rename while (session.playlists->by_name (name) || !handler.check_name (name)) { - std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name); + std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name); if (!rename_pair.first) { return false; } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 68081661ad..736fe41738 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -17,9 +17,6 @@ */ -#include <sigc++/retype.h> -#include <sigc++/retype_return.h> -#include <sigc++/bind.h> #include "pbd/error.h" #include "pbd/enumwriter.h" @@ -185,7 +182,7 @@ AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void * /*src* if (audio_diskstream()->deprecated_io_node) { if (!IO::connecting_legal) { - IO::ConnectingLegal.connect (sigc::mem_fun (*this, &AudioTrack::deprecated_use_diskstream_connections)); + scoped_connect (IO::ConnectingLegal, boost::bind (&AudioTrack::deprecated_use_diskstream_connections, this)); } else { deprecated_use_diskstream_connections (); } @@ -307,7 +304,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base) pending_state = const_cast<XMLNode*> (&node); if (_session.state_of_the_state() & Session::Loading) { - _session.StateReady.connect (sigc::mem_fun (*this, &AudioTrack::set_state_part_two)); + scoped_connect (_session.StateReady, boost::bind (&AudioTrack::set_state_part_two, this)); } else { set_state_part_two (); } diff --git a/libs/ardour/audio_track_importer.cc b/libs/ardour/audio_track_importer.cc index 146722b3c0..aad20f9317 100644 --- a/libs/ardour/audio_track_importer.cc +++ b/libs/ardour/audio_track_importer.cc @@ -240,7 +240,7 @@ AudioTrackImporter::_prepare_move () /* Rename */ while (session.route_by_name (name) || !track_handler.check_name (name)) { - std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name); + std::pair<bool, string> rename_pair = *Rename (_("A playlist with this name already exists, please rename it."), name); if (!rename_pair.first) { return false; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 2c16c52296..b1c5527570 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -66,7 +66,6 @@ AudioEngine::AudioEngine (string client_name) { _instance = this; /* singleton */ - session = 0; session_remove_pending = false; _running = false; _has_run = false; @@ -158,24 +157,24 @@ AudioEngine::start () nframes_t blocksize = jack_get_buffer_size (_priv_jack); - if (session) { + if (_session) { BootMessage (_("Connect session to engine")); - session->set_block_size (blocksize); - session->set_frame_rate (jack_get_sample_rate (_priv_jack)); + _session->set_block_size (blocksize); + _session->set_frame_rate (jack_get_sample_rate (_priv_jack)); /* page in as much of the session process code as we can before we really start running. */ - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); - session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); } _processed_frames = 0; @@ -192,7 +191,7 @@ AudioEngine::start () jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this); jack_set_port_registration_callback (_priv_jack, _registration_callback, this); - if (session && session->config.get_jack_time_master()) { + if (_session && _session->config.get_jack_time_master()) { jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this); } @@ -269,8 +268,8 @@ void AudioEngine::jack_timebase_callback (jack_transport_state_t state, nframes_t nframes, jack_position_t* pos, int new_position) { - if (_jack && session && session->synced_to_jack()) { - session->jack_timebase_callback (state, nframes, pos, new_position); + if (_jack && _session && _session->synced_to_jack()) { + _session->jack_timebase_callback (state, nframes, pos, new_position); } } @@ -283,8 +282,8 @@ AudioEngine::_jack_sync_callback (jack_transport_state_t state, jack_position_t* int AudioEngine::jack_sync_callback (jack_transport_state_t state, jack_position_t* pos) { - if (_jack && session) { - return session->jack_sync_callback (state, pos); + if (_jack && _session) { + return _session->jack_sync_callback (state, pos); } return true; @@ -372,7 +371,7 @@ AudioEngine::process_callback (nframes_t nframes) next_processed_frames = _processed_frames + nframes; } - if (!tm.locked() || session == 0) { + if (!tm.locked() || _session == 0) { /* return having done nothing */ _processed_frames = next_processed_frames; return 0; @@ -380,7 +379,7 @@ AudioEngine::process_callback (nframes_t nframes) if (session_remove_pending) { /* perform the actual session removal */ - session = 0; + _session = 0; session_remove_pending = false; session_removed.signal(); _processed_frames = next_processed_frames; @@ -402,14 +401,16 @@ AudioEngine::process_callback (nframes_t nframes) } if (_freewheeling) { - /* emit the Freewheel signal and stop freewheeling in the event of trouble */ - if (Freewheel (nframes)) { + /* emit the Freewheel signal and stop freewheeling in the event of trouble + * the indirection is to pick up the return value of the signal. + */ + if (*Freewheel (nframes)) { jack_set_freewheel (_priv_jack, false); } } else { - if (session) { - session->process (nframes); + if (_session) { + _session->process (nframes); } } @@ -442,7 +443,7 @@ AudioEngine::process_callback (nframes_t nframes) last_monitor_check = next_processed_frames; } - if (session->silent()) { + if (_session->silent()) { boost::shared_ptr<Ports> p = ports.reader(); @@ -483,8 +484,8 @@ AudioEngine::jack_sample_rate_callback (nframes_t nframes) monitor_check_interval = nframes / 10; last_monitor_check = 0; - if (session) { - session->set_frame_rate (nframes); + if (_session) { + _session->set_frame_rate (nframes); } SampleRateChanged (nframes); /* EMIT SIGNAL */ @@ -514,8 +515,8 @@ AudioEngine::jack_bufsize_callback (nframes_t nframes) (*i)->reset(); } - if (session) { - session->set_block_size (_buffer_size); + if (_session) { + _session->set_block_size (_buffer_size); } return 0; @@ -536,7 +537,7 @@ AudioEngine::start_metering_thread () { if (m_meter_thread == 0) { g_atomic_int_set (&m_meter_exit, 0); - m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), + m_meter_thread = Glib::Thread::create (boost::bind (&AudioEngine::meter_thread, this), 500000, true, true, Glib::THREAD_PRIORITY_NORMAL); } } @@ -558,31 +559,31 @@ AudioEngine::set_session (Session *s) { Glib::Mutex::Lock pl (_process_lock); - if (!session) { - - session = s; + SessionHandlePtr::set_session (s); + if (_session) { + nframes_t blocksize = jack_get_buffer_size (_jack); - + /* page in as much of the session process code as we can before we really start running. */ - + boost::shared_ptr<Ports> p = ports.reader(); - + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { (*i)->cycle_start (blocksize); } - - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - s->process (blocksize); - + + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + _session->process (blocksize); + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { (*i)->cycle_end (blocksize); } @@ -596,13 +597,13 @@ AudioEngine::remove_session () if (_running) { - if (session) { + if (_session) { session_remove_pending = true; session_removed.wait(_process_lock); } } else { - session = 0; + SessionHandlePtr::set_session (0); } remove_all_ports (); @@ -1081,8 +1082,8 @@ int AudioEngine::reset_timebase () { GET_PRIVATE_JACK_POINTER_RET (_jack, -1); - if (session) { - if (session->config.get_jack_time_master()) { + if (_session) { + if (_session->config.get_jack_time_master()) { return jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this); } else { return jack_release_timebase (_jack); @@ -1214,11 +1215,11 @@ AudioEngine::reconnect_to_jack () GET_PRIVATE_JACK_POINTER_RET (_jack,-1); - if (session) { - session->reset_jack_connection (_priv_jack); + if (_session) { + _session->reset_jack_connection (_priv_jack); nframes_t blocksize = jack_get_buffer_size (_priv_jack); - session->set_block_size (blocksize); - session->set_frame_rate (jack_get_sample_rate (_priv_jack)); + _session->set_block_size (blocksize); + _session->set_frame_rate (jack_get_sample_rate (_priv_jack)); _raw_buffer_sizes[DataType::AUDIO] = blocksize * sizeof(float); cout << "FIXME: Assuming maximum MIDI buffer size " << blocksize * 4 << "bytes" << endl; @@ -1237,7 +1238,7 @@ AudioEngine::reconnect_to_jack () jack_set_sync_callback (_priv_jack, _jack_sync_callback, this); jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this); - if (session && session->config.get_jack_time_master()) { + if (_session && _session->config.get_jack_time_master()) { jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this); } diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index b840c3a7c9..1500b139ac 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -70,7 +70,7 @@ using namespace Glib; ustring AudioFileSource::peak_dir = ""; -sigc::signal<void> AudioFileSource::HeaderPositionOffsetChanged; +boost::signals2::signal<void()> 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 d660616bb3..ac173db546 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -24,8 +24,6 @@ #include <set> -#include <sigc++/bind.h> -#include <sigc++/class_slot.h> #include <glibmm/thread.h> @@ -98,7 +96,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n { boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src); if (afs) { - afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed)); + scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -115,7 +113,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n { boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src); if (afs) { - afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed)); + scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -207,7 +205,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, const Sour boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> ((*i)); if (afs) { - afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed)); + scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); } } @@ -231,7 +229,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod { boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src); if (afs) { - afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed)); + scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); } init (); @@ -272,7 +270,7 @@ void AudioRegion::connect_to_analysis_changed () { for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) { - (*i)->AnalysisChanged.connect (sigc::mem_fun (*this, &AudioRegion::invalidate_transients)); + scoped_connect ((*i)->AnalysisChanged, boost::bind (&AudioRegion::invalidate_transients, this)); } } @@ -287,7 +285,7 @@ AudioRegion::connect_to_header_position_offset_changed () unique_srcs.insert (*i); boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (*i); if (afs) { - afs->HeaderPositionOffsetChanged.connect (sigc::mem_fun (*this, &AudioRegion::source_offset_changed)); + scoped_connect (afs->HeaderPositionOffsetChanged, boost::bind (&AudioRegion::source_offset_changed, this)); } } } @@ -296,9 +294,9 @@ AudioRegion::connect_to_header_position_offset_changed () void AudioRegion::listen_to_my_curves () { - _envelope->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::envelope_changed)); - _fade_in->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_in_changed)); - _fade_out->StateChanged.connect (sigc::mem_fun (*this, &AudioRegion::fade_out_changed)); + 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)); } void diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index f7d6088aec..fd481c9730 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 (sigc::slot<void> the_slot, sigc::connection& conn) const +AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, boost::signals2::connection& connect_here_if_not) const { bool ret; Glib::Mutex::Lock lm (_peaks_ready_lock); @@ -159,7 +159,7 @@ AudioSource::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) con */ if (!(ret = _peaks_built)) { - conn = PeaksReady.connect (the_slot); + connect_here_if_not = PeaksReady.connect (doThisWhenReady); } return ret; diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index dbb76c005e..7d353a1bdd 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 (); - _output->changed.connect (sigc::mem_fun (*this, &Auditioner::output_changed)); + scoped_connect (_output->changed, 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 db8f5bb799..9a6eb08e45 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -23,7 +23,6 @@ #include <cmath> #include <sstream> #include <algorithm> -#include <sigc++/bind.h> #include "ardour/automation_list.h" #include "ardour/event_type_map.h" #include "evoral/Curve.hpp" @@ -36,7 +35,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -sigc::signal<void,AutomationList *> AutomationList::AutomationListCreated; +boost::signals2::signal<void(AutomationList *)> AutomationList::AutomationListCreated; #if 0 static void dumpit (const AutomationList& al, string prefix = "") @@ -113,7 +112,7 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id) AutomationList::~AutomationList() { - GoingAway (); + drop_references (); } boost::shared_ptr<Evoral::ControlList> diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index 05ac7316ec..2fd4c1d9c1 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -38,8 +38,8 @@ static float _write_data_rate; namespace ARDOUR { -Butler::Butler(Session* s) - : session(s) +Butler::Butler(Session& s) + : SessionHandleRef (s) , thread(0) , audio_dstream_buffer_size(0) , midi_dstream_buffer_size(0) @@ -54,7 +54,7 @@ Butler::~Butler() int Butler::start_thread() { - const float rate = (float)session->frame_rate(); + const float rate = (float)_session.frame_rate(); /* size is in Samples, not bytes */ audio_dstream_buffer_size = (uint32_t) floor (Config->get_audio_track_buffer_seconds() * rate); @@ -194,7 +194,7 @@ Butler::thread_work () } if (transport_work_requested()) { - session->butler_transport_work (); + _session.butler_transport_work (); } disk_work_outstanding = false; @@ -203,7 +203,7 @@ Butler::thread_work () begin = get_microseconds(); - boost::shared_ptr<Session::DiskstreamList> dsl = session->diskstream_list().reader (); + boost::shared_ptr<Session::DiskstreamList> dsl = _session.diskstream_list().reader (); // for (i = dsl->begin(); i != dsl->end(); ++i) { // cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl; @@ -285,11 +285,11 @@ Butler::thread_work () } } - if (err && session->actively_recording()) { + if (err && _session.actively_recording()) { /* stop the transport and try to catch as much possible captured state as we can. */ - session->request_stop (); + _session.request_stop (); } if (i != dsl->end()) { @@ -304,15 +304,15 @@ Butler::thread_work () if (compute_io) { // there are no apparent users for this calculation? end = get_microseconds(); - if(end-begin > 0) { - _write_data_rate = (float) bytes / (float) (end - begin); + if (end - begin > 0) { + _write_data_rate = (float) bytes / (float) (end - begin); } else { - _write_data_rate = 0; // Well, infinity would be better + _write_data_rate = 0; // Well, infinity would be better } } if (!disk_work_outstanding) { - session->refresh_disk_space (); + _session.refresh_disk_space (); } diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index d15283c85c..47f8d5bf98 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -39,7 +39,6 @@ ControlProtocolManager* ControlProtocolManager::_instance = 0; const string ControlProtocolManager::state_node_name = X_("ControlProtocols"); ControlProtocolManager::ControlProtocolManager () - : _session (0) { } @@ -63,36 +62,42 @@ ControlProtocolManager::~ControlProtocolManager() } void -ControlProtocolManager::set_session (Session& s) +ControlProtocolManager::set_session (Session* s) { - _session = &s; - _session->GoingAway.connect (sigc::mem_fun (*this, &ControlProtocolManager::drop_session)); + SessionHandlePtr::set_session (s); - for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { - if ((*i)->requested || (*i)->mandatory) { - instantiate (**i); - (*i)->requested = false; + if (_session) { + Glib::Mutex::Lock lm (protocols_lock); - if ((*i)->protocol && (*i)->state) { - (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version); + for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { + if ((*i)->requested || (*i)->mandatory) { + instantiate (**i); + (*i)->requested = false; + + if ((*i)->protocol && (*i)->state) { + (*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version); + } } } } } void -ControlProtocolManager::drop_session () +ControlProtocolManager::session_going_away() { - _session = 0; + SessionHandlePtr::session_going_away (); { Glib::Mutex::Lock lm (protocols_lock); + for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) { delete *p; } + control_protocols.clear (); for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { + // mark existing protocols as requested // otherwise the ControlProtocol instances are not recreated in set_session if ((*p)->protocol) { (*p)->requested = true; @@ -263,7 +268,7 @@ ControlProtocolManager::get_descriptor (string path) } void -ControlProtocolManager::foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*> method) +ControlProtocolManager::foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)> method) { for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { method (*i); diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 55e81ae9e0..bbb0d8ca89 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -90,7 +90,7 @@ CoreAudioSource::init_cafile () CoreAudioSource::~CoreAudioSource () { - GoingAway (); /* EMIT SIGNAL */ + drop_references (); } int diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 7bbad9a1d1..75f2bae587 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -17,7 +17,6 @@ */ -#include <sigc++/bind.h> #include "pbd/stacktrace.h" @@ -192,7 +191,6 @@ Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<Audio Crossfade::~Crossfade () { - notify_callbacks (); } void diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 07489687c1..7f159a441c 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -42,9 +42,9 @@ using namespace std; using namespace PBD; using namespace ARDOUR; -sigc::signal<void,nframes_t> Delivery::CycleStart; -sigc::signal<int> Delivery::PannersLegal; -bool Delivery::panners_legal = false; +boost::signals2::signal<void(nframes_t)> Delivery::CycleStart; +boost::signals2::signal<int()> 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> io, boost::shared_ptr<Mute _display_to_user = false; if (_output) { - _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed)); + scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); } - CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start)); + scoped_connect (CycleStart, boost::bind (&Delivery::cycle_start, this, _1)); } /* deliver to a new IO object */ @@ -88,10 +88,10 @@ Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const string& _display_to_user = false; if (_output) { - _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed)); + scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); } - CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start)); + scoped_connect (CycleStart, 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<MuteMaster> mm, const XMLNode& } if (_output) { - _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed)); + scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); } - CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start)); + scoped_connect (CycleStart, 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<IO> out, boost::shared_ptr<Mut } if (_output) { - _output->changed.connect (sigc::mem_fun (*this, &Delivery::output_changed)); + scoped_connect (_output->changed, boost::bind (&Delivery::output_changed, this, _1, _2)); } - CycleStart.connect (sigc::mem_fun (*this, &Delivery::cycle_start)); + scoped_connect (CycleStart, 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 (sigc::mem_fun (*this, &Delivery::panners_became_legal)); + panner_legal_c = PannersLegal.connect (boost::bind (&Delivery::panners_became_legal, this)); } } @@ -465,7 +465,7 @@ int Delivery::reset_panners () { panners_legal = true; - return PannersLegal (); + return *PannersLegal (); } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index ee279c601d..f9e8202ebc 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -31,7 +31,6 @@ #include <sys/stat.h> #include <sys/mman.h> -#include <sigc++/bind.h> #include "pbd/error.h" #include "pbd/basename.h" @@ -69,8 +68,8 @@ using namespace PBD; */ ARDOUR::nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256; -sigc::signal<void> Diskstream::DiskOverrun; -sigc::signal<void> Diskstream::DiskUnderrun; +boost::signals2::signal<void()> Diskstream::DiskOverrun; +boost::signals2::signal<void()> Diskstream::DiskUnderrun; Diskstream::Diskstream (Session &sess, const string &name, Flag flag) : SessionObject(sess, name) @@ -143,13 +142,13 @@ Diskstream::set_route (Route& r) _io = _route->input(); ic_connection.disconnect(); - ic_connection = _io->changed.connect (sigc::mem_fun (*this, &Diskstream::handle_input_change)); + ic_connection = _io->changed.connect (boost::bind (&Diskstream::handle_input_change, this, _1, _2)); input_change_pending = ConfigurationChanged; non_realtime_input_change (); set_align_style_from_io (); - _route->GoingAway.connect (sigc::mem_fun (*this, &Diskstream::route_going_away)); + scoped_connect (_route->GoingAway, boost::bind (&Diskstream::route_going_away, this)); } void @@ -327,9 +326,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist) return 0; } - plmod_connection.disconnect (); - plgone_connection.disconnect (); - plregion_connection.disconnect (); + playlist_connections.drop_connections (); if (_playlist) { _playlist->release(); @@ -342,9 +339,9 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist) reset_write_sources (false); } - plmod_connection = _playlist->Modified.connect (sigc::mem_fun (*this, &Diskstream::playlist_modified)); - plgone_connection = _playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::playlist_deleted), boost::weak_ptr<Playlist>(_playlist))); - plregion_connection = _playlist->RangesMoved.connect (sigc::mem_fun (*this, &Diskstream::playlist_ranges_moved)); + 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)))); + playlist_connections.add_connection (_playlist->RangesMoved.connect (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 @@ -457,12 +454,11 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<nframes_t> > const & } /* move processor automation */ - _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &Diskstream::move_processor_automation), movements_frames)); + _route->foreach_processor (boost::bind (&Diskstream::move_processor_automation, this, _1, movements_frames)); } void -Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, - list< Evoral::RangeMove<nframes_t> > const & movements_frames) +Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evoral::RangeMove<nframes_t> > const & movements_frames) { boost::shared_ptr<Processor> processor (p.lock ()); if (!processor) { diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc index c02b841ea7..3e7c2c9a91 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; -sigc::signal <std::pair<bool, string>, string, string> ElementImporter::Rename; -sigc::signal <bool, string> ElementImporter::Prompt; +boost::signals2::signal <std::pair<bool, string> (string, string)> ElementImporter::Rename; +boost::signals2::signal <bool (string)> 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 583dc9a843..3006fbc3ee 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"); } - session->ProcessExport.connect (sigc::hide (sigc::mem_fun (*this, &RegionExportChannelFactory::new_cycle_started))); + export_connection = session->ProcessExport.connect (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 908ae6f8a8..f26f0635d8 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); - ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_compatibility_selection), WeakCompatPtr (ptr))); + scoped_connect (ptr->SelectChanged, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr))); } void ExportFormatManager::add_quality (QualityPtr ptr) { - ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_quality_selection), WeakQualityPtr (ptr))); + scoped_connect (ptr->SelectChanged, 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); - ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_format_selection), WeakFormatPtr (ptr))); + scoped_connect (ptr->SelectChanged, 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<HasSampleFormat> hsf; if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr)) { - hsf->SampleFormatSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_sample_format_selection)); - hsf->DitherTypeSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_dither_type_selection)); + 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)); } } void ExportFormatManager::add_sample_rate (SampleRatePtr ptr) { - ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_sample_rate_selection), WeakSampleRatePtr (ptr))); + scoped_connect (ptr->SelectChanged, 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 362076876e..b7637f3c07 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -59,9 +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); - ptr->SelectChanged.connect (sigc::bind (SampleFormatSelectChanged.make_slot(), WeakSampleFormatPtr (ptr))); - ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_sample_format_selection)); - ptr->CompatibleChanged.connect (sigc::bind (SampleFormatCompatibleChanged.make_slot(), WeakSampleFormatPtr (ptr))); + scoped_connect (ptr->SelectChanged, 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)); } void @@ -69,9 +70,10 @@ HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustri { DitherTypePtr ptr (new DitherTypeState (type, name)); dither_type_states.push_back (ptr); - ptr->SelectChanged.connect (sigc::bind (DitherTypeSelectChanged.make_slot(), WeakDitherTypePtr (ptr))); - ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_dither_type_selection)); - ptr->CompatibleChanged.connect (sigc::bind (DitherTypeCompatibleChanged.make_slot(), WeakDitherTypePtr (ptr))); + scoped_connect (ptr->SelectChanged, 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)); } HasSampleFormat::SampleFormatPtr diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 0c7a2e8d48..7bf231acd2 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -98,15 +98,15 @@ ExportElementFactory::add_filename_copy (FilenamePtr other) /*** ExportHandler ***/ -ExportHandler::ExportHandler (Session & session) : - ExportElementFactory (session), - session (session), - export_status (session.get_export_status ()), - realtime (false) +ExportHandler::ExportHandler (Session & session) + : ExportElementFactory (session) + , session (session) + , export_status (session.get_export_status ()) + , realtime (false) { processor.reset (new ExportProcessor (session)); - files_written_connection = ExportProcessor::WritingFile.connect (sigc::mem_fun (files_written, &std::list<Glib::ustring>::push_back)); + files_written_connection = ExportProcessor::WritingFile.connect (boost::bind (&ExportHandler::add_file, this, _1)); } ExportHandler::~ExportHandler () @@ -121,6 +121,12 @@ ExportHandler::~ExportHandler () files_written_connection.disconnect(); } +void +ExportHandler::add_file (const Glib::ustring& str) +{ + files_written.push_back (str); +} + bool ExportHandler::add_export_config (TimespanPtr timespan, ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename) { @@ -162,7 +168,7 @@ ExportHandler::do_export (bool rt) realtime = rt; - session.ExportReadFinished.connect (sigc::mem_fun (*this, &ExportHandler::finish_timespan)); + export_read_finished_connection = session.ExportReadFinished.connect (boost::bind (&ExportHandler::finish_timespan, this)); start_timespan (); } @@ -499,7 +505,7 @@ ExportHandler::start_timespan () /* connect stuff and start export */ - current_timespan->process_connection = session.ProcessExport.connect (sigc::mem_fun (*current_timespan, &ExportTimespan::process)); + current_timespan->process_connection = session.ProcessExport.connect (boost::bind (&ExportTimespan::process, current_timespan, _1)); session.start_audio_export (current_timespan->get_start(), realtime); } @@ -538,6 +544,7 @@ void ExportHandler::timespan_thread_finished () { channel_config_connection.disconnect(); + export_read_finished_connection.disconnect (); if (current_map_it != timespan_bounds.second) { @@ -559,7 +566,7 @@ ExportHandler::timespan_thread_finished () cc = current_map_it->second.channel_config; } - channel_config_connection = cc->FilesWritten.connect (sigc::mem_fun (*this, &ExportHandler::timespan_thread_finished)); + channel_config_connection = cc->FilesWritten.connect (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 d36ef9f18a..7d04e8f8d6 100644 --- a/libs/ardour/export_processor.cc +++ b/libs/ardour/export_processor.cc @@ -38,7 +38,7 @@ using namespace PBD; namespace ARDOUR { -sigc::signal<void, Glib::ustring> ExportProcessor::WritingFile; +boost::signals2::signal<void (const Glib::ustring&)> ExportProcessor::WritingFile; ExportProcessor::ExportProcessor (Session & session) : session (session), diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 9953524c34..e3e37a7107 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; -sigc::signal<void,std::string> ARDOUR::BootMessage; +boost::signals2::signal<void(std::string)> ARDOUR::BootMessage; void ARDOUR::setup_enum_writer (); diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 41c29f43f1..ccee62c988 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -27,20 +27,20 @@ using namespace std; using namespace ARDOUR; -sigc::signal<void,nframes_t> InternalReturn::CycleStart; +boost::signals2::signal<void(nframes_t)> InternalReturn::CycleStart; InternalReturn::InternalReturn (Session& s) : Return (s, true) , user_count (0) { - CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start)); + scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1)); } InternalReturn::InternalReturn (Session& s, const XMLNode& node) : Return (s, node, true) , user_count (0) { - CycleStart.connect (sigc::mem_fun (*this, &InternalReturn::cycle_start)); + scoped_connect (CycleStart, boost::bind (&InternalReturn::cycle_start, this, _1)); } void diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index e10857a2a9..d6489f8f49 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -43,8 +43,8 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost: set_name (sendto->name()); - _send_to->GoingAway.connect (sigc::mem_fun (*this, &InternalSend::send_to_going_away)); - _send_to->NameChanged.connect (sigc::mem_fun (*this, &InternalSend::send_to_name_changed)); + 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)); } InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> 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 (sigc::mem_fun (*this, &InternalSend::connect_when_legal)); + connect_c = IO::ConnectingLegal.connect (boost::bind (&InternalSend::connect_when_legal, this)); } else { connect_when_legal (); } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index d8d7ec88a5..b9fd9ccbc6 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -22,7 +22,6 @@ #include <locale.h> #include <errno.h> -#include <sigc++/bind.h> #include <glibmm.h> #include <glibmm/thread.h> @@ -68,8 +67,8 @@ using namespace PBD; const string IO::state_node_name = "IO"; bool IO::connecting_legal = false; -sigc::signal<int> IO::ConnectingLegal; -sigc::signal<void,ChanCount> IO::PortCountChanged; +boost::signals2::signal<int()> IO::ConnectingLegal; +boost::signals2::signal<void(ChanCount)> 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). @@ -124,13 +123,13 @@ IO::check_bundles_connected () } void -IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports) +IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports) { - std::vector<UserBundleInfo> new_list; + std::vector<UserBundleInfo*> new_list; - for (std::vector<UserBundleInfo>::iterator i = list.begin(); i != list.end(); ++i) { + for (std::vector<UserBundleInfo*>::iterator i = list.begin(); i != list.end(); ++i) { - uint32_t const N = i->bundle->nchannels (); + uint32_t const N = (*i)->bundle->nchannels (); if (_ports.num_ports (default_type()) < N) { continue; @@ -140,7 +139,7 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports) for (uint32_t j = 0; j < N; ++j) { /* Every port on bundle channel j must be connected to our input j */ - Bundle::PortList const pl = i->bundle->channel_ports (j); + Bundle::PortList const pl = (*i)->bundle->channel_ports (j); for (uint32_t k = 0; k < pl.size(); ++k) { if (ports.port(j)->connected_to (pl[k]) == false) { ok = false; @@ -156,7 +155,7 @@ IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports) if (ok) { new_list.push_back (*i); } else { - i->changed.disconnect (); + delete *i; } } @@ -475,9 +474,9 @@ IO::state (bool /*full_state*/) node->add_property ("direction", enum_2_string (_direction)); node->add_property ("default-type", _default_type.to_string()); - for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { + for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { XMLNode* n = new XMLNode ("Bundle"); - n->add_property ("name", i->bundle->name ()); + n->add_property ("name", (*i)->bundle->name ()); node->add_child_nocopy (*n); } @@ -567,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 (sigc::mem_fun (*this, &IO::connecting_became_legal)); + connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this)); } @@ -620,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 (sigc::mem_fun (*this, &IO::connecting_became_legal)); + connection_legal_c = ConnectingLegal.connect (boost::bind (&IO::connecting_became_legal, this)); } return 0; @@ -1164,14 +1163,14 @@ IO::connect_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src) if (ub) { /* See if we already know about this one */ - std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); - while (i != _bundles_connected.end() && i->bundle != ub) { + std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); + while (i != _bundles_connected.end() && (*i)->bundle != ub) { ++i; } if (i == _bundles_connected.end()) { /* We don't, so make a note */ - _bundles_connected.push_back (UserBundleInfo (this, ub)); + _bundles_connected.push_back (new UserBundleInfo (this, ub)); } } } @@ -1194,12 +1193,13 @@ IO::disconnect_ports_from_bundle (boost::shared_ptr<Bundle> c, void* src) boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c); if (ub) { - std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); - while (i != _bundles_connected.end() && i->bundle != ub) { + std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); + while (i != _bundles_connected.end() && (*i)->bundle != ub) { ++i; } if (i != _bundles_connected.end()) { + delete *i; _bundles_connected.erase (i); } } @@ -1221,7 +1221,7 @@ int IO::enable_connecting () { connecting_legal = true; - return ConnectingLegal (); + return *ConnectingLegal (); } void @@ -1362,8 +1362,8 @@ IO::bundles_connected () BundleList bundles; /* User bundles */ - for (std::vector<UserBundleInfo>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { - bundles.push_back (i->bundle); + for (std::vector<UserBundleInfo*>::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { + bundles.push_back ((*i)->bundle); } /* Session bundles */ @@ -1399,9 +1399,7 @@ IO::bundles_connected () IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b) { bundle = b; - changed = b->Changed.connect ( - sigc::mem_fun (*io, &IO::bundle_changed) - ); + changed = b->Changed.connect (boost::bind (&IO::bundle_changed, io, _1)); } std::string diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 6bdac9fe19..91247d5082 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -24,7 +24,6 @@ #include <unistd.h> #include <sstream> -#include <sigc++/bind.h> #include "pbd/xml++.h" #include "pbd/enumwriter.h" @@ -89,7 +88,6 @@ IOProcessor::IOProcessor (Session& s, boost::shared_ptr<IO> in, boost::shared_pt IOProcessor::~IOProcessor () { - notify_callbacks (); } void diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index a242a76c31..b0d64ad41b 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -144,7 +144,7 @@ LadspaPlugin::~LadspaPlugin () deactivate (); cleanup (); - GoingAway (); /* EMIT SIGNAL */ + drop_references (); /* XXX who should close a plugin? */ diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 24e4628c0b..7e3330ecd9 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -25,7 +25,6 @@ #include <ctime> #include <list> -#include <sigc++/bind.h> #include "pbd/stl_delete.h" #include "pbd/xml++.h" diff --git a/libs/ardour/location_importer.cc b/libs/ardour/location_importer.cc index 6fb9f7b7db..655a8f1a84 100644 --- a/libs/ardour/location_importer.cc +++ b/libs/ardour/location_importer.cc @@ -143,7 +143,7 @@ LocationImporter::_prepare_move () std::pair<bool, string> rename_pair; if (location->is_auto_punch()) { - rename_pair = Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name); + rename_pair = *Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name); if (!rename_pair.first) { return false; } @@ -154,7 +154,7 @@ LocationImporter::_prepare_move () } if (location->is_auto_loop()) { - rename_pair = Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name); + rename_pair = *Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name); if (!rename_pair.first) { return false; } location->set_auto_loop (false, this); @@ -165,7 +165,7 @@ LocationImporter::_prepare_move () Locations::LocationList const & locations(session.locations()->list()); for (Locations::LocationList::const_iterator it = locations.begin(); it != locations.end(); ++it) { if (!((*it)->name().compare (location->name())) || !handler.check_name (location->name())) { - rename_pair = Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name); + rename_pair = *Rename (_("A location with that name already exists.\nYou may rename the imported location:"), name); if (!rename_pair.first) { return false; } name = rename_pair.second; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 2090d18e96..6c593a869a 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -181,7 +181,7 @@ LV2Plugin::~LV2Plugin () deactivate (); cleanup (); - GoingAway (); /* EMIT SIGNAL */ + drop_references (); slv2_instance_free(_instance); slv2_value_free(_name); diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 4566ed7e02..4ad0f58580 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -31,20 +31,20 @@ using namespace std; using namespace ARDOUR; -sigc::signal<void> Metering::Meter; +boost::signals2::signal<void()> Metering::Meter; Glib::StaticMutex Metering::m_meter_signal_lock; -sigc::connection -Metering::connect (sigc::slot<void> the_slot) +boost::signals2::connection +Metering::connect (boost::function<void()> 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 (the_slot); + return Meter.connect (f); } void -Metering::disconnect (sigc::connection& c) +Metering::disconnect (boost::signals2::connection& c) { Glib::Mutex::Lock guard (m_meter_signal_lock); c.disconnect (); diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index e2b83a1e65..12d25ac9ae 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -43,7 +43,8 @@ using namespace MIDI; using namespace PBD; MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn) - : ppqn (ppqn) + : port_connections (0) + , ppqn (ppqn) , bandwidth (30.0 / 60.0) // 1 BpM = 1 / 60 Hz { session = (ISlaveSessionProxy *) new SlaveSessionProxy(s); @@ -53,6 +54,7 @@ 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 { @@ -62,27 +64,27 @@ MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn) MIDIClock_Slave::~MIDIClock_Slave() { - delete session; + delete session; + delete port_connections; } void MIDIClock_Slave::rebind (MIDI::Port& p) { - for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) { - (*i).disconnect (); - } - + delete port_connections; + port_connections = new ScopedConnectionList; + port = &p; - #ifdef DEBUG_MIDI_CLOCK - std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl; - #endif +#ifdef DEBUG_MIDI_CLOCK + std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl; +#endif - connections.push_back (port->input()->timing.connect (sigc::mem_fun (*this, &MIDIClock_Slave::update_midi_clock))); - connections.push_back (port->input()->start.connect (sigc::mem_fun (*this, &MIDIClock_Slave::start))); - connections.push_back (port->input()->contineu.connect (sigc::mem_fun (*this, &MIDIClock_Slave::contineu))); - connections.push_back (port->input()->stop.connect (sigc::mem_fun (*this, &MIDIClock_Slave::stop))); - connections.push_back (port->input()->position.connect (sigc::mem_fun (*this, &MIDIClock_Slave::position))); + 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))); } void diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index f780948d69..6b181b1a27 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? */ } - region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region))); + scoped_connect (region->GoingAway, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region))); _last_capture_regions.push_back (region); diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 47bc14852c..baa3c2c7c0 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -267,7 +267,7 @@ MidiModel::DeltaCommand::set_state (const XMLNode& delta_command, int /*version* if (added_notes) { XMLNodeList notes = added_notes->children(); transform(notes.begin(), notes.end(), back_inserter(_added_notes), - sigc::mem_fun(*this, &DeltaCommand::unmarshal_note)); + boost::bind (&DeltaCommand::unmarshal_note, this, _1)); } _removed_notes.clear(); @@ -275,7 +275,7 @@ MidiModel::DeltaCommand::set_state (const XMLNode& delta_command, int /*version* if (removed_notes) { XMLNodeList notes = removed_notes->children(); transform(notes.begin(), notes.end(), back_inserter(_removed_notes), - sigc::mem_fun(*this, &DeltaCommand::unmarshal_note)); + boost::bind (&DeltaCommand::unmarshal_note, this, _1)); } return 0; @@ -288,14 +288,16 @@ MidiModel::DeltaCommand::get_state() delta_command->add_property("midi-source", _model->midi_source()->id().to_s()); XMLNode* added_notes = delta_command->add_child(ADDED_NOTES_ELEMENT); - for_each(_added_notes.begin(), _added_notes.end(), sigc::compose( - sigc::mem_fun(*added_notes, &XMLNode::add_child_nocopy), - sigc::mem_fun(*this, &DeltaCommand::marshal_note))); + for_each(_added_notes.begin(), _added_notes.end(), + boost::bind( + boost::bind (&XMLNode::add_child_nocopy, *added_notes, _1), + boost::bind (&DeltaCommand::marshal_note, this, _1))); XMLNode* removed_notes = delta_command->add_child(REMOVED_NOTES_ELEMENT); - for_each(_removed_notes.begin(), _removed_notes.end(), sigc::compose( - sigc::mem_fun(*removed_notes, &XMLNode::add_child_nocopy), - sigc::mem_fun(*this, &DeltaCommand::marshal_note))); + for_each(_removed_notes.begin(), _removed_notes.end(), + boost::bind ( + boost::bind (&XMLNode::add_child_nocopy, *removed_notes, _1), + boost::bind (&DeltaCommand::marshal_note, this, _1))); return *delta_command; } @@ -650,9 +652,9 @@ MidiModel::DiffCommand::set_state(const XMLNode& diff_command, int /*version*/) if (changed_notes) { XMLNodeList notes = changed_notes->children(); - transform (notes.begin(), notes.end(), back_inserter(_changes), - sigc::mem_fun(*this, &DiffCommand::unmarshal_change)); + boost::bind (&DiffCommand::unmarshal_change, this, _1)); + } return 0; @@ -665,9 +667,10 @@ MidiModel::DiffCommand::get_state () diff_command->add_property("midi-source", _model->midi_source()->id().to_s()); XMLNode* changes = diff_command->add_child(DIFF_NOTES_ELEMENT); - for_each(_changes.begin(), _changes.end(), sigc::compose( - sigc::mem_fun(*changes, &XMLNode::add_child_nocopy), - sigc::mem_fun(*this, &DiffCommand::marshal_change))); + for_each(_changes.begin(), _changes.end(), + boost::bind ( + boost::bind (&XMLNode::add_child_nocopy, *changes, _1), + boost::bind (&DiffCommand::marshal_change, this, _1))); return *diff_command; } diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc index 307655bff8..a2522fe997 100644 --- a/libs/ardour/midi_patch_manager.cc +++ b/libs/ardour/midi_patch_manager.cc @@ -18,7 +18,6 @@ $Id$ */ -#include <sigc++/sigc++.h> #include <boost/shared_ptr.hpp> #include "pbd/compose.h" @@ -41,11 +40,9 @@ using namespace PBD::sys; MidiPatchManager* MidiPatchManager::_manager = 0; void -MidiPatchManager::set_session (Session& s) +MidiPatchManager::set_session (Session* s) { - _session = &s; - _session->GoingAway.connect (sigc::mem_fun (*this, &MidiPatchManager::drop_session)); - + SessionHandlePtr::set_session (s); refresh(); } @@ -56,6 +53,10 @@ MidiPatchManager::refresh() _master_devices_by_model.clear(); _all_models.clear(); + if (!_session) { + return; + } + path path_to_patches = _session->session_directory().midi_patch_path(); if (!exists(path_to_patches)) { @@ -93,10 +94,8 @@ MidiPatchManager::refresh() } void -MidiPatchManager::drop_session () +MidiPatchManager::session_going_away () { - _session = 0; - _documents.clear(); - _master_devices_by_model.clear(); - _all_models.clear(); + SessionHandlePtr::session_going_away (); + refresh (); } diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index b230f6f6d5..a8e60ec866 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -23,7 +23,6 @@ #include <iostream> #include <stdlib.h> -#include <sigc++/bind.h> #include "evoral/EventList.hpp" @@ -72,11 +71,9 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes MidiPlaylist::~MidiPlaylist () { - GoingAway (); /* EMIT SIGNAL */ + drop_references (); /* drop connections to signals */ - - notify_callbacks (); } template<typename Time> diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index a722afd399..3b13d4db8d 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -24,8 +24,6 @@ #include <set> -#include <sigc++/bind.h> -#include <sigc++/class_slot.h> #include <glibmm/thread.h> @@ -54,7 +52,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> 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); - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); } /* Basic MidiRegion constructor (one channel) */ @@ -62,7 +60,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra : Region (src, start, length, name, DataType::MIDI, layer, flags) { assert(_name.find("/") == string::npos); - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); } /* Basic MidiRegion constructor (many channels) */ @@ -70,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); - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); } @@ -79,14 +77,14 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, nframes_t off : Region (other, offset, length, name, layer, flags) { assert(_name.find("/") == string::npos); - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); } MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other) : Region (other) { assert(_name.find("/") == string::npos); - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); } MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node) @@ -96,7 +94,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node) throw failed_constructor(); } - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, boost::bind (&MidiRegion::switch_source, this, _1)); assert(_name.find("/") == string::npos); assert(_type == DataType::MIDI); } @@ -108,7 +106,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node) throw failed_constructor(); } - midi_source(0)->Switched.connect(sigc::mem_fun(this, &MidiRegion::switch_source)); + scoped_connect (midi_source(0)->Switched, 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 2ece2f53ce..14b096c915 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; -sigc::signal<void,MidiSource *> MidiSource::MidiSourceCreated; +boost::signals2::signal<void(MidiSource*)> MidiSource::MidiSourceCreated; MidiSource::MidiSource (Session& s, string name, Source::Flag flags) : Source(s, DataType::MIDI, name, flags) @@ -260,7 +260,7 @@ MidiSource::session_saved() newsrc->flush_midi(); - Switched.emit(newsrc); + Switched (newsrc); /* EMIT SIGNAL */ } } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index ebbe231e62..179d0bb57c 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -17,9 +17,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pbd/error.h" -#include <sigc++/retype.h> -#include <sigc++/retype_return.h> -#include <sigc++/bind.h> #include "pbd/enumwriter.h" #include "midi++/events.h" @@ -233,7 +230,7 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base) pending_state = const_cast<XMLNode*> (&node); if (_session.state_of_the_state() & Session::Loading) { - _session.StateReady.connect (sigc::mem_fun (*this, &MidiTrack::set_state_part_two)); + scoped_connect (_session.StateReady, 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 1bb10d713f..db26ee8e83 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -18,6 +18,8 @@ */ #include <cstdlib> +#include <sigc++/signal.h> + #include "pbd/pthread_utils.h" #include "midi++/manager.h" @@ -44,7 +46,7 @@ MidiControlUI::MidiControlUI (Session& s) : AbstractUI<MidiUIRequest> (_("midiui")) , _session (s) { - MIDI::Manager::instance()->PortsChanged.connect (sigc::mem_fun (*this, &MidiControlUI::change_midi_ports)); + rebind_connection = MIDI::Manager::instance()->PortsChanged.connect (boost::bind (&MidiControlUI::change_midi_ports, this)); } MidiControlUI::~MidiControlUI () @@ -125,7 +127,7 @@ MidiControlUI::reset_ports () if ((fd = (*i)->selectable ()) >= 0) { Glib::RefPtr<IOSource> psrc = IOSource::create (fd, IO_IN|IO_HUP|IO_ERR); - psrc->connect (sigc::bind (sigc::mem_fun (*this, &MidiControlUI::midi_input_handler), (*i))); + psrc->connect (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *i)); psrc->attach (_main_loop->get_context()); // glibmm hack: for now, store only the GSource* diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 3e06efa56f..50ef5011ba 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -52,6 +52,7 @@ 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; @@ -70,9 +71,12 @@ 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); } + delete pic; delete [] speed_accumulator; } @@ -87,15 +91,14 @@ MTC_Slave::give_slave_full_control_over_transport_speed() const void MTC_Slave::rebind (MIDI::Port& p) { - for (vector<sigc::connection>::iterator i = connections.begin(); i != connections.end(); ++i) { - (*i).disconnect (); - } - + delete port_connections; + port_connections = new ScopedConnectionList; + port = &p; - - connections.push_back (port->input()->mtc_time.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_time))); - connections.push_back (port->input()->mtc_qtr.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_qtr))); - connections.push_back (port->input()->mtc_status.connect (sigc::mem_fun (*this, &MTC_Slave::update_mtc_status))); + + 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))); } void diff --git a/libs/ardour/named_selection.cc b/libs/ardour/named_selection.cc index 5353d1e824..81e9f9df8a 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; -sigc::signal<void,NamedSelection*> NamedSelection::NamedSelectionCreated; +boost::signals2::signal<void(NamedSelection*)> NamedSelection::NamedSelectionCreated; typedef std::list<boost::shared_ptr<Playlist> > PlaylistList; @@ -102,7 +102,7 @@ NamedSelection::~NamedSelection () { for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) { (*i)->release (); - (*i)->GoingAway (); + (*i)->drop_references (); } } diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 29beb7c6b7..b93e2b311a 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -25,7 +25,6 @@ #include <string> #include <climits> -#include <sigc++/bind.h> #include "pbd/failed_constructor.h" #include "pbd/stl_delete.h" @@ -116,7 +115,9 @@ Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide } Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, bool hide) - : SessionObject(other->_session, namestr), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id) + : SessionObject(other->_session, namestr) + , _type(other->_type) + , _orig_diskstream_id(other->_orig_diskstream_id) { init (hide); @@ -148,7 +149,9 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo } Playlist::Playlist (boost::shared_ptr<const Playlist> other, nframes_t start, nframes_t cnt, string str, bool hide) - : SessionObject(other->_session, str), _type(other->_type), _orig_diskstream_id(other->_orig_diskstream_id) + : SessionObject(other->_session, str) + , _type(other->_type) + , _orig_diskstream_id(other->_orig_diskstream_id) { RegionLock rlock2 (const_cast<Playlist*> (other.get())); @@ -267,12 +270,13 @@ Playlist::init (bool hide) freeze_length = 0; _explicit_relayering = false; - Modified.connect (sigc::mem_fun (*this, &Playlist::mark_session_dirty)); + scoped_connect (Modified, boost::bind (&Playlist::mark_session_dirty, this)); } Playlist::~Playlist () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("Playlist %1 destructor\n", _name)); + { RegionLock rl (this); @@ -601,10 +605,8 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit } } - region_state_changed_connections.push_back ( - region->StateChanged.connect (sigc::bind (sigc::mem_fun (this, &Playlist::region_changed_proxy), - boost::weak_ptr<Region> (region))) - ); + region_state_changed_connections.add_connection + (region->StateChanged.connect (boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)))); return true; } @@ -1318,7 +1320,6 @@ Playlist::region_changed_proxy (Change what_changed, boost::weak_ptr<Region> wea return; } - /* this makes a virtual call to the right kind of playlist ... */ region_changed (what_changed, region); @@ -1369,13 +1370,7 @@ Playlist::clear (bool with_signals) { RegionLock rl (this); - for ( - std::list<sigc::connection>::iterator i = region_state_changed_connections.begin (); - i != region_state_changed_connections.end (); - ++i - ) { - i->disconnect (); - } + region_state_changed_connections.drop_connections (); for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { pending_removes.insert (*i); @@ -2493,7 +2488,7 @@ Playlist::update_after_tempo_map_change () } void -Playlist::foreach_region (sigc::slot<void, boost::shared_ptr<Region> > s) +Playlist::foreach_region (boost::function<void(boost::shared_ptr<Region>)> s) { RegionLock rl (this, false); for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc index 554c36df17..cfcec40d1b 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; -sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistFactory::PlaylistCreated; +boost::signals2::signal<void(boost::shared_ptr<Playlist>, bool)> PlaylistFactory::PlaylistCreated; boost::shared_ptr<Playlist> PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unused) diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index f41d6bbc25..c2bf7f3562 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -23,7 +23,6 @@ #include <string> -#include <sigc++/bind.h> #include "pbd/failed_constructor.h" #include "pbd/xml++.h" @@ -131,7 +130,7 @@ PluginInsert::set_count (uint32_t num) PluginInsert::~PluginInsert () { - GoingAway (); /* EMIT SIGNAL */ + drop_references (); } void diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index eccd5f29f9..044230e1f7 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -19,7 +19,6 @@ #include <string> -#include <sigc++/bind.h> #include "pbd/failed_constructor.h" #include "pbd/xml++.h" @@ -62,7 +61,7 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLN PortInsert::~PortInsert () { - GoingAway (); + drop_references (); } void diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 3bc9db024b..54701ae8d4 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -23,7 +23,6 @@ #include <string> -#include <sigc++/bind.h> #include "pbd/failed_constructor.h" #include "pbd/enumwriter.h" @@ -57,7 +56,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -sigc::signal<void,Processor*> Processor::ProcessorCreated; +boost::signals2::signal<void(Processor*)> Processor::ProcessorCreated; // Always saved as Processor, but may be IOProcessor or Send in legacy sessions const string Processor::state_node_name = "Processor"; @@ -269,7 +268,7 @@ Processor::configure_io (ChanCount in, ChanCount out) _configured_output = out; _configured = true; - ConfigurationChanged.emit (in, out); + ConfigurationChanged (in, out); /* EMIT SIGNAL */ return true; } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 2c4d8004cf..4fcb7de3ca 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -23,8 +23,6 @@ #include <algorithm> #include <sstream> -#include <sigc++/bind.h> -#include <sigc++/class_slot.h> #include <glibmm/thread.h> #include "pbd/xml++.h" @@ -56,7 +54,7 @@ Change Region::LockChanged = ARDOUR::new_change (); Change Region::LayerChanged = ARDOUR::new_change (); Change Region::HiddenChanged = ARDOUR::new_change (); -sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > Region::RegionPropertyChanged; +boost::signals2::signal<void(boost::shared_ptr<ARDOUR::Region>)> 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) @@ -111,7 +109,7 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length _sources.push_back (src); _master_sources.push_back (src); - src->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), src)); + scoped_connect (src->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src))); assert(_sources.size() > 0); _positional_lock_style = AudioTime; @@ -340,7 +338,6 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node) Region::~Region () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this)); - notify_callbacks (); drop_references (); } @@ -1416,9 +1413,10 @@ Region::region_list_equivalent (boost::shared_ptr<const Region> other) const } void -Region::source_deleted (boost::shared_ptr<Source>) +Region::source_deleted (boost::weak_ptr<Source>) { _sources.clear (); + cerr << "Send drop ref signal from region " << ' ' << this << endl; drop_references (); } @@ -1588,14 +1586,14 @@ Region::use_sources (SourceList const & s) for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) { _sources.push_back (*i); - (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i)); + scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*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()) { - (*i)->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Region::source_deleted), *i)); + scoped_connect ((*i)->GoingAway, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i))); } } } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 91cc2dbe2a..ff4b9d5270 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -34,7 +34,7 @@ using namespace ARDOUR; using namespace PBD; -sigc::signal<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion; +boost::signals2::signal<void(boost::shared_ptr<Region>)> RegionFactory::CheckNewRegion; boost::shared_ptr<Region> RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start, diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index 82d1cf6ff2..991c6ae7d1 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -67,7 +67,7 @@ Return::Return (Session& s, const XMLNode& node, bool internal) Return::~Return () { - GoingAway (); + drop_references (); } XMLNode& diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 3390245828..154c5fd0a0 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -22,7 +22,6 @@ #include <cassert> #include <algorithm> -#include <sigc++/bind.h> #include "pbd/xml++.h" #include "pbd/enumwriter.h" #include "pbd/memento_command.h" @@ -64,7 +63,7 @@ using namespace ARDOUR; using namespace PBD; uint32_t Route::order_key_cnt = 0; -sigc::signal<void, string const &> Route::SyncOrderKeys; +boost::signals2::signal<void(string const&)> Route::SyncOrderKeys; Route::Route (Session& sess, string name, Flag flg, DataType default_type) : SessionObject (sess, name) @@ -94,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 */ - _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter)); + scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this))); } Route::Route (Session& sess, const XMLNode& node, DataType default_type) @@ -110,7 +109,7 @@ Route::Route (Session& sess, const XMLNode& node, DataType default_type) /* now that we have _meter, its safe to connect to this */ - _meter_connection = Metering::connect (sigc::mem_fun (*this, &Route::meter)); + scoped_connect (Metering::Meter, (boost::bind (&Route::meter, this))); } void @@ -148,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)); - _input->changed.connect (sigc::mem_fun (this, &Route::input_change_handler)); - _output->changed.connect (sigc::mem_fun (this, &Route::output_change_handler)); + 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)); /* add amp processor */ @@ -160,7 +159,6 @@ Route::init () Route::~Route () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("route %1 destructor\n", _name)); - Metering::disconnect (_meter_connection); /* don't use clear_processors here, as it depends on the session which may be half-destroyed by now */ @@ -794,7 +792,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite // XXX: do we want to emit the signal here ? change call order. processor->activate (); } - processor->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false)); + scoped_connect (processor->ActiveChanged, boost::bind (&Session::update_latency_compensation, &_session, false, false)); _output->set_user_latency (0); } @@ -1049,7 +1047,7 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter return -1; } - (*i)->ActiveChanged.connect (sigc::bind (sigc::mem_fun (_session, &Session::update_latency_compensation), false, false)); + scoped_connect ((*i)->ActiveChanged, 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 3d98c61548..82953be0f8 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -22,7 +22,6 @@ #include <algorithm> -#include <sigc++/bind.h> #include "pbd/error.h" #include "pbd/enumwriter.h" @@ -77,7 +76,7 @@ RouteGroup::add (boost::shared_ptr<Route> r) routes->push_back (r); r->join_route_group (this); - r->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &RouteGroup::remove_when_going_away), boost::weak_ptr<Route> (r))); + scoped_connect (r->GoingAway, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r))); _session.set_dirty (); changed (); /* EMIT SIGNAL */ diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 6117b09be2..1bb03642d0 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -64,7 +64,7 @@ Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, i Send::~Send () { - GoingAway (); + drop_references (); } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index fbe8edfa80..d8e3b2843c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -28,8 +28,6 @@ #include <unistd.h> #include <limits.h> -#include <sigc++/bind.h> -#include <sigc++/retype.h> #include <glibmm/thread.h> #include <glibmm/miscutils.h> @@ -105,17 +103,17 @@ using boost::weak_ptr; bool Session::_disable_all_loaded_plugins = false; -sigc::signal<void,std::string> Session::Dialog; -sigc::signal<int> Session::AskAboutPendingState; -sigc::signal<int,nframes_t,nframes_t> Session::AskAboutSampleRateMismatch; -sigc::signal<void> Session::SendFeedback; +boost::signals2::signal<void(std::string)> Session::Dialog; +boost::signals2::signal<int()> Session::AskAboutPendingState; +boost::signals2::signal<int(nframes_t,nframes_t)> Session::AskAboutSampleRateMismatch; +boost::signals2::signal<void()> Session::SendFeedback; -sigc::signal<void> Session::TimecodeOffsetChanged; -sigc::signal<void> Session::StartTimeChanged; -sigc::signal<void> Session::EndTimeChanged; -sigc::signal<void> Session::AutoBindingOn; -sigc::signal<void> Session::AutoBindingOff; -sigc::signal<void, std::string, std::string> Session::Exported; +boost::signals2::signal<void()> Session::TimecodeOffsetChanged; +boost::signals2::signal<void()> Session::StartTimeChanged; +boost::signals2::signal<void()> Session::EndTimeChanged; +boost::signals2::signal<void()> Session::AutoBindingOn; +boost::signals2::signal<void()> Session::AutoBindingOff; +boost::signals2::signal<void(std::string, std::string)> Session::Exported; static void clean_up_session_event (SessionEvent* ev) { delete ev; } const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event); @@ -138,7 +136,7 @@ Session::Session (AudioEngine &eng, _midi_clock_port (default_midi_clock_port), _session_dir (new SessionDirectory(fullpath)), state_tree (0), - _butler (new Butler (this)), + _butler (new Butler (*this)), _post_transport_work (0), _send_timecode_update (false), diskstreams (new DiskstreamList), @@ -191,8 +189,8 @@ Session::Session (AudioEngine &eng, _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false)); - config.ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), true)); + scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false)); + scoped_connect (config.ParameterChanged, boost::bind (&Session::config_changed, this, _1, true)); if (was_dirty) { DirtyChanged (); /* EMIT SIGNAL */ @@ -223,7 +221,7 @@ Session::Session (AudioEngine &eng, _midi_clock_port (default_midi_clock_port), _session_dir ( new SessionDirectory(fullpath)), state_tree (0), - _butler (new Butler (this)), + _butler (new Butler (*this)), _post_transport_work (0), _send_timecode_update (false), diskstreams (new DiskstreamList), @@ -280,7 +278,9 @@ Session::Session (AudioEngine &eng, if (master_out_channels) { ChanCount count(DataType::AUDIO, master_out_channels); - shared_ptr<Route> r (new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO)); + Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO); + boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name()); + shared_ptr<Route> r (rt); r->input()->ensure_io (count, false, this); r->output()->ensure_io (count, false, this); r->set_remote_control_id (control_id); @@ -293,7 +293,9 @@ Session::Session (AudioEngine &eng, if (control_out_channels) { ChanCount count(DataType::AUDIO, control_out_channels); - shared_ptr<Route> r (new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO)); + Route* rt = new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO); + boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name()); + shared_ptr<Route> r (rt); r->input()->ensure_io (count, false, this); r->output()->ensure_io (count, false, this); r->set_remote_control_id (control_id++); @@ -324,7 +326,7 @@ Session::Session (AudioEngine &eng, _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - Config->ParameterChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::config_changed), false)); + scoped_connect (Config->ParameterChanged, boost::bind (&Session::config_changed, this, _1, false)); } Session::~Session () @@ -347,12 +349,6 @@ Session::destroy () _engine.remove_session (); - GoingAway (); /* EMIT SIGNAL */ - - /* do this */ - - notify_callbacks (); - /* clear history so that no references to objects are held any more */ _history.clear (); @@ -391,7 +387,7 @@ Session::destroy () AudioDiskstream::free_working_buffers(); - Route::SyncOrderKeys.clear(); + // BOOST::SIGNALS: Route::SyncOrderKeys.clear(); DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n"); for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ) { @@ -410,6 +406,8 @@ Session::destroy () tmp = i; ++tmp; + + boost::shared_ptr<Region> keep (i->second); DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 (%2); pre-ref = %3\n", i->second->name(), i->second.get(), i->second.use_count())); i->second->drop_references (); @@ -479,6 +477,10 @@ Session::destroy () /* not strictly necessary, but doing it here allows the shared_ptr debugging to work */ playlists.reset (); + /* tell everyone who is still standing that we're about to die */ + + drop_references (); + boost_debug_list_ptrs (); DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n"); @@ -522,7 +524,7 @@ Session::when_engine_running () /* every time we reconnect, recompute worst case output latencies */ - _engine.Running.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies)); + scoped_connect (_engine.Running, boost::bind (&Session::set_worst_io_latencies, this)); if (synced_to_jack()) { _engine.transport_stop (); @@ -876,7 +878,7 @@ Session::diskstream_playlist_changed (boost::weak_ptr<Diskstream> wp) boost::shared_ptr<Playlist> playlist; if ((playlist = dstream->playlist()) != 0) { - playlist->LengthChanged.connect (sigc::mem_fun (this, &Session::playlist_length_changed)); + scoped_connect (playlist->LengthChanged, boost::bind (&Session::playlist_length_changed, this)); } /* see comment in playlist_length_changed () */ @@ -992,9 +994,7 @@ Session::set_auto_punch_location (Location* location) Location* existing; if ((existing = _locations.auto_punch_location()) != 0 && existing != location) { - auto_punch_start_changed_connection.disconnect(); - auto_punch_end_changed_connection.disconnect(); - auto_punch_changed_connection.disconnect(); + punch_connections.drop_connections(); existing->set_auto_punch (false, this); remove_event (existing->start(), SessionEvent::PunchIn); clear_events (SessionEvent::PunchOut); @@ -1012,17 +1012,14 @@ Session::set_auto_punch_location (Location* location) return; } - auto_punch_start_changed_connection.disconnect(); - auto_punch_end_changed_connection.disconnect(); - auto_punch_changed_connection.disconnect(); + punch_connections.drop_connections (); - auto_punch_start_changed_connection = location->start_changed.connect (sigc::mem_fun (this, &Session::auto_punch_start_changed)); - auto_punch_end_changed_connection = location->end_changed.connect (sigc::mem_fun (this, &Session::auto_punch_end_changed)); - auto_punch_changed_connection = location->changed.connect (sigc::mem_fun (this, &Session::auto_punch_changed)); + 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->set_auto_punch (true, this); - auto_punch_changed (location); auto_punch_location_changed (location); @@ -1034,9 +1031,7 @@ Session::set_auto_loop_location (Location* location) Location* existing; if ((existing = _locations.auto_loop_location()) != 0 && existing != location) { - auto_loop_start_changed_connection.disconnect(); - auto_loop_end_changed_connection.disconnect(); - auto_loop_changed_connection.disconnect(); + loop_connections.drop_connections (); existing->set_auto_loop (false, this); remove_event (existing->end(), SessionEvent::AutoLoop); auto_loop_location_changed (0); @@ -1055,16 +1050,11 @@ Session::set_auto_loop_location (Location* location) last_loopend = location->end(); - auto_loop_start_changed_connection.disconnect(); - auto_loop_end_changed_connection.disconnect(); - auto_loop_changed_connection.disconnect(); + loop_connections.drop_connections (); - auto_loop_start_changed_connection = location->start_changed.connect ( - sigc::mem_fun (this, &Session::auto_loop_changed)); - auto_loop_end_changed_connection = location->end_changed.connect ( - sigc::mem_fun (this, &Session::auto_loop_changed)); - auto_loop_changed_connection = location->changed.connect ( - sigc::mem_fun (this, &Session::auto_loop_changed)); + 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->set_auto_loop (true, this); @@ -1658,7 +1648,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m route_group->add (track); } - track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes)); + scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this)); //track->set_remote_control_id (control_id); new_routes.push_back (track); @@ -1771,7 +1761,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod try { AudioTrack* at = new AudioTrack (*this, track_name, Route::Flag (0), mode); - // boost_debug_shared_ptr_mark_interesting (at, typeid (at).name()); + boost_debug_shared_ptr_mark_interesting (at, typeid (at).name()); track = boost::shared_ptr<AudioTrack>(at); if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { @@ -1833,7 +1823,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod track->audio_diskstream()->non_realtime_input_change(); - track->DiskstreamChanged.connect (sigc::mem_fun (this, &Session::resort_routes)); + scoped_connect (track->DiskstreamChanged, boost::bind (&Session::resort_routes, this)); track->set_remote_control_id (control_id); ++control_id; @@ -1961,7 +1951,9 @@ Session::new_audio_route (bool aux, int input_channels, int output_channels, Rou } while (bus_id < (UINT_MAX-1)); try { - shared_ptr<Route> bus (new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO)); + Route* rt = new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO); + boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name()); + shared_ptr<Route> bus (rt); if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), @@ -2158,12 +2150,12 @@ Session::add_routes (RouteList& new_routes, bool save) boost::weak_ptr<Route> wpr (*x); - (*x)->listen_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_listen_changed), wpr)); - (*x)->solo_changed.connect (sigc::bind (sigc::mem_fun (*this, &Session::route_solo_changed), wpr)); - (*x)->mute_changed.connect (sigc::mem_fun (*this, &Session::route_mute_changed)); - (*x)->output()->changed.connect (sigc::mem_fun (*this, &Session::set_worst_io_latencies_x)); - (*x)->processors_changed.connect (sigc::mem_fun (*this, &Session::route_processors_changed)); - (*x)->route_group_changed.connect (sigc::mem_fun (*this, &Session::route_group_changed)); + 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)); if ((*x)->is_master()) { _master_out = (*x); @@ -2303,11 +2295,11 @@ Session::add_diskstream (boost::shared_ptr<Diskstream> dstream) /* writer goes out of scope, copies ds back to main */ } - dstream->PlaylistChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::diskstream_playlist_changed), boost::weak_ptr<Diskstream> (dstream))); + scoped_connect (dstream->PlaylistChanged, boost::bind (&Session::diskstream_playlist_changed, this, boost::weak_ptr<Diskstream> (dstream))); /* this will connect to future changes, and check the current length */ diskstream_playlist_changed (boost::weak_ptr<Diskstream> (dstream)); - dstream->RecordEnableChanged.connect (sigc::mem_fun (*this, &Session::update_have_rec_enabled_diskstream)); + scoped_connect (dstream->RecordEnableChanged, boost::bind (&Session::update_have_rec_enabled_diskstream, this)); dstream->prepare (); @@ -2821,8 +2813,8 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions) } } - region->StateChanged.connect (sigc::bind (sigc::mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region))); - region->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region))); + scoped_connect (region->StateChanged, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region))); + scoped_connect (region->GoingAway, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region))); update_region_name_map (region); } @@ -3010,7 +3002,7 @@ Session::add_source (boost::shared_ptr<Source> source) } if (result.second) { - source->GoingAway.connect (sigc::bind (sigc::mem_fun (this, &Session::remove_source), boost::weak_ptr<Source> (source))); + scoped_connect (source->GoingAway, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source))); set_dirty(); } @@ -3401,7 +3393,7 @@ Session::add_playlist (boost::shared_ptr<Playlist> playlist, bool unused) bool existing = playlists->add (playlist); if (!existing) { - playlist->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_playlist), boost::weak_ptr<Playlist>(playlist))); + scoped_connect (playlist->GoingAway, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist))); } if (unused) { @@ -3492,8 +3484,8 @@ Session::remove_empty_sounds () TapeFileMatcher tape_file_matcher; remove_if (audio_filenames.begin(), audio_filenames.end(), - sigc::mem_fun (tape_file_matcher, &TapeFileMatcher::matches)); - + boost::bind (&TapeFileMatcher::matches, &tape_file_matcher, _1)); + for (vector<string>::iterator i = audio_filenames.begin(); i != audio_filenames.end(); ++i) { sys::path audio_file_path (_session_dir->sound_path()); @@ -3575,7 +3567,7 @@ Session::graph_reordered () void Session::add_processor (Processor* processor) { - processor->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &Session::remove_processor), processor)); + scoped_connect (processor->GoingAway, boost::bind (&Session::remove_processor, this, processor)); set_dirty(); } diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 4d733264fb..828af69901 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -43,7 +43,7 @@ using namespace ARDOUR; #include "i18n.h" -void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulThingWithGoingAway *ptr) +void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulDestructible *ptr) { registry[id] = ptr; } @@ -114,8 +114,8 @@ Session::memento_command_factory(XMLNode *n) if (i != automation_lists.end()) { return new MementoCommand<AutomationList>(*i->second, before, after); } - } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits here - return new MementoCommand<PBD::StatefulThingWithGoingAway>(*registry[id], before, after); + } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits herea + return new MementoCommand<PBD::StatefulDestructible>(*registry[id], before, after); } /* we failed */ diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index da18ceb3cb..8b56271e42 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -17,7 +17,6 @@ */ -#include <sigc++/bind.h> #include "pbd/error.h" #include <glibmm/thread.h> @@ -92,8 +91,8 @@ Session::pre_export () _exporting = true; export_status->running = true; - export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export))); - export_status->Finished.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::finalize_audio_export))); + scoped_connect (export_status->Aborting, boost::bind (&Session::stop_audio_export, this)); + scoped_connect (export_status->Finished, boost::bind (&Session::finalize_audio_export, this)); return 0; } @@ -151,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 (sigc::mem_fun (*this, &Session::process_export_fw)); + export_freewheel_connection = _engine.Freewheel.connect (boost::bind (&Session::process_export_fw, this, _1)); return _engine.freewheel (true); } @@ -180,7 +179,7 @@ Session::process_export (nframes_t nframes) process_without_events (nframes); - /* handle export */ + /* handle export - XXX what about error handling? */ ProcessExport (nframes); @@ -236,8 +235,11 @@ Session::finalize_audio_export () /* Clean up */ - ProcessExport.clear(); - ExportReadFinished.clear(); + /* BOOST SIGNAL are these necessary? + ProcessExport.clear(); + ExportReadFinished.clear(); + */ + export_freewheel_connection.disconnect(); export_handler.reset(); export_status.reset(); diff --git a/libs/ardour/session_handle.cc b/libs/ardour/session_handle.cc new file mode 100644 index 0000000000..03671cfa68 --- /dev/null +++ b/libs/ardour/session_handle.cc @@ -0,0 +1,73 @@ +/* + 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/error.h" + +#include "ardour/session.h" +#include "ardour/session_handle.h" + +#include "i18n.h" + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +SessionHandlePtr::SessionHandlePtr (Session* s) + : _session (s) +{ + if (_session) { + _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this))); + } +} + +void +SessionHandlePtr::set_session (Session* s) +{ + _session_connections.drop_connections (); + + if (_session) { + _session = 0; + } + + if (s) { + _session = s; + _session_connections.add_connection (_session->GoingAway.connect (boost::bind (&SessionHandlePtr::session_going_away, this))); + } +} + +void +SessionHandlePtr::session_going_away () +{ + set_session (0); +} + +/*-------------------------*/ + + +SessionHandleRef::SessionHandleRef (Session& s) + : _session (s) +{ + scoped_connect (_session.GoingAway, boost::bind (&SessionHandleRef::session_going_away, this)); +} + +void +SessionHandleRef::session_going_away () +{ + error << string_compose (_("programming error: %1"), "SessionHandleRef exists across sesssion deletion!") << endmsg; +} diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index d006097f09..b2cece991c 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -208,39 +208,26 @@ Session::set_mmc_port (string port_tag) mmc->set_send_device_id (old_send_device_id); } - mmc->Play.connect - (sigc::mem_fun (*this, &Session::mmc_deferred_play)); - mmc->DeferredPlay.connect - (sigc::mem_fun (*this, &Session::mmc_deferred_play)); - mmc->Stop.connect - (sigc::mem_fun (*this, &Session::mmc_stop)); - mmc->FastForward.connect - (sigc::mem_fun (*this, &Session::mmc_fast_forward)); - mmc->Rewind.connect - (sigc::mem_fun (*this, &Session::mmc_rewind)); - mmc->Pause.connect - (sigc::mem_fun (*this, &Session::mmc_pause)); - mmc->RecordPause.connect - (sigc::mem_fun (*this, &Session::mmc_record_pause)); - mmc->RecordStrobe.connect - (sigc::mem_fun (*this, &Session::mmc_record_strobe)); - mmc->RecordExit.connect - (sigc::mem_fun (*this, &Session::mmc_record_exit)); - mmc->Locate.connect - (sigc::mem_fun (*this, &Session::mmc_locate)); - mmc->Step.connect - (sigc::mem_fun (*this, &Session::mmc_step)); - mmc->Shuttle.connect - (sigc::mem_fun (*this, &Session::mmc_shuttle)); - mmc->TrackRecordStatusChange.connect - (sigc::mem_fun (*this, &Session::mmc_record_enable)); + 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)); /* also handle MIDI SPP because its so common */ - _mmc_port->input()->start.connect (sigc::mem_fun (*this, &Session::spp_start)); - _mmc_port->input()->contineu.connect (sigc::mem_fun (*this, &Session::spp_continue)); - _mmc_port->input()->stop.connect (sigc::mem_fun (*this, &Session::spp_stop)); + 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)); Config->set_mmc_port_name (port_tag); diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index 5af0dc4caa..ec9220ed41 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -16,6 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <vector> #include "pbd/xml++.h" #include "pbd/compose.h" @@ -73,7 +74,7 @@ SessionPlaylists::add (boost::shared_ptr<Playlist> playlist) if (!existing) { playlists.insert (playlists.begin(), playlist); - playlist->InUse.connect (sigc::bind (sigc::mem_fun (*this, &SessionPlaylists::track), boost::weak_ptr<Playlist>(playlist))); + scoped_connect (playlist->InUse, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist))); } return existing; @@ -265,7 +266,7 @@ SessionPlaylists::add_state (XMLNode* node, bool full_state) /** @return true for `stop cleanup', otherwise false */ bool -SessionPlaylists::maybe_delete_unused (sigc::signal<int, boost::shared_ptr<Playlist> > ask) +SessionPlaylists::maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)> ask) { vector<boost::shared_ptr<Playlist> > playlists_tbd; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 3364de9815..4c7515f5e4 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -30,7 +30,6 @@ #include <string> #include <cerrno> -#include <sigc++/bind.h> #include <cstdio> /* snprintf(3) ... grrr */ #include <cmath> @@ -165,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); - _tempo_map->StateChanged.connect (sigc::mem_fun (*this, &Session::tempo_map_changed)); + scoped_connect (_tempo_map->StateChanged, boost::bind (&Session::tempo_map_changed, this, _1)); _non_soloed_outs_muted = false; @@ -267,20 +266,21 @@ Session::first_stage_init (string fullpath, string snapshot_name) delta_accumulator_cnt = 0; _slave_state = Stopped; - _engine.GraphReordered.connect (sigc::mem_fun (*this, &Session::graph_reordered)); + scoped_connect (_engine.GraphReordered, boost::bind (&Session::graph_reordered, this)); /* These are all static "per-class" signals */ - RegionFactory::CheckNewRegion.connect (sigc::mem_fun (*this, &Session::add_region)); - SourceFactory::SourceCreated.connect (sigc::mem_fun (*this, &Session::add_source)); - PlaylistFactory::PlaylistCreated.connect (sigc::mem_fun (*this, &Session::add_playlist)); - Processor::ProcessorCreated.connect (sigc::mem_fun (*this, &Session::add_processor)); - NamedSelection::NamedSelectionCreated.connect (sigc::mem_fun (*this, &Session::add_named_selection)); - AutomationList::AutomationListCreated.connect (sigc::mem_fun (*this, &Session::add_automation_list)); + 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)); - Controllable::Destroyed.connect (sigc::mem_fun (*this, &Session::remove_controllable)); + // BOOST SIGNALS + // scoped_connect (Controllable::Destroyed, boost::bind (&Session::remove_controllable, this, _1)); - IO::PortCountChanged.connect (sigc::mem_fun (*this, &Session::ensure_buffers)); + scoped_connect (IO::PortCountChanged, 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); - _locations.changed.connect (sigc::mem_fun (this, &Session::locations_changed)); - _locations.added.connect (sigc::mem_fun (this, &Session::locations_added)); + scoped_connect (_locations.changed, boost::bind (&Session::locations_changed, this)); + scoped_connect (_locations.added, boost::bind (&Session::locations_added, this, _1)); setup_click_sounds (0); setup_midi_control (); /* Pay attention ... */ - _engine.Halted.connect (sigc::mem_fun (*this, &Session::engine_halted)); - _engine.Xrun.connect (sigc::mem_fun (*this, &Session::xrun_recovery)); + scoped_connect (_engine.Halted, boost::bind (&Session::engine_halted, this)); + scoped_connect (_engine.Xrun, boost::bind (&Session::xrun_recovery, this)); try { when_engine_running(); @@ -364,14 +364,14 @@ Session::second_stage_init (bool new_session) deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0); deliver_mmc (MIDI::MachineControl::cmdLocate, 0); - MidiClockTicker::instance().set_session(*this); - MIDI::Name::MidiPatchManager::instance().set_session(*this); + MidiClockTicker::instance().set_session (this); + MIDI::Name::MidiPatchManager::instance().set_session (this); /* initial program change will be delivered later; see ::config_changed() */ BootMessage (_("Reset Control Protocols")); - ControlProtocolManager::instance().set_session (*this); + ControlProtocolManager::instance().set_session (this); config.set_end_marker_is_free (new_session); @@ -2311,11 +2311,12 @@ Session::cleanup_sources (CleanupReport& rep) /* step 1: consider deleting all unused playlists */ - if (playlists->maybe_delete_unused (AskAboutPlaylistDeletion)) { +/* BOOST SIGNALS + if (playlists->maybe_delete_unused (boost::bind (AskAboutPlaylistDeletion, _1)); ret = 0; goto out; } - +*/ /* step 2: find all un-used sources */ rep.paths.clear (); @@ -2334,7 +2335,7 @@ Session::cleanup_sources (CleanupReport& rep) if (!playlists->source_use_count(i->second) && i->second->length(i->second->timeline_position()) > 0) { dead_sources.push_back (i->second); - i->second->GoingAway(); + i->second->drop_references (); } i = tmp; @@ -2653,8 +2654,7 @@ Session::remove_controllable (Controllable* c) Glib::Mutex::Lock lm (controllables_lock); - Controllables::iterator x = controllables.find( - boost::shared_ptr<Controllable>(c, null_deleter())); + Controllables::iterator x = controllables.find (boost::shared_ptr<Controllable>(c, null_deleter())); if (x != controllables.end()) { controllables.erase (x); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 63bb4c4213..0e808accb7 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -21,8 +21,6 @@ #include <cerrno> #include <unistd.h> -#include <sigc++/bind.h> -#include <sigc++/retype.h> #include "pbd/undo.h" #include "pbd/error.h" diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 7f66486425..64cad0f2b6 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -193,7 +193,7 @@ SndFileSource::init_sndfile () } AudioFileSource::HeaderPositionOffsetChanged.connect ( - sigc::mem_fun (*this, &SndFileSource::handle_header_position_change)); + boost::bind (&SndFileSource::handle_header_position_change, this)); } int @@ -247,7 +247,7 @@ SndFileSource::open () SndFileSource::~SndFileSource () { - GoingAway (); /* EMIT SIGNAL */ + drop_references (); if (sf) { sf_close (sf); diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 958bc2c1b5..a8c4262a66 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -76,7 +76,6 @@ Source::Source (Session& s, const XMLNode& node) Source::~Source () { DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor\n", _name)); - notify_callbacks (); } diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index a44a372726..e401b010ea 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; -sigc::signal<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated; +boost::signals2::signal<void(boost::shared_ptr<Source>)> SourceFactory::SourceCreated; Glib::Cond* SourceFactory::PeaksToBuild; Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT; std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 2dc5eeaada..9536576713 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -24,7 +24,6 @@ #include <cmath> -#include <sigc++/bind.h> #include <glibmm/thread.h> #include "pbd/xml++.h" diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index ab0a7144a8..0a6bb8b20b 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -27,37 +27,37 @@ using namespace std; #endif -namespace ARDOUR -{ - +using namespace ARDOUR; -void Ticker::set_session(Session& s) +void Ticker::set_session (Session* s) { - _session = &s; + SessionHandlePtr::set_session (s); - if (_session) { - _session->tick.connect(sigc::mem_fun (*this, &Ticker::tick)); - _session->GoingAway.connect(sigc::mem_fun (*this, &Ticker::going_away)); - } + if (_session) { + _session_connections.add_connection (_session->tick.connect (boost::bind (&Ticker::tick, this, _1, _2, _3))); + } } -void MidiClockTicker::set_session(Session& s) +void MidiClockTicker::set_session (Session* s) { - Ticker::set_session(s); + Ticker::set_session (s); if (_session) { - _session->MIDIClock_PortChanged.connect( - sigc::mem_fun (*this, &MidiClockTicker::update_midi_clock_port)); - _session->TransportStateChange.connect( - sigc::mem_fun (*this, &MidiClockTicker::transport_state_changed)); - _session->PositionChanged.connect( - sigc::mem_fun (*this, &MidiClockTicker::position_changed)); - _session->TransportLooped.connect( - sigc::mem_fun (*this, &MidiClockTicker::transport_looped)); + _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))); update_midi_clock_port(); } } +void +MidiClockTicker::session_going_away () +{ + SessionHandlePtr::session_going_away(); + _midi_port = 0; +} + void MidiClockTicker::update_midi_clock_port() { _midi_port = _session->midi_clock_port(); @@ -225,5 +225,5 @@ void MidiClockTicker::send_stop_event(nframes_t offset) _midi_port->write(_midi_clock_tick, 1, offset); } -} + diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index acfc9258b4..7d19d23007 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -16,9 +16,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pbd/error.h" -#include <sigc++/retype.h> -#include <sigc++/retype_return.h> -#include <sigc++/bind.h> #include "ardour/amp.h" #include "ardour/audioplaylist.h" diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 81e9674f1a..ee3ebd2ee3 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -102,7 +102,7 @@ VSTPlugin::VSTPlugin (const VSTPlugin &other) VSTPlugin::~VSTPlugin () { deactivate (); - GoingAway (); /* EMIT SIGNAL */ + drop_references (); fst_close (_fst); } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 0dcfea7056..97ad05cb68 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -164,6 +164,7 @@ libardour_sources = [ 'session_directory.cc', 'session_events.cc', 'session_export.cc', + 'session_handle.cc', 'session_metadata.cc', 'session_midi.cc', 'session_playlists.cc', diff --git a/libs/gtkmm2ext/binding_proxy.cc b/libs/gtkmm2ext/binding_proxy.cc index d0696b105f..140dea7e5b 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 (mem_fun (*this, &BindingProxy::learning_finished)); + learning_connection = controllable->LearningFinished.connect (boost::bind (&BindingProxy::learning_finished, this)); } return true; } diff --git a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h index f684cce5c3..348f9f2649 100644 --- a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h +++ b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h @@ -22,9 +22,9 @@ #define __binding_proxy__ #include <string> - #include <gtkmm2ext/popup.h> #include <boost/shared_ptr.hpp> +#include <boost/signals2.hpp> namespace PBD { class Controllable; @@ -50,7 +50,7 @@ class BindingProxy : public sigc::trackable boost::shared_ptr<PBD::Controllable> controllable; guint bind_button; guint bind_statemask; - sigc::connection learning_connection; + boost::signals2::scoped_connection learning_connection; void learning_finished (); bool prompter_hiding (GdkEventAny *); }; diff --git a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h index bac657a028..1fbfb9d800 100644 --- a/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h +++ b/libs/gtkmm2ext/gtkmm2ext/gtk_ui.h @@ -123,6 +123,10 @@ class UI : public Receiver, public AbstractUI<UIRequest> Glib::signal_idle().connect (bind (slot (&UI::idle_delete<T>), obj)); } + template<class T> void delete_in_self (T *obj) { + call_slot (boost::bind (&UI::delete_in_self, this, obj)); + } + Gdk::Color get_color (const std::string& prompt, bool& picked, const Gdk::Color *initial = 0); /* starting is sent just before we enter the main loop, diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index f19c913644..9e339654b4 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -23,7 +23,6 @@ #include "midi++/port.h" #include "midi++/channel.h" -using namespace sigc; using namespace MIDI; Channel::Channel (byte channelnum, Port &p) : _port (p) @@ -35,44 +34,45 @@ Channel::Channel (byte channelnum, Port &p) : _port (p) void Channel::connect_input_signals () - { - _port.input()->channel_pressure[_channel_number].connect - (mem_fun (*this, &Channel::process_chanpress)); - _port.input()->channel_note_on[_channel_number].connect - (mem_fun (*this, &Channel::process_note_on)); - _port.input()->channel_note_off[_channel_number].connect - (mem_fun (*this, &Channel::process_note_off)); - _port.input()->channel_poly_pressure[_channel_number].connect - (mem_fun (*this, &Channel::process_polypress)); - _port.input()->channel_program_change[_channel_number].connect - (mem_fun (*this, &Channel::process_program_change)); - _port.input()->channel_controller[_channel_number].connect - (mem_fun (*this, &Channel::process_controller)); - _port.input()->channel_pitchbend[_channel_number].connect - (mem_fun (*this, &Channel::process_pitchbend)); - _port.input()->reset.connect (mem_fun (*this, &Channel::process_reset)); + 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))); } void Channel::connect_output_signals () { - _port.output()->channel_pressure[_channel_number].connect - (mem_fun (*this, &Channel::process_chanpress)); - _port.output()->channel_note_on[_channel_number].connect - (mem_fun (*this, &Channel::process_note_on)); - _port.output()->channel_note_off[_channel_number].connect - (mem_fun (*this, &Channel::process_note_off)); - _port.output()->channel_poly_pressure[_channel_number].connect - (mem_fun (*this, &Channel::process_polypress)); - _port.output()->channel_program_change[_channel_number].connect - (mem_fun (*this, &Channel::process_program_change)); - _port.output()->channel_controller[_channel_number].connect - (mem_fun (*this, &Channel::process_controller)); - _port.output()->channel_pitchbend[_channel_number].connect - (mem_fun (*this, &Channel::process_pitchbend)); - _port.output()->reset.connect (mem_fun (*this, &Channel::process_reset)); + 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))); } void diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index 697f2a1e46..617ae14430 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -22,7 +22,8 @@ #include <queue> -#include <sigc++/sigc++.h> +#include <boost/signals2.hpp> +#include "pbd/scoped_connections.h" #include "midi++/types.h" #include "midi++/parser.h" @@ -36,7 +37,7 @@ class Port; * This remembers various useful information about the current 'state' of a * MIDI channel (eg current pitch bend value). */ -class Channel : public sigc::trackable { +class Channel : public PBD::ScopedConnectionList { public: Channel (byte channel_number, Port &); diff --git a/libs/midi++2/midi++/manager.h b/libs/midi++2/midi++/manager.h index 8c665d0086..d451d234c8 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<PortSet>&); - sigc::signal<void> PortsChanged; + boost::signals2::signal<void()> PortsChanged; private: /* This is a SINGLETON pattern */ diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 4506bd8a4b..0b06222438 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -20,7 +20,8 @@ #ifndef __midipp_mmc_h_h__ #define __midipp_mmc_h_h__ -#include <sigc++/sigc++.h> +#include <boost/signals2.hpp> + #include "midi++/types.h" namespace MIDI { @@ -28,10 +29,10 @@ namespace MIDI { class Port; class Parser; -class MachineControl : public sigc::trackable - +class MachineControl { public: + typedef boost::signals2::signal<void(MachineControl&)> MMCSignal; typedef byte CommandSignature[60]; typedef byte ResponseSignature[60]; @@ -102,63 +103,61 @@ class MachineControl : public sigc::trackable when certain MMC commands are received. */ - sigc::signal<void,MachineControl &> Stop; - sigc::signal<void,MachineControl &> Play; - sigc::signal<void,MachineControl &> DeferredPlay; - sigc::signal<void,MachineControl &> FastForward; - sigc::signal<void,MachineControl &> Rewind; - sigc::signal<void,MachineControl &> RecordStrobe; - sigc::signal<void,MachineControl &> RecordExit; - sigc::signal<void,MachineControl &> RecordPause; - sigc::signal<void,MachineControl &> Pause; - sigc::signal<void,MachineControl &> Eject; - sigc::signal<void,MachineControl &> Chase; - sigc::signal<void,MachineControl &> CommandErrorReset; - sigc::signal<void,MachineControl &> MmcReset; - - sigc::signal<void,MachineControl &> JogStart; - sigc::signal<void,MachineControl &> JogStop; - - sigc::signal<void,MachineControl &> Write; - sigc::signal<void,MachineControl &> MaskedWrite; - sigc::signal<void,MachineControl &> Read; - sigc::signal<void,MachineControl &> Update; - sigc::signal<void,MachineControl &> VariablePlay; - sigc::signal<void,MachineControl &> Search; - sigc::signal<void,MachineControl &> AssignSystemMaster; - sigc::signal<void,MachineControl &> GeneratorCommand; - sigc::signal<void,MachineControl &> MidiTimeCodeCommand; - sigc::signal<void,MachineControl &> Move; - sigc::signal<void,MachineControl &> Add; - sigc::signal<void,MachineControl &> Subtract; - sigc::signal<void,MachineControl &> DropFrameAdjust; - sigc::signal<void,MachineControl &> Procedure; - sigc::signal<void,MachineControl &> Event; - sigc::signal<void,MachineControl &> Group; - sigc::signal<void,MachineControl &> CommandSegment; - sigc::signal<void,MachineControl &> DeferredVariablePlay; - sigc::signal<void,MachineControl &> RecordStrobeVariable; - sigc::signal<void,MachineControl &> Wait; - sigc::signal<void,MachineControl &> Resume; + MMCSignal Stop; + MMCSignal Play; + MMCSignal DeferredPlay; + MMCSignal FastForward; + MMCSignal Rewind; + MMCSignal RecordStrobe; + MMCSignal RecordExit; + MMCSignal RecordPause; + MMCSignal Pause; + MMCSignal Eject; + MMCSignal Chase; + MMCSignal CommandErrorReset; + MMCSignal MmcReset; + MMCSignal JogStart; + MMCSignal JogStop; + MMCSignal Write; + MMCSignal MaskedWrite; + MMCSignal Read; + MMCSignal Update; + MMCSignal VariablePlay; + MMCSignal Search; + MMCSignal AssignSystemMaster; + MMCSignal GeneratorCommand; + MMCSignal MidiTimeCodeCommand; + MMCSignal Move; + MMCSignal Add; + MMCSignal Subtract; + MMCSignal DropFrameAdjust; + MMCSignal Procedure; + MMCSignal Event; + MMCSignal Group; + MMCSignal CommandSegment; + MMCSignal DeferredVariablePlay; + MMCSignal RecordStrobeVariable; + MMCSignal Wait; + MMCSignal Resume; /* The second argument is the shuttle speed, the third is true if the direction is "forwards", false for "reverse" */ - sigc::signal<void,MachineControl &,float,bool> Shuttle; + boost::signals2::signal<void(MachineControl&,float,bool)> Shuttle; /* The second argument specifies the desired track record enabled status. */ - sigc::signal<void,MachineControl &,size_t,bool> + boost::signals2::signal<void(MachineControl &,size_t,bool)> TrackRecordStatusChange; /* The second argument specifies the desired track record enabled status. */ - sigc::signal<void,MachineControl &,size_t,bool> + boost::signals2::signal<void(MachineControl &,size_t,bool)> TrackMuteChange; /* The second argument points to a byte array containing @@ -166,11 +165,11 @@ class MachineControl : public sigc::trackable format (5 bytes, roughly: hrs/mins/secs/frames/subframes) */ - sigc::signal<void,MachineControl &, const byte *> Locate; + boost::signals2::signal<void(MachineControl &, const byte *)> Locate; /* The second argument is the number of steps to jump */ - sigc::signal<void,MachineControl &, int> Step; + boost::signals2::signal<void(MachineControl &, int)> Step; protected: @@ -258,7 +257,8 @@ class MachineControl : public sigc::trackable MIDI::Port &_port; void process_mmc_message (Parser &p, byte *, size_t len); - + boost::signals2::scoped_connection mmc_connection; + int do_masked_write (byte *, size_t len); int do_locate (byte *, size_t len); int do_step (byte *, size_t len); diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index 365f2fb46a..497a50abe8 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -23,7 +23,7 @@ #include <string> #include <iostream> -#include <sigc++/sigc++.h> +#include <boost/signals2.hpp> #include "midi++/types.h" @@ -32,12 +32,14 @@ namespace MIDI { class Port; class Parser; -typedef sigc::signal<void, Parser &, byte> OneByteSignal; -typedef sigc::signal<void, Parser &, EventTwoBytes *> TwoByteSignal; -typedef sigc::signal<void, Parser &, pitchbend_t> PitchBendSignal; -typedef sigc::signal<void, Parser &, byte *, size_t> Signal; +typedef boost::signals2::signal<void(Parser&)> ZeroByteSignal; +typedef boost::signals2::signal<void(Parser&,nframes_t)> TimestampedSignal; +typedef boost::signals2::signal<void(Parser&, byte)> OneByteSignal; +typedef boost::signals2::signal<void(Parser &, EventTwoBytes *)> TwoByteSignal; +typedef boost::signals2::signal<void(Parser &, pitchbend_t)> PitchBendSignal; +typedef boost::signals2::signal<void(Parser &, byte *, size_t)> Signal; -class Parser : public sigc::trackable { +class Parser { public: Parser (Port &p); ~Parser (); @@ -69,8 +71,8 @@ class Parser : public sigc::trackable { OneByteSignal channel_program_change[16]; PitchBendSignal channel_pitchbend[16]; TwoByteSignal channel_controller[16]; - sigc::signal<void, Parser &> channel_active_preparse[16]; - sigc::signal<void, Parser &> channel_active_postparse[16]; + ZeroByteSignal channel_active_preparse[16]; + ZeroByteSignal channel_active_postparse[16]; OneByteSignal mtc_quarter_frame; /* see below for more useful signals */ Signal mtc; @@ -82,15 +84,16 @@ class Parser : public sigc::trackable { Signal position; Signal song; - sigc::signal<void, Parser &> all_notes_off; - sigc::signal<void, Parser &> tune; - sigc::signal<void, Parser &, nframes_t> timing; - sigc::signal<void, Parser &, nframes_t> start; - sigc::signal<void, Parser &, nframes_t> stop; - sigc::signal<void, Parser &, nframes_t> contineu; /* note spelling */ - sigc::signal<void, Parser &> active_sense; - sigc::signal<void, Parser &> reset; - sigc::signal<void, Parser &> eox; + ZeroByteSignal all_notes_off; + ZeroByteSignal tune; + ZeroByteSignal active_sense; + ZeroByteSignal reset; + ZeroByteSignal eox; + + TimestampedSignal timing; + TimestampedSignal start; + TimestampedSignal stop; + TimestampedSignal contineu; /* note spelling */ /* This should really be protected, but then derivatives of Port can't access it. @@ -106,9 +109,9 @@ class Parser : public sigc::trackable { void set_offline (bool); bool offline() const { return _offline; } - sigc::signal<void> OfflineStatusChanged; + boost::signals2::signal<void()> OfflineStatusChanged; - sigc::signal<int, byte *, size_t> edit; + boost::signals2::signal<int(byte *, size_t)> edit; void set_mmc_forwarding (bool yn) { _mmc_forward = yn; @@ -121,10 +124,10 @@ class Parser : public sigc::trackable { const byte *mtc_current() const { return _mtc_time; } bool mtc_locked() const { return _mtc_locked; } - sigc::signal<void,Parser&,int,nframes_t> mtc_qtr; - sigc::signal<void,const byte*,bool,nframes_t> mtc_time; - sigc::signal<void,MTC_Status> mtc_status; - sigc::signal<bool> mtc_skipped; + boost::signals2::signal<void(Parser&,int,nframes_t)> mtc_qtr; + boost::signals2::signal<void(const byte*,bool,nframes_t)> mtc_time; + boost::signals2::signal<void(MTC_Status)> mtc_status; + boost::signals2::signal<bool()> mtc_skipped; void set_mtc_forwarding (bool yn) { _mtc_forward = yn; @@ -139,7 +142,7 @@ class Parser : public sigc::trackable { std::ostream *trace_stream; std::string trace_prefix; void trace_event (Parser &p, byte *msg, size_t len); - sigc::connection trace_connection; + boost::signals2::scoped_connection trace_connection; size_t message_counter[256]; diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 23a9a01200..0c5fe4ae37 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -22,7 +22,7 @@ #include <string> #include <iostream> -#include <sigc++/sigc++.h> +#include <boost/signals2.hpp> #include "pbd/xml++.h" #include "midi++/types.h" @@ -33,7 +33,7 @@ namespace MIDI { class Channel; class PortRequest; -class Port : public sigc::trackable { +class Port { public: enum Type { Unknown, @@ -168,7 +168,6 @@ class Port : public sigc::trackable { int _mode; size_t _number; Channel *_channel[16]; - sigc::connection thru_connection; unsigned int bytes_written; unsigned int bytes_read; Parser *input_parser; diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index 2e42bb59fc..e496e37aa9 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -206,8 +206,7 @@ MachineControl::MachineControl (Port &p, float /*version*/, _send_device_id = 0x7f; if ((parser = _port.input()) != 0) { - parser->mmc.connect - (mem_fun (*this, &MachineControl::process_mmc_message)); + mmc_connection = parser->mmc.connect (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 6daed45d23..4f19c40ebe 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -35,7 +35,6 @@ #include "pbd/transmitter.h" using namespace std; -using namespace sigc; using namespace MIDI; const char * @@ -317,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 (mem_fun (*this, &Parser::trace_event)); + trace_connection = any.connect (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 35f7605541..369e2bd545 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -26,11 +26,11 @@ using namespace PBD; using namespace std; -sigc::signal<void,Controllable*> Controllable::Destroyed; -sigc::signal<bool,Controllable*> Controllable::StartLearning; -sigc::signal<void,Controllable*> Controllable::StopLearning; -sigc::signal<void,Controllable*,int,int> Controllable::CreateBinding; -sigc::signal<void,Controllable*> Controllable::DeleteBinding; +boost::signals2::signal<void(Controllable*)> Controllable::Destroyed; +boost::signals2::signal<bool(Controllable*)> Controllable::StartLearning; +boost::signals2::signal<void(Controllable*)> Controllable::StopLearning; +boost::signals2::signal<void(Controllable*,int,int)> Controllable::CreateBinding; +boost::signals2::signal<void(Controllable*)> Controllable::DeleteBinding; Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT; Controllable::Controllables Controllable::registry; @@ -41,45 +41,47 @@ Controllable::Controllable (const string& name, const string& uri) , _uri (uri) , _touching (false) { - add (); + add (*this); } void -Controllable::add () +Controllable::add (Controllable& ctl) { + using namespace boost; + Glib::RWLock::WriterLock lm (registry_lock); - registry.insert (this); + registry.insert (&ctl); - if (!_uri.empty()) { + if (!ctl.uri().empty()) { pair<string,Controllable*> newpair; - newpair.first = _uri; - newpair.second = this; + newpair.first = ctl.uri(); + newpair.second = &ctl; registry_by_uri.insert (newpair); } - this->GoingAway.connect (mem_fun (this, &Controllable::remove)); + /* Controllable::remove() is static - no need to manage this connection */ + + ctl.GoingAway.connect (boost::bind (&Controllable::remove, ref (ctl))); } void -Controllable::remove () +Controllable::remove (Controllable& ctl) { Glib::RWLock::WriterLock lm (registry_lock); for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) { - if ((*i) == this) { + if ((*i) == &ctl) { registry.erase (i); break; } } - if (!_uri.empty()) { - ControllablesByURI::iterator i = registry_by_uri.find (_uri); + if (!ctl.uri().empty()) { + ControllablesByURI::iterator i = registry_by_uri.find (ctl.uri()); if (i != registry_by_uri.end()) { registry_by_uri.erase (i); } } - - } void diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index 7af7f7bb98..5a7290bc89 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -1,3 +1,4 @@ + /* Copyright (C) 2006 Paul Davis Author: Hans Fugal diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 9750ebe56e..dbec03b396 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -24,8 +24,7 @@ v it under the terms of the GNU General Public License as published by #include <set> #include <map> -#include <sigc++/trackable.h> -#include <sigc++/signal.h> +#include <boost/signals2.hpp> #include <glibmm/thread.h> #include "pbd/statefuldestructible.h" @@ -45,16 +44,16 @@ class Controllable : public PBD::StatefulDestructible { virtual void set_value (float) = 0; virtual float get_value (void) const = 0; - sigc::signal<void> LearningFinished; - static sigc::signal<void,PBD::Controllable*,int,int> CreateBinding; - static sigc::signal<void,PBD::Controllable*> DeleteBinding; + boost::signals2::signal<void()> LearningFinished; + static boost::signals2::signal<void(PBD::Controllable*,int,int)> CreateBinding; + static boost::signals2::signal<void(PBD::Controllable*)> DeleteBinding; - static sigc::signal<bool,PBD::Controllable*> StartLearning; - static sigc::signal<void,PBD::Controllable*> StopLearning; + static boost::signals2::signal<bool(PBD::Controllable*)> StartLearning; + static boost::signals2::signal<void(PBD::Controllable*)> StopLearning; - static sigc::signal<void,Controllable*> Destroyed; - - sigc::signal<void> Changed; + static boost::signals2::signal<void(Controllable*)> Destroyed; + + boost::signals2::signal<void()> Changed; int set_state (const XMLNode&, int version); XMLNode& get_state (); @@ -73,8 +72,8 @@ class Controllable : public PBD::StatefulDestructible { std::string _uri; bool _touching; - void add (); - void remove (); + static void add (Controllable&); + static void remove (Controllable&); typedef std::set<PBD::Controllable*> Controllables; typedef std::map<std::string,PBD::Controllable*> ControllablesByURI; diff --git a/libs/pbd/pbd/destructible.h b/libs/pbd/pbd/destructible.h index 827feb8fe5..241d847aff 100644 --- a/libs/pbd/pbd/destructible.h +++ b/libs/pbd/pbd/destructible.h @@ -20,26 +20,20 @@ #ifndef __pbd_destructible_h__ #define __pbd_destructible_h__ -#include <sigc++/signal.h> +#include <boost/signals2.hpp> namespace PBD { -/* be very very careful using this class. it does not inherit from sigc::trackable and thus - should only be used in multiple-inheritance situations involving another type - that does inherit from sigc::trackable (or sigc::trackable itself) -*/ - -class ThingWithGoingAway { - public: - virtual ~ThingWithGoingAway () {} - sigc::signal<void> GoingAway; -}; - -class Destructible : public sigc::trackable, public ThingWithGoingAway { +class Destructible { public: + Destructible() : refs_dropped (false){} virtual ~Destructible () {} - void drop_references () const { GoingAway(); } + + boost::signals2::signal<void ()> GoingAway; + void drop_references () { if (!refs_dropped) { GoingAway(); } refs_dropped = true; } + private: + bool refs_dropped; }; } diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index c1e5d75f9c..c5e8b19272 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -26,7 +26,6 @@ #include "pbd/command.h" #include "pbd/stacktrace.h" #include "pbd/xml++.h" -#include "pbd/shiva.h" #include <sigc++/slot.h> #include <typeinfo> @@ -42,16 +41,20 @@ public: MementoCommand(obj_T& a_object, XMLNode* a_before, XMLNode* a_after) : obj(a_object), before(a_before), after(a_after) { - /* catch destruction of the object */ - new PBD::PairedShiva< obj_T,MementoCommand<obj_T> > (obj, *this); + /* 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)); } ~MementoCommand () { - GoingAway(); /* EMIT SIGNAL */ + drop_references (); delete before; delete after; } + void object_died () { + delete this; + } + void operator() () { if (after) { obj.set_state(*after, Stateful::current_state_version); @@ -94,6 +97,7 @@ protected: obj_T& obj; XMLNode* before; XMLNode* after; + boost::signals2::scoped_connection obj_death_connection; }; #endif // __lib_pbd_memento_h__ diff --git a/libs/pbd/pbd/statefuldestructible.h b/libs/pbd/pbd/statefuldestructible.h index 49a33ff438..36eb43147c 100644 --- a/libs/pbd/pbd/statefuldestructible.h +++ b/libs/pbd/pbd/statefuldestructible.h @@ -29,16 +29,6 @@ class StatefulDestructible : public Stateful, public Destructible { }; -/* be very very careful using this class. it does not inherit from sigc::trackable and thus - should only be used in multiple-inheritance situations involving another type - that does inherit from sigc::trackable (or sigc::trackable itself) -*/ - -class StatefulThingWithGoingAway : public Stateful, public ThingWithGoingAway -{ -}; - } - #endif /* __pbd_stateful_destructible_h__ */ diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 0e48bea962..6340ef04b9 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -26,12 +26,13 @@ #include <sigc++/slot.h> #include <sigc++/bind.h> #include <sys/time.h> + +#include "pbd/scoped_connections.h" #include "pbd/command.h" -#include "pbd/shiva.h" typedef sigc::slot<void> UndoAction; -class UndoTransaction : public Command +class UndoTransaction : public Command, public PBD::ScopedConnectionList { public: UndoTransaction (); @@ -61,7 +62,6 @@ class UndoTransaction : public Command private: std::list<Command*> actions; - std::list<PBD::ProxyShiva<Command,UndoTransaction>*> shivas; struct timeval _timestamp; bool _clearing; @@ -71,10 +71,9 @@ class UndoTransaction : public Command ~UndoTransaction (); void about_to_explicitly_delete (); - }; -class UndoHistory : public sigc::trackable +class UndoHistory : public PBD::ScopedConnectionList { public: UndoHistory(); @@ -107,7 +106,7 @@ class UndoHistory : public sigc::trackable void set_depth (uint32_t); - sigc::signal<void> Changed; + boost::signals2::signal<void()> Changed; private: bool _clearing; diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 58be141a27..596402576e 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -21,6 +21,7 @@ #include <unistd.h> #include "pbd/stateful.h" +#include "pbd/destructible.h" #include "pbd/filesystem.h" #include "pbd/xml++.h" #include "pbd/error.h" diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index a0e98f9a13..78c16291b7 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -46,7 +46,7 @@ UndoTransaction::UndoTransaction (const UndoTransaction& rhs) UndoTransaction::~UndoTransaction () { - GoingAway (); + drop_references (); clear (); } @@ -78,9 +78,11 @@ void UndoTransaction::add_command (Command *const action) { /* catch death of command (e.g. caused by death of object to - which it refers. + which it refers. command_death() is a normal static function + so there is no need to manage this connection. */ - shivas.push_back (new PBD::ProxyShiva<Command,UndoTransaction> (*action, *this, &command_death)); + + scoped_connect (action->GoingAway, boost::bind (&command_death, this, action)); actions.push_back (action); } @@ -90,21 +92,6 @@ UndoTransaction::remove_command (Command* const action) actions.remove (action); } -void -UndoTransaction::about_to_explicitly_delete () -{ - /* someone is going to call our destructor and its not Shiva, - the god of destruction and chaos. This happens when an UndoHistory - is pruning itself. we must remove Shivas to avoid the god - striking us down a second time, unnecessarily and illegally. - */ - - for (list<PBD::ProxyShiva<Command,UndoTransaction>*>::iterator i = shivas.begin(); i != shivas.end(); ++i) { - delete *i; - } - shivas.clear (); -} - bool UndoTransaction::empty () const { @@ -188,7 +175,6 @@ UndoHistory::set_depth (uint32_t d) while (cnt--) { ut = UndoList.front(); UndoList.pop_front (); - ut->about_to_explicitly_delete (); delete ut; } } @@ -199,7 +185,7 @@ UndoHistory::add (UndoTransaction* const ut) { uint32_t current_depth = UndoList.size(); - ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut)); + scoped_connect (ut->GoingAway, 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 @@ -214,7 +200,6 @@ UndoHistory::add (UndoTransaction* const ut) UndoTransaction* ut; ut = UndoList.front (); UndoList.pop_front (); - ut->about_to_explicitly_delete (); delete ut; } } diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 84c18cc899..aacbd990ad 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -73,6 +73,7 @@ def build(bld): pool.cc pthread_utils.cc receiver.cc + scoped_connections.cc search_path.cc shortpath.cc stacktrace.cc diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index 097dbc3aec..a20835dc05 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -175,11 +175,13 @@ GenericMidiControlProtocol::start_learning (Controllable* c) { Glib::Mutex::Lock lm (pending_lock); - std::pair<MIDIControllable *, sigc::connection> element; +#if 0 // BOOST SIGNALS + std::pair<MIDIControllable *, boost::signals2::scoped_connection> element; element.first = mc; element.second = c->LearningFinished.connect (bind (mem_fun (*this, &GenericMidiControlProtocol::learning_stopped), mc)); pending_controllables.push_back (element); +#endif } mc->learn_about_external_control (); diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 124ef95615..533bb6db21 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -27,7 +27,6 @@ #include "midicontrollable.h" -using namespace sigc; using namespace std; using namespace MIDI; using namespace PBD; @@ -110,7 +109,7 @@ void MIDIControllable::learn_about_external_control () { drop_external_control (); - midi_learn_connection = _port.input()->any.connect (mem_fun (*this, &MIDIControllable::midi_receiver)); + midi_learn_connection = _port.input()->any.connect (boost::bind (&MIDIControllable::midi_receiver, this, _1, _2, _3)); } void @@ -302,7 +301,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) switch (ev) { case MIDI::off: midi_sense_connection[0] = p.channel_note_off[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_note_off)); + (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. @@ -310,7 +309,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) if (bistate) { midi_sense_connection[1] = p.channel_note_on[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_note_on)); + (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); connections = 2; } else { connections = 1; @@ -320,20 +319,20 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) case MIDI::on: midi_sense_connection[0] = p.channel_note_on[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_note_on)); + (boost::bind (&MIDIControllable::midi_sense_note_on, this, _1, _2)); if (bistate) { midi_sense_connection[1] = p.channel_note_off[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_note_off)); + (boost::bind (&MIDIControllable::midi_sense_note_off, this, _1, _2)); connections = 2; } else { connections = 1; } _control_description = "MIDI control: NoteOn"; break; - + case MIDI::controller: midi_sense_connection[0] = p.channel_controller[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_controller)); + (boost::bind (&MIDIControllable::midi_sense_controller, this, _1, _2)); connections = 1; snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional); _control_description = buf; @@ -342,8 +341,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) case MIDI::program: if (!bistate) { midi_sense_connection[0] = p.channel_program_change[chn_i].connect - (mem_fun (*this, - &MIDIControllable::midi_sense_program_change)); + (boost::bind (&MIDIControllable::midi_sense_program_change, this, _1, _2)); connections = 1; _control_description = "MIDI control: ProgramChange"; } @@ -352,7 +350,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) case MIDI::pitchbend: if (!bistate) { midi_sense_connection[0] = p.channel_pitchbend[chn_i].connect - (mem_fun (*this, &MIDIControllable::midi_sense_pitchbend)); + (boost::bind (&MIDIControllable::midi_sense_pitchbend, this, _1, _2)); connections = 1; _control_description = "MIDI control: Pitchbend"; } diff --git a/libs/surfaces/generic_midi/midicontrollable.h b/libs/surfaces/generic_midi/midicontrollable.h index a9a40944d8..cc85cc42c1 100644 --- a/libs/surfaces/generic_midi/midicontrollable.h +++ b/libs/surfaces/generic_midi/midicontrollable.h @@ -22,7 +22,7 @@ #include <string> -#include <sigc++/sigc++.h> +#include <boost/signals2.hpp> #include "midi++/types.h" #include "pbd/controllable.h" @@ -82,8 +82,8 @@ class MIDIControllable : public PBD::Stateful MIDI::byte last_value; bool bistate; int midi_msg_id; /* controller ID or note number */ - sigc::connection midi_sense_connection[2]; - sigc::connection midi_learn_connection; + boost::signals2::connection midi_sense_connection[2]; + boost::signals2::connection midi_learn_connection; size_t connections; MIDI::eventType control_type; MIDI::byte control_additional; diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index 84283f3016..acd91e6047 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -18,12 +18,12 @@ #ifndef mackie_controls_h #define mackie_controls_h -#include <sigc++/sigc++.h> - #include <map> #include <vector> #include <string> +#include <boost/signals2.hpp> + #include "mackie_control_exception.h" namespace Mackie @@ -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 - sigc::connection in_use_connection; + boost::signals2::scoped_connection 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 6e65308f33..7460b041ad 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -61,7 +61,6 @@ using namespace ARDOUR; using namespace std; -using namespace sigc; using namespace Mackie; using namespace PBD; @@ -74,7 +73,6 @@ MackieMidiBuilder builder; MackieControlProtocol::MackieControlProtocol (Session& session) : ControlProtocol (session, X_("Mackie")) , _current_initial_bank( 0 ) - , connections_back( _connections ) , _surface( 0 ) , _ports_changed( false ) , _polling( true ) @@ -564,23 +562,23 @@ void MackieControlProtocol::update_surface() void MackieControlProtocol::connect_session_signals() { // receive routes added - connections_back = session->RouteAdded.connect( ( mem_fun (*this, &MackieControlProtocol::notify_route_added) ) ); + session_connections.add_connection (session->RouteAdded.connect(boost::bind (&MackieControlProtocol::notify_route_added, this, _1))); // receive record state toggled - connections_back = session->RecordStateChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_record_state_changed) ) ); + session_connections.add_connection (session->RecordStateChanged.connect(boost::bind (&MackieControlProtocol::notify_record_state_changed, this))); // receive transport state changed - connections_back = session->TransportStateChange.connect( ( mem_fun (*this, &MackieControlProtocol::notify_transport_state_changed) ) ); + session_connections.add_connection (session->TransportStateChange.connect(boost::bind (&MackieControlProtocol::notify_transport_state_changed, this))); // receive punch-in and punch-out - connections_back = Config->ParameterChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) ); - session->config.ParameterChanged.connect ( ( mem_fun (*this, &MackieControlProtocol::notify_parameter_changed) ) ); + 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))); // receive rude solo changed - connections_back = session->SoloActive.connect( ( mem_fun (*this, &MackieControlProtocol::notify_solo_active_changed) ) ); + session_connections.add_connection (session->SoloActive.connect(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 ) { - connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) ); + session_connections.add_connection ((*it)->RemoteControlIDChanged.connect (boost::bind(&MackieControlProtocol::notify_remote_id_changed, this))); } } @@ -603,27 +601,10 @@ void MackieControlProtocol::add_port( MIDI::Port & midi_port, int number ) { MackiePort * sport = new MackiePort( *this, midi_port, number ); _ports.push_back( sport ); - - connections_back = sport->init_event.connect( - sigc::bind ( - mem_fun (*this, &MackieControlProtocol::handle_port_init) - , sport - ) - ); - - connections_back = sport->active_event.connect( - sigc::bind ( - mem_fun (*this, &MackieControlProtocol::handle_port_active) - , sport - ) - ); - - connections_back = sport->inactive_event.connect( - sigc::bind ( - mem_fun (*this, &MackieControlProtocol::handle_port_inactive) - , 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))); _ports_changed = true; } @@ -699,9 +680,9 @@ void MackieControlProtocol::initialize_surface() _surface->init(); // Connect events. Must be after route table otherwise there will be trouble - for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it ) - { - connections_back = (*it)->control_event.connect( ( mem_fun (*this, &MackieControlProtocol::handle_control_event) ) ); + + 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))); } } @@ -713,18 +694,9 @@ void MackieControlProtocol::close() _polling = false; pthread_join( thread, 0 ); - // TODO disconnect port active/inactive signals - // Or at least put a lock here - - // disconnect global signals from Session - // TODO Since *this is a sigc::trackable, this shouldn't be necessary - // but it is for some reason -#if 0 - for( vector<sigc::connection>::iterator it = _connections.begin(); it != _connections.end(); ++it ) - { - it->disconnect(); - } -#endif + port_connections.drop_connections (); + session_connections.drop_connections (); + route_connections.drop_connections (); if ( _surface != 0 ) { @@ -1471,9 +1443,9 @@ void MackieControlProtocol::notify_route_added( ARDOUR::RouteList & rl ) // make sure remote id changes in the new route are handled typedef ARDOUR::RouteList ARS; - for ( ARS::iterator it = rl.begin(); it != rl.end(); ++it ) - { - connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) ); + + 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))); } } diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index d220213d2d..58d05f7b7f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -335,12 +335,12 @@ class MackieControlProtocol /// Protects set_active, and allows waiting on the poll thread Glib::Cond update_cond; - - // because sigc::trackable doesn't seem to be working - std::vector<sigc::connection> _connections; - std::back_insert_iterator<std::vector<sigc::connection> > connections_back; - - /// The representation of the physical controls on the surface. + + PBD::ScopedConnectionList session_connections; + PBD::ScopedConnectionList port_connections; + PBD::ScopedConnectionList route_connections; + + /// The representation of the physical controls on the surface. Mackie::Surface * _surface; /// If a port is opened or closed, this will be diff --git a/libs/surfaces/mackie/mackie_port.cc b/libs/surfaces/mackie/mackie_port.cc index 4413d3fc34..3316483914 100644 --- a/libs/surfaces/mackie/mackie_port.cc +++ b/libs/surfaces/mackie/mackie_port.cc @@ -29,7 +29,6 @@ #include "midi++/types.h" #include "midi++/port.h" -#include "sigc++/sigc++.h" #include "ardour/rc_configuration.h" #include "i18n.h" @@ -95,7 +94,7 @@ void MackiePort::open() #ifdef PORT_DEBUG cout << "MackiePort::open " << *this << endl; #endif - _sysex = port().input()->sysex.connect( ( mem_fun (*this, &MackiePort::handle_midi_sysex) ) ); + _sysex = port().input()->sysex.connect (boost::bind (&MackiePort::handle_midi_sysex, this, _1, _2, _3)); // make sure the device is connected init(); @@ -301,7 +300,7 @@ void MackiePort::connect_any() #ifdef DEBUG cout << "connect input parser " << port().input() << " to handle_midi_any" << endl; #endif - _any = port().input()->any.connect( mem_fun( *this, &MackiePort::handle_midi_any ) ); + _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 @@ -503,8 +502,9 @@ void MackiePort::handle_midi_any (MIDI::Parser &, MIDI::byte * raw_bytes, size_t // first disconnect any previous timeouts control.in_use_connection.disconnect(); +#if 0 // BOOSTSIGNALS // now connect a new timeout to call handle_control_timeout_event - sigc::slot<bool> timeout_slot = sigc::bind( + sigc::slot<bool> timeout_slot = sigc::bind ( mem_fun( *this, &MackiePort::handle_control_timeout_event ) , &control ); @@ -512,7 +512,7 @@ void MackiePort::handle_midi_any (MIDI::Parser &, MIDI::byte * raw_bytes, size_t timeout_slot , control.in_use_timeout() ); - +#endif // emit the control event control_event( *this, control, state ); break; diff --git a/libs/surfaces/mackie/mackie_port.h b/libs/surfaces/mackie/mackie_port.h index 26ec1ca799..639183d066 100644 --- a/libs/surfaces/mackie/mackie_port.h +++ b/libs/surfaces/mackie/mackie_port.h @@ -21,8 +21,7 @@ #include "surface_port.h" #include <midi++/types.h> -#include <sigc++/signal.h> -#include <sigc++/connection.h> +#include <boost/signals2.hpp> #include <glibmm/thread.h> @@ -116,8 +115,8 @@ protected: private: MackieControlProtocol & _mcp; port_type_t _port_type; - sigc::connection _any; - sigc::connection _sysex; + boost::signals2::scoped_connection _any; + boost::signals2::scoped_connection _sysex; emulation_t _emulation; bool _initialising; diff --git a/libs/surfaces/mackie/route_signal.cc b/libs/surfaces/mackie/route_signal.cc index af99e5d91b..fb6cf5b092 100644 --- a/libs/surfaces/mackie/route_signal.cc +++ b/libs/surfaces/mackie/route_signal.cc @@ -31,34 +31,36 @@ using namespace std; void RouteSignal::connect() { - back_insert_iterator<Connections> cins = back_inserter( _connections ); + if (_strip.has_solo()) { + connections.add_connection (_route->solo_control()->Changed.connect(boost::bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this))); + } - if ( _strip.has_solo() ) - cins = _route->solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) ); - - if ( _strip.has_mute() ) - cins = _route->mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) ); - - if ( _strip.has_gain() ) - cins = _route->gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) ); - - cins = _route->NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) ); + if (_strip.has_mute()) { + connections.add_connection (_route->mute_control()->Changed.connect(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))); + } + + connections.add_connection (_route->NameChanged.connect (boost::bind (&MackieControlProtocol::notify_name_changed, &_mcp, this))); if (_route->panner()) { - cins = _route->panner()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); + connections.add_connection (_route->panner()->Changed.connect(boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false))); + for ( unsigned int i = 0; i < _route->panner()->npanners(); ++i ) { - cins = _route->panner()->streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); + connections.add_connection (_route->panner()->streampanner(i).Changed.connect (boost::bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false))); } } boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route); if (trk) { - cins = trk->rec_enable_control()->Changed .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this)); + connections.add_connection (trk->rec_enable_control()->Changed .connect(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. - cins = _route->active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) ); + connections.add_connection (_route->active_changed.connect (boost::bind (&MackieControlProtocol::notify_active_changed, &_mcp, this))); // TODO // SelectedChanged @@ -67,10 +69,7 @@ void RouteSignal::connect() void RouteSignal::disconnect() { - for ( Connections::iterator it = _connections.begin(); it != _connections.end(); ++it ) - { - it->disconnect(); - } + connections.drop_connections (); } void RouteSignal::notify_all() diff --git a/libs/surfaces/mackie/route_signal.h b/libs/surfaces/mackie/route_signal.h index a272449e52..5b388a7da5 100644 --- a/libs/surfaces/mackie/route_signal.h +++ b/libs/surfaces/mackie/route_signal.h @@ -18,10 +18,10 @@ #ifndef route_signal_h #define route_signal_h -#include <sigc++/sigc++.h> +#include <vector> #include <boost/shared_ptr.hpp> -#include <vector> +#include "pbd/scoped_connections.h" #include "midi_byte_array.h" @@ -79,8 +79,7 @@ private: Strip & _strip; SurfacePort & _port; - typedef std::vector<sigc::connection> Connections; - Connections _connections; + PBD::ScopedConnectionList connections; // Last written values for the gain and pan, to avoid overloading // the midi connection to the surface diff --git a/libs/surfaces/mackie/surface_port.h b/libs/surfaces/mackie/surface_port.h index 421446df68..f41f2865bb 100644 --- a/libs/surfaces/mackie/surface_port.h +++ b/libs/surfaces/mackie/surface_port.h @@ -18,7 +18,7 @@ #ifndef surface_port_h #define surface_port_h -#include <sigc++/signal.h> +#include <boost/signals2.hpp> #include <glibmm/thread.h> #include "midi_byte_array.h" @@ -34,7 +34,7 @@ namespace Mackie /** Make a relationship between a midi port and a Mackie device. */ -class SurfacePort : public sigc::trackable +class SurfacePort { public: SurfacePort( MIDI::Port & port, int number ); @@ -64,19 +64,19 @@ public: const MIDI::Port & port() const { return *_port; } // all control notofications are sent from here - sigc::signal<void, SurfacePort &, Control &, const ControlState &> control_event; + boost::signals2::signal<void(SurfacePort &, Control &, const ControlState &)> control_event; // emitted just before the port goes into initialisation // where it tries to establish that its device is connected - sigc::signal<void> init_event; + boost::signals2::signal<void()> init_event; // emitted when the port completes initialisation successfully - sigc::signal<void> active_event; + boost::signals2::signal<void()> active_event; // emitted when the port goes inactive (ie a read or write failed) - sigc::signal<void> inactive_event; + boost::signals2::signal<void()> inactive_event; - // the port number - master is 0, extenders are 1,2,3,4 + // the port number - master is 0(extenders are 1((,4 virtual int number() const { return _number; } // number of strips handled by this port. Usually 8. diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 4a151d44d0..931a5c1a58 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -29,6 +29,7 @@ #include <fcntl.h> #include <glibmm/miscutils.h> +#include <boost/signals2.hpp> #include <pbd/pthread_utils.h> #include <pbd/file_utils.h> @@ -82,7 +83,7 @@ OSC::OSC (Session& s, uint32_t port) // "Application Hooks" session_loaded (s); - session->Exported.connect (sigc::mem_fun (*this, &OSC::session_exported)); + scoped_connect (session->Exported, boost::bind (&OSC::session_exported, this, _1, _2)); } OSC::~OSC() @@ -572,7 +573,7 @@ OSC::listen_to_route (boost::shared_ptr<Route> route, lo_address addr) */ if (!route_exists) { - route->GoingAway.connect (sigc::bind (sigc::mem_fun (*this, &OSC::drop_route), boost::weak_ptr<Route> (route))); + scoped_connect (route->GoingAway, (boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)))); } } diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index c0be2c0b18..314d37c7bd 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -31,9 +31,8 @@ #include <glibmm/main.h> -#include <sigc++/sigc++.h> - #include "pbd/abstract_ui.h" +#include "pbd/scoped_connections.h" #include "ardour/types.h" #include "control_protocol/control_protocol.h" @@ -56,7 +55,7 @@ struct OSCUIRequest : public BaseUI::BaseRequestObject { ~OSCUIRequest() {} }; -class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> +class OSC : public ARDOUR::ControlProtocol, public PBD::ScopedConnectionList, public AbstractUI<OSCUIRequest> { public: OSC (ARDOUR::Session&, uint32_t port); |