diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audiosource.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_source.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/source.h | 42 |
4 files changed, 36 insertions, 23 deletions
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 6df4146259..524c5fa209 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -39,8 +39,7 @@ namespace ARDOUR { class LIBARDOUR_API AudioSource : virtual public Source, - public ARDOUR::Readable, - public boost::enable_shared_from_this<ARDOUR::AudioSource> + public ARDOUR::Readable { public: AudioSource (Session&, const std::string& name); diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 4d6c5689f5..370572ea7e 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -43,7 +43,7 @@ class MidiStateTracker; template<typename T> class MidiRingBuffer; /** Source for MIDI data */ -class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_shared_from_this<MidiSource> +class LIBARDOUR_API MidiSource : virtual public Source { public: typedef Temporal::Beats TimeType; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 45dfb6fcff..0453994d33 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1754,8 +1754,20 @@ private: mutable Glib::Threads::Mutex source_lock; public: + + /* Emited when a new source is added to the session */ + PBD::Signal1< void, boost::shared_ptr<Source> > SourceAdded; + PBD::Signal1< void, boost::shared_ptr<Source> > SourceRemoved; + typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap; + void foreach_source (boost::function<void( boost::shared_ptr<Source> )> f) { + Glib::Threads::Mutex::Lock ls (source_lock); + for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) { + f ( (*i).second ); + } + } + private: void reset_write_sources (bool mark_write_complete, bool force = false); SourceMap sources; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index e3a386b97a..d6ed19b610 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -25,6 +25,8 @@ #include <glibmm/threads.h> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> #include <boost/utility.hpp> #include "pbd/statefuldestructible.h" @@ -36,7 +38,8 @@ namespace ARDOUR { class Session; -class LIBARDOUR_API Source : public SessionObject +class LIBARDOUR_API Source : public SessionObject, + public boost::enable_shared_from_this<ARDOUR::Source> { public: enum Flag { @@ -117,25 +120,24 @@ public: uint32_t level() const { return _level; } std::string ancestor_name() { return _ancestor_name.empty() ? name() : _ancestor_name; } - void set_ancestor_name(const std::string& name) { _ancestor_name = name; } - -protected: - DataType _type; - Flag _flags; - time_t _timestamp; - std::string _take_id; - samplepos_t _timeline_position; - bool _analysed; - - mutable Glib::Threads::Mutex _lock; - mutable Glib::Threads::Mutex _analysis_lock; - - gint _use_count; /* atomic */ - uint32_t _level; /* how deeply nested is this source w.r.t a disk file */ - std::string _ancestor_name; - -private: - + void set_ancestor_name(const std::string& name) { _ancestor_name = name; } + + static PBD::Signal1<void,boost::shared_ptr<ARDOUR::Source> > SourcePropertyChanged; + + protected: + DataType _type; + Flag _flags; + time_t _timestamp; + std::string _take_id; + samplepos_t _timeline_position; + bool _analysed; + mutable Glib::Threads::Mutex _lock; + mutable Glib::Threads::Mutex _analysis_lock; + gint _use_count; /* atomic */ + uint32_t _level; /* how deeply nested is this source w.r.t a disk file */ + std::string _ancestor_name; + + private: void fix_writable_flags (); }; |