X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Faudiographer%2Faudiographer%2Fprocess_context.h;h=16e637b85c4bf6df32e33313488f7b9da2453d9c;hb=21bf61d559c1b6685029cf0dbd662d57c90cac7e;hp=36abd4fba0ddd477728912efeeb9f31f872cd288;hpb=1745340c67d66d8dd92e5b3a377e935ed5eea973;p=ardour.git diff --git a/libs/audiographer/audiographer/process_context.h b/libs/audiographer/audiographer/process_context.h index 36abd4fba0..16e637b85c 100644 --- a/libs/audiographer/audiographer/process_context.h +++ b/libs/audiographer/audiographer/process_context.h @@ -45,30 +45,30 @@ public: ProcessContext (T * data, framecnt_t frames, ChannelCount channels) : _data (data), _frames (frames), _channels (channels) { validate_data(); } - + /// Normal copy constructor ProcessContext (ProcessContext const & other) : Throwing(), _data (other._data), _frames (other._frames), _channels (other._channels), _flags (other._flags) { /* No need to validate data */ } - + /// "Copy constructor" with unique data, frame and channel count, but copies flags template ProcessContext (ProcessContext const & other, T * data, framecnt_t frames, ChannelCount channels) : Throwing(), _data (data), _frames (frames), _channels (channels), _flags (other.flags()) { validate_data(); } - + /// "Copy constructor" with unique data and frame count, but copies channel count and flags template ProcessContext (ProcessContext const & other, T * data, framecnt_t frames) : Throwing(), _data (data), _frames (frames), _channels (other.channels()), _flags (other.flags()) { validate_data(); } - + /// "Copy constructor" with unique data, but copies frame and channel count + flags template ProcessContext (ProcessContext const & other, T * data) : Throwing(), _data (data), _frames (other.frames()), _channels (other.channels()), _flags (other.flags()) { /* No need to validate data */ } - + /// Make new Context out of the beginning of this context ProcessContext beginning (framecnt_t frames) { @@ -78,39 +78,39 @@ public: % DebugUtils::demangled_name (*this) % frames % _frames)); } validate_data (); - + return ProcessContext (*this, _data, frames); } - + virtual ~ProcessContext () {} - + /// \a data points to the array of data to process inline T const * data() const { return _data; } inline T * data() { return _data; } - + /// \a frames tells how many frames the array pointed by data contains inline framecnt_t const & frames() const { return _frames; } - + /** \a channels tells how many interleaved channels \a data contains * If \a channels is greater than 1, each channel contains \a frames / \a channels frames of data */ inline ChannelCount const & channels() const { return _channels; } - + /// Returns the amount of frames per channel inline framecnt_t frames_per_channel() const { return _frames / _channels; } /* Flags */ - + inline bool has_flag (Flag flag) const { return _flags.has (flag); } inline void set_flag (Flag flag) const { _flags.set (flag); } inline void remove_flag (Flag flag) const { _flags.remove (flag); } inline FlagField const & flags () const { return _flags; } - + protected: T * const _data; framecnt_t _frames; ChannelCount _channels; - + mutable FlagField _flags; private: @@ -132,32 +132,32 @@ public: /// Allocates uninitialized memory AllocatingProcessContext (framecnt_t frames, ChannelCount channels) : ProcessContext (new T[frames], frames, channels) {} - + /// Allocates and copies data from raw buffer AllocatingProcessContext (T const * data, framecnt_t frames, ChannelCount channels) : ProcessContext (new T[frames], frames, channels) { TypeUtils::copy (data, ProcessContext::_data, frames); } - + /// Copy constructor, copies data from other ProcessContext AllocatingProcessContext (ProcessContext const & other) : ProcessContext (other, new T[other._frames]) { TypeUtils::copy (ProcessContext::_data, other._data, other._frames); } - + /// "Copy constructor" with uninitialized data, unique frame and channel count, but copies flags template AllocatingProcessContext (ProcessContext const & other, framecnt_t frames, ChannelCount channels) : ProcessContext (other, new T[frames], frames, channels) {} - + /// "Copy constructor" with uninitialized data, unique frame count, but copies channel count and flags template AllocatingProcessContext (ProcessContext const & other, framecnt_t frames) : ProcessContext (other, new T[frames], frames, other.channels()) {} - + /// "Copy constructor" uninitialized data, that copies frame and channel count + flags template AllocatingProcessContext (ProcessContext const & other) : ProcessContext (other, new T[other._frames]) {} - + ~AllocatingProcessContext () { delete [] ProcessContext::_data; } }; @@ -169,21 +169,21 @@ class /*LIBAUDIOGRAPHER_API*/ ConstProcessContext /// Basic constructor with data, frame and channel count ConstProcessContext (T const * data, framecnt_t frames, ChannelCount channels) : context (const_cast(data), frames, channels) {} - + /// Copy constructor from const ProcessContext ConstProcessContext (ProcessContext const & other) : context (const_cast &> (other)) {} - + /// "Copy constructor", with unique data, frame and channel count, but copies flags template ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames, ChannelCount channels) : context (other, const_cast(data), frames, channels) {} - + /// "Copy constructor", with unique data and frame count, but copies channel count and flags template ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames) : context (other, const_cast(data), frames) {} - + /// "Copy constructor", with unique data, but copies frame and channel count + flags template ConstProcessContext (ProcessContext const & other, T const * data)