147 if(
val > _maxSamples)
return false;
157 template <
typename T>
T *
data()
const {
158 return reinterpret_cast<T *
>(_buffer->
data());
165 size_t _maxSamples = 0;
Describes an audio format including sample type, rate, and channel count.
Definition audiodesc.h:28
unsigned int channels() const
Returns the number of audio channels.
Definition audiodesc.h:424
DataType
Enumeration of supported audio sample data types.
Definition audiodesc.h:190
bool isValid() const
Returns true if this audio description has a valid data type, sample rate, and channel count.
Definition audiodesc.h:297
bool isNative() const
Returns true if the data type is the platform's native float format.
Definition audiodesc.h:305
Object to hold some number of audio samples.
Definition audio.h:35
bool isNative() const
Returns true if the audio is in the native float32 format for this system.
Definition audio.h:71
void zero() const
Zeros out all the audio data in the buffer.
Definition audio.h:124
size_t samples() const
Returns the number of samples, irrespective of the channel count.
Definition audio.h:87
Buffer::Ptr & buffer()
Returns a mutable reference to the buffer shared pointer.
Definition audio.h:119
Audio(const AudioDesc &desc, size_t samples, const MemSpace &ms=MemSpace::Default)
Constructs an Audio object for the given descriptor and sample count.
promeki::List< Ptr > PtrList
List of shared Audio pointers.
Definition audio.h:45
const Buffer::Ptr & buffer() const
Returns a const reference to the buffer that holds the audio data.
Definition audio.h:111
T * data() const
Returns the audio data pointer cast to the given type.
Definition audio.h:157
SharedPtr< Audio > Ptr
Shared pointer type for Audio.
Definition audio.h:39
Audio convertTo(AudioDesc::DataType format) const
Converts this Audio to a different sample format.
promeki::List< Audio > List
List of Audio values.
Definition audio.h:42
size_t frames() const
Returns the total number of sample frames (samples times channels).
Definition audio.h:103
Audio()=default
Constructs an invalid Audio object.
bool resize(size_t val)
Resizes the sample count to a value between 0 and maxSamples().
Definition audio.h:146
size_t maxSamples() const
Returns the maximum number of samples this object can contain.
Definition audio.h:95
bool isValid() const
Returns true if the object is valid.
Definition audio.h:63
const AudioDesc & desc() const
Returns the AudioDesc that describes the audio contained in this object.
Definition audio.h:79
Dynamic array container wrapping std::vector.
Definition list.h:40
List()=default
Default constructor. Creates an empty list.
T * data() noexcept
Returns a pointer to the underlying contiguous storage.
Definition list.h:286
Abstraction for memory allocation in different address spaces.
Definition memspace.h:30
@ Default
Alias for System memory.
Definition memspace.h:36
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
#define PROMEKI_SHARED_FINAL(TYPE)
Macro for non-polymorphic native shared objects.
Definition sharedptr.h:88