1 #ifndef AUDIOGRAPHER_PROCESS_CONTEXT_H
2 #define AUDIOGRAPHER_PROCESS_CONTEXT_H
4 #include <boost/static_assert.hpp>
5 #include <boost/format.hpp>
23 template <
typename T = DefaultSampleType>
75 throw Exception (*
this, boost::str (boost::format
76 (
"Trying to use too many samples of %1% for a new Context: %2% instead of %3%")
119 throw Exception (*
this, boost::str (boost::format
120 (
"Number of samples given to %1% was not a multiple of channels: %2% samples with %3% channels")
127 template <
typename T = DefaultSampleType>
164 template <
typename T = DefaultSampleType>
170 :
context (const_cast<T *>(data), samples, channels) {}
177 template<
typename ProcessContext>
179 :
context (other, const_cast<T *>(data), samples, channels) {}
182 template<
typename ProcessContext>
184 :
context (other, const_cast<T *>(data), samples) {}
187 template<
typename ProcessContext>
189 :
context (other, const_cast<T *>(data)) {}
A process context that allocates and owns it's data buffer.
AllocatingProcessContext(ProcessContext< Y > const &other, samplecnt_t samples)
"Copy constructor" with uninitialized data, unique sample count, but copies channel count and flags
AllocatingProcessContext(ProcessContext< Y > const &other)
"Copy constructor" uninitialized data, that copies sample and channel count + flags
AllocatingProcessContext(ProcessContext< Y > const &other, samplecnt_t samples, ChannelCount channels)
"Copy constructor" with uninitialized data, unique sample and channel count, but copies flags
AllocatingProcessContext(ProcessContext< T > const &other)
Copy constructor, copies data from other ProcessContext.
~AllocatingProcessContext()
AllocatingProcessContext(samplecnt_t samples, ChannelCount channels)
Allocates uninitialized memory.
AllocatingProcessContext(T const *data, samplecnt_t samples, ChannelCount channels)
Allocates and copies data from raw buffer.
A wrapper for a const ProcesContext which can be created from const data.
ConstProcessContext(ProcessContext const &other, T const *data, samplecnt_t samples)
"Copy constructor", with unique data and sample count, but copies channel count and flags
ConstProcessContext(ProcessContext const &other, T const *data)
"Copy constructor", with unique data, but copies sample and channel count + flags
ConstProcessContext(ProcessContext const &other, T const *data, samplecnt_t samples, ChannelCount channels)
"Copy constructor", with unique data, sample and channel count, but copies flags
ProcessContext< T > const context
ProcessContext< T > const & operator()()
ConstProcessContext(T const *data, samplecnt_t samples, ChannelCount channels)
Basic constructor with data, sample and channel count.
ConstProcessContext(ProcessContext< T > const &other)
Copy constructor from const ProcessContext.
ProcessContext< T > const * operator&()
bool has(Flag flag) const
ChannelCount const & channels() const
bool has_flag(Flag flag) const
T const * data() const
data points to the array of data to process
ProcessContext beginning(samplecnt_t samples)
Make new Context out of the beginning of this context.
ProcessContext(T *data, samplecnt_t samples, ChannelCount channels)
Basic constructor with data, sample and channel count.
BOOST_STATIC_ASSERT(boost::has_trivial_destructor< T >::value)
virtual ~ProcessContext()
ProcessContext(ProcessContext< Y > const &other, T *data)
"Copy constructor" with unique data, but copies sample and channel count + flags
static const ThrowLevel throwLevel
samplecnt_t samples_per_channel() const
Returns the amount of samples per channel.
ProcessContext(ProcessContext< T > const &other)
Normal copy constructor.
FlagField const & flags() const
samplecnt_t const & samples() const
samples tells how many samples the array pointed by data contains
void set_flag(Flag flag) const
ProcessContext(ProcessContext< Y > const &other, T *data, samplecnt_t samples)
"Copy constructor" with unique data and sample count, but copies channel count and flags
void remove_flag(Flag flag) const
ProcessContext(ProcessContext< Y > const &other, T *data, samplecnt_t samples, ChannelCount channels)
"Copy constructor" with unique data, sample and channel count, but copies flags
bool throw_level(ThrowLevel level)
static void copy(T const *source, T *destination, samplecnt_t samples)
@ ThrowProcess
Process cycle level stuff.
static std::string demangled_name(T const &obj)
Returns the demangled name of the object passed as the parameter.
#define DEFAULT_THROW_LEVEL