Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Member Functions | List of all members
om::sound::base::SoundFrame Class Reference

A class that provides all of the information needed for a SoundFilter to process sound data. More...

#include <omSoundFrame.h>

Public Member Functions

 SoundFrame ()
 Create a new sound sound frame which has no buffers and the default capacity. More...
 
 SoundFrame (Size newNumBuffers)
 Create a new sound sound frame which has the specified number of buffers (initially all NULL). More...
 
 SoundFrame (SoundBuffer *newBuffer)
 Create a new sound sound frame which wraps a single SoundBuffer object pointer. More...
 
 SoundFrame (SoundBuffer *newBuffer1, SoundBuffer *newBuffer2)
 Create a new sound sound frame which wraps two SoundBuffer object pointers. More...
 
 SoundFrame (const SoundFrame &other)
 Create an exact copy of the specified sound frame, copying all of its buffer pointers. More...
 
 ~SoundFrame ()
 Destroy a sound sound frame and release all of its resources. More...
 
SoundFrameoperator= (const SoundFrame &other)
 Assign the contents of the specified sound frame, including its buffer pointers. More...
 
Size getBufferCount () const
 Get the number of buffers that this sound frame contains. More...
 
void setBufferCount (Size newNumBuffers)
 Change the size of the internal buffer array, padding any new buffer pointers with NULL. More...
 
SoundBuffergetBuffer (Index bufferIndex)
 Return the SoundBuffer within this sound frame at the specified index. More...
 
const SoundBuffergetBuffer (Index bufferIndex) const
 Return the SoundBuffer within this sound frame at the specified index. More...
 
void setBuffer (Index bufferIndex, SoundBuffer *newBuffer)
 Replace the SoundBuffer pointer at the specified index with a new pointer. More...
 
void addBuffer (SoundBuffer *newBuffer)
 Add the specified buffer pointer to the end of this frame's list of buffers. More...
 
void insertBuffer (Index newBufferIndex, SoundBuffer *newBuffer)
 Insert the specified buffer pointer at the specified index in this frame's list of buffers. More...
 
void removeBuffer (Index bufferIndex)
 Remove the buffer from this sound frame at the specified index. More...
 
void clearBuffers ()
 Remove all buffers from this sound frame. More...
 
void setBuffersToNull ()
 Keep the current number of valid buffers the same, but set all buffer pointers to NULL. More...
 
Size getMIDIBufferCount () const
 Get the number of MIDI buffers that this sound frame contains. More...
 
void setMIDIBufferCount (Size newNumBuffers)
 Change the size of the internal MIDI buffer array, padding any new buffer pointers with NULL. More...
 
MIDIBuffergetMIDIBuffer (Index bufferIndex)
 Return a pointer to the MIDI buffer within this sound frame at the specified index. More...
 
const MIDIBuffergetMIDIBuffer (Index bufferIndex) const
 Return the MIDI buffer within this sound frame at the specified index. More...
 
void setMIDIBuffer (Index bufferIndex, MIDIBuffer *newBuffer)
 Replace the MIDI buffer pointer at the specified index with a new pointer. More...
 
void addMIDIBuffer (MIDIBuffer *newBuffer)
 Add the specified MIDI buffer pointer to the end of this frame's list of MIDI buffers. More...
 
void insertMIDIBuffer (Index newBufferIndex, MIDIBuffer *newBuffer)
 Insert the specified MIDI buffer pointer at the specified index in this frame's list of MIDI buffers. More...
 
void removeMIDIBuffer (Index bufferIndex)
 Remove the MIDI buffer from this sound frame at the specified index. More...
 
void clearMIDIBuffers ()
 Remove all MIDI buffers from this sound frame. More...
 
void setMIDIBuffersToNull ()
 Keep the current number of valid MIDI buffers the same, but set all buffer pointers to NULL. More...
 
void copyTo (SoundFrame &other) const
 Copy this sound sound frame's entire data to another frame, replacing its data. More...
 
void copyMIDITo (SoundFrame &other) const
 Copy this sound sound frame's MIDI data to another frame, replacing its MIDI data. More...
 
const TimegetTime () const
 Return the absolute time of the start of this sound frame. More...
 
void setTime (const Time &newTime)
 Set the absolute time of the start of this sound frame. More...
 

Static Public Member Functions

static Size getMaximumNumberOfBuffers ()
 Return the maximum number of sound buffers that a sound sound frame can have. More...
 
static Size getMaximumNumberOfMIDIBuffers ()
 Return the maximum number of MIDI buffers that a sound sound frame can have. More...
 

Detailed Description

A class that provides all of the information needed for a SoundFilter to process sound data.

Primarily, a sound frame holds an internal array of pointers to SoundBuffer objects which represent the buffers for each filter input or output. These buffers are allowed to be NULL, indicating that either the input at that index was not provided or the output at that index is not needed.

A sound frame uses a fixed-size internal array of pointers to SoundBuffer objects but can also allocate a variable-sized array of buffer pointers if the capacity of the fixed size array is exceeded. This is done for performance, so that an allocation is not performed in most cases when using multiple buffers.

A similar buffer scheme is used for MIDI data. All MIDI events that are part of a frame are specified with their timestamp relative to the main frame absolute timestamp, rather than as absolute timestamps.

Each sound frame has an associated absolute timestamp, measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). This allows the filter to detect breaks in the sound timeline and react accordingly, or to synchronize sound processing, such as with video.

Constructor & Destructor Documentation

om::sound::base::SoundFrame::SoundFrame ( )
inline

Create a new sound sound frame which has no buffers and the default capacity.

om::sound::base::SoundFrame::SoundFrame ( Size  newNumBuffers)
inline

Create a new sound sound frame which has the specified number of buffers (initially all NULL).

om::sound::base::SoundFrame::SoundFrame ( SoundBuffer newBuffer)
inline

Create a new sound sound frame which wraps a single SoundBuffer object pointer.

om::sound::base::SoundFrame::SoundFrame ( SoundBuffer newBuffer1,
SoundBuffer newBuffer2 
)
inline

Create a new sound sound frame which wraps two SoundBuffer object pointers.

om::sound::base::SoundFrame::SoundFrame ( const SoundFrame other)

Create an exact copy of the specified sound frame, copying all of its buffer pointers.

om::sound::base::SoundFrame::~SoundFrame ( )
inline

Destroy a sound sound frame and release all of its resources.

Member Function Documentation

SoundFrame& om::sound::base::SoundFrame::operator= ( const SoundFrame other)

Assign the contents of the specified sound frame, including its buffer pointers.

Size om::sound::base::SoundFrame::getBufferCount ( ) const
inline

Get the number of buffers that this sound frame contains.

void om::sound::base::SoundFrame::setBufferCount ( Size  newNumBuffers)
inline

Change the size of the internal buffer array, padding any new buffer pointers with NULL.

If the number of buffers is increasing, the new buffer pointers for the sound frame are set to NULL. Otherwise, if the number is decreasing, the extra buffer pointers are discarded.

SoundBuffer* om::sound::base::SoundFrame::getBuffer ( Index  bufferIndex)
inline

Return the SoundBuffer within this sound frame at the specified index.

const SoundBuffer* om::sound::base::SoundFrame::getBuffer ( Index  bufferIndex) const
inline

Return the SoundBuffer within this sound frame at the specified index.

void om::sound::base::SoundFrame::setBuffer ( Index  bufferIndex,
SoundBuffer newBuffer 
)
inline

Replace the SoundBuffer pointer at the specified index with a new pointer.

void om::sound::base::SoundFrame::addBuffer ( SoundBuffer newBuffer)
inline

Add the specified buffer pointer to the end of this frame's list of buffers.

void om::sound::base::SoundFrame::insertBuffer ( Index  newBufferIndex,
SoundBuffer newBuffer 
)
inline

Insert the specified buffer pointer at the specified index in this frame's list of buffers.

void om::sound::base::SoundFrame::removeBuffer ( Index  bufferIndex)
inline

Remove the buffer from this sound frame at the specified index.

This method shifts all buffer pointers after the specified index back by one index to replace the removed buffer.

void om::sound::base::SoundFrame::clearBuffers ( )
inline

Remove all buffers from this sound frame.

void om::sound::base::SoundFrame::setBuffersToNull ( )
inline

Keep the current number of valid buffers the same, but set all buffer pointers to NULL.

Size om::sound::base::SoundFrame::getMIDIBufferCount ( ) const
inline

Get the number of MIDI buffers that this sound frame contains.

void om::sound::base::SoundFrame::setMIDIBufferCount ( Size  newNumBuffers)
inline

Change the size of the internal MIDI buffer array, padding any new buffer pointers with NULL.

If the number of MIDI buffers is increasing, the new buffer pointers for the sound frame are set to NULL. Otherwise, if the number is decreasing, the extra buffer pointers are discarded.

MIDIBuffer* om::sound::base::SoundFrame::getMIDIBuffer ( Index  bufferIndex)
inline

Return a pointer to the MIDI buffer within this sound frame at the specified index.

const MIDIBuffer* om::sound::base::SoundFrame::getMIDIBuffer ( Index  bufferIndex) const
inline

Return the MIDI buffer within this sound frame at the specified index.

void om::sound::base::SoundFrame::setMIDIBuffer ( Index  bufferIndex,
MIDIBuffer newBuffer 
)
inline

Replace the MIDI buffer pointer at the specified index with a new pointer.

void om::sound::base::SoundFrame::addMIDIBuffer ( MIDIBuffer newBuffer)
inline

Add the specified MIDI buffer pointer to the end of this frame's list of MIDI buffers.

void om::sound::base::SoundFrame::insertMIDIBuffer ( Index  newBufferIndex,
MIDIBuffer newBuffer 
)
inline

Insert the specified MIDI buffer pointer at the specified index in this frame's list of MIDI buffers.

void om::sound::base::SoundFrame::removeMIDIBuffer ( Index  bufferIndex)
inline

Remove the MIDI buffer from this sound frame at the specified index.

This method shifts all MIDI buffer pointers after the specified index back by one index to replace the removed buffer.

void om::sound::base::SoundFrame::clearMIDIBuffers ( )
inline

Remove all MIDI buffers from this sound frame.

void om::sound::base::SoundFrame::setMIDIBuffersToNull ( )
inline

Keep the current number of valid MIDI buffers the same, but set all buffer pointers to NULL.

void om::sound::base::SoundFrame::copyTo ( SoundFrame other) const

Copy this sound sound frame's entire data to another frame, replacing its data.

This method is provided as a convenient way to pass through MIDI and audio from an input frame to an output frame if the filter doesn't need to modify the data.

The method iterates over the MIDI and sound buffers in this frame and copies their contents to the corresponding buffers of the other frame if it exists, replacing the previous contents of the other buffer.

void om::sound::base::SoundFrame::copyMIDITo ( SoundFrame other) const

Copy this sound sound frame's MIDI data to another frame, replacing its MIDI data.

This method is provided as a convenient way to pass through MIDI from an input frame to an output frame if the filter doesn't need to modify the MIDI data.

The method iterates over the MIDI buffers in this frame and copies their contents to the corresponding MIDI buffer of the other frame if it exists, replacing the previous contents of the other buffer.

const Time& om::sound::base::SoundFrame::getTime ( ) const
inline

Return the absolute time of the start of this sound frame.

This is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

void om::sound::base::SoundFrame::setTime ( const Time newTime)
inline

Set the absolute time of the start of this sound frame.

This is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

static Size om::sound::base::SoundFrame::getMaximumNumberOfBuffers ( )
inlinestatic

Return the maximum number of sound buffers that a sound sound frame can have.

static Size om::sound::base::SoundFrame::getMaximumNumberOfMIDIBuffers ( )
inlinestatic

Return the maximum number of MIDI buffers that a sound sound frame can have.


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