X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fsource.h;h=eb204715a1fefb7a349a4bd1e3a11cbd082fadc6;hb=57df370e2abf175c3141a2e904758bfd3f95e114;hp=4af94d44b82090be2706051af64f48abec1bfad1;hpb=0a9cef7720ed9bd83442d284d18831437b80a482;p=ardour.git diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 4af94d44b8..eb204715a1 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "pbd/statefuldestructible.h" @@ -36,7 +36,7 @@ namespace ARDOUR { class Session; -class Source : public SessionObject +class LIBARDOUR_API Source : public SessionObject { public: enum Flag { @@ -47,9 +47,13 @@ class Source : public SessionObject RemovableIfEmpty = 0x10, RemoveAtDestroy = 0x20, NoPeakFile = 0x40, - Destructive = 0x80 + Destructive = 0x80, + Empty = 0x100, /* used for MIDI only */ + RF64_RIFF = 0x200, }; + typedef Glib::Threads::Mutex::Lock Lock; + Source (Session&, DataType type, const std::string& name, Flag flags=Flag(0)); Source (Session&, const XMLNode&); @@ -62,14 +66,14 @@ class Source : public SessionObject virtual bool empty () const = 0; virtual framecnt_t length (framepos_t pos) const = 0; - virtual void update_length (framepos_t pos, framecnt_t cnt) = 0; + virtual void update_length (framecnt_t cnt) = 0; virtual framepos_t natural_position() const { return 0; } void mark_for_remove(); - virtual void mark_streaming_write_started () {} - virtual void mark_streaming_write_completed () = 0; + virtual void mark_streaming_write_started (const Lock& lock) {} + virtual void mark_streaming_write_completed (const Lock& lock) = 0; virtual void session_saved() {} @@ -99,26 +103,29 @@ class Source : public SessionObject void set_allow_remove_if_empty (bool yn); - Glib::Mutex& mutex() { return _lock; } + Glib::Threads::Mutex& mutex() { return _lock; } Flag flags() const { return _flags; } - virtual void inc_use_count (); - virtual void dec_use_count (); - int use_count() const { return g_atomic_int_get (&_use_count); } - bool used() const { return use_count() > 0; } + virtual void inc_use_count (); + virtual void dec_use_count (); + int use_count() const { return g_atomic_int_get (const_cast(&_use_count)); } + bool used() const { return use_count() > 0; } 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; framepos_t _timeline_position; bool _analysed; - mutable Glib::Mutex _lock; - mutable Glib::Mutex _analysis_lock; - Glib::Mutex _playlist_lock; - gint _use_count; /* atomic */ + 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 ();