blip  0.1
AudioClip Class Reference

A container for audio data. More...

#include <AudioClip.hpp>

Public Types

enum  Format { Format_PCM }
 Supported audio formats. More...
 

Public Member Functions

 AudioClip (const AudioFormat &format, uint32_t maxSamples)
 Construct a new AudioClip with the given audio format and maximum size. More...
 
 ~AudioClip ()
 Destructor. More...
 
const AudioFormatgetFormat () const
 Get the audio format. More...
 
uint32_t getMaxSamples () const
 Get the maximum number of audio samples that this AudioClip can hold. More...
 
uint32_t getNumSamples () const
 Get the number of audio samples currently in this AudioClip. More...
 
void setNumSamples (uint32_t numSamples)
 Set the number of audio samples currently in this AudioClip. More...
 
const byte_t * getData () const
 Get a pointer to the audio data. More...
 
byte_t * getData ()
 Get a pointer to the audio data. More...
 
const size_t getDataLength () const
 Get the length of the audio data, in bytes. More...
 
bool isNull () const
 Test if the AudioClip is null, that is, an AudioClip with 0 samples. More...
 
void clear ()
 Clear the AudioClip. More...
 

Detailed Description

A container for audio data.

Author
Mark Lindner

Member Enumeration Documentation

◆ Format

enum Format

Supported audio formats.

Enumerator
Format_PCM 

Constructor & Destructor Documentation

◆ AudioClip()

AudioClip ( const AudioFormat format,
uint32_t  maxSamples 
)

Construct a new AudioClip with the given audio format and maximum size.

Parameters
formatThe audio format.
maxSamplesThe number of audio samples to allocate space for.

◆ ~AudioClip()

~AudioClip ( )

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Clear the AudioClip.

Sets the number of samples to 0.

◆ getData() [1/2]

const byte_t* getData ( ) const
inline

Get a pointer to the audio data.

◆ getData() [2/2]

byte_t* getData ( )
inline

Get a pointer to the audio data.

◆ getDataLength()

const size_t getDataLength ( ) const
inline

Get the length of the audio data, in bytes.

◆ getFormat()

const AudioFormat& getFormat ( ) const
inline

Get the audio format.

◆ getMaxSamples()

uint32_t getMaxSamples ( ) const
inline

Get the maximum number of audio samples that this AudioClip can hold.

◆ getNumSamples()

uint32_t getNumSamples ( ) const
inline

Get the number of audio samples currently in this AudioClip.

◆ isNull()

bool isNull ( ) const

Test if the AudioClip is null, that is, an AudioClip with 0 samples.

◆ setNumSamples()

void setNumSamples ( uint32_t  numSamples)

Set the number of audio samples currently in this AudioClip.

Parameters
numSamplesThe number of audio samples.
Exceptions
OutOfBoundsExceptionIf numSamples is greater than the maximum number of audio samples that this AudioClip can hold.

The documentation for this class was generated from the following files: