|
Switchboard Extension SDK
|
Provides an abstraction around raw audio buffers stored in memory. More...
#include <AudioBuffer.hpp>
Public Member Functions | |
| AudioBuffer (uint numberOfChannels, uint numberOfFrames, bool isInterleaved, uint sampleRate, T **data) SWITCHBOARD_REALTIME | |
| Creates an AudioBuffer instance from already allocated memory. | |
| AudioBuffer (uint numberOfChannels, uint numberOfFrames, uint sampleRate, T *data) SWITCHBOARD_REALTIME | |
| Creates a mono or interleaved AudioBuffer instance from already allocated memory. | |
| uint | getNumberOfChannels () const SWITCHBOARD_REALTIME |
| Returns the number of channels stored in the audio buffer. | |
| uint | getNumberOfFrames () const SWITCHBOARD_REALTIME |
| Returns the number of frames stored in the audio buffer. | |
| void | setNumberOfFrames (const uint newNumberOfFrames) SWITCHBOARD_REALTIME |
| Sets the number of frames in the buffer. | |
| bool | getIsInterleaved () const SWITCHBOARD_REALTIME |
| Returns whether the audio buffer contains interleaved or non-interleaved data. Always false if the audio buffer is mono. | |
| uint | getSampleRate () const SWITCHBOARD_REALTIME |
| Gets the sample rate of the audio buffer. | |
| void | setSampleRate (const uint newSampleRate) SWITCHBOARD_REALTIME |
| Sets the sample rate of the audio buffer. | |
| bool | isMono () const SWITCHBOARD_REALTIME |
| Returns whether the audio buffer is mono. | |
| T | getSample (uint channel, uint sampleIndex) const SWITCHBOARD_REALTIME |
| Returns a sample value from the audio buffer. | |
| void | setSample (uint channel, uint sampleIndex, T value) SWITCHBOARD_REALTIME |
| Sets a sample value in the audio buffer. | |
| const T * | getReadPointer (uint channel) const SWITCHBOARD_REALTIME |
| Returns a read pointer to the data for a channel in the audio buffer. | |
| T * | getWritePointer (uint channel) SWITCHBOARD_REALTIME |
| Returns a write pointer to the data for a channel in the audio buffer. | |
| const T ** | getReadPointer () const SWITCHBOARD_REALTIME |
| Returns a read pointer to the data in the audio buffer. | |
| T ** | getWritePointer () SWITCHBOARD_REALTIME |
| Returns a write pointer to the data in the audio buffer. | |
| void | copyFrom (const AudioBuffer< T > &srcBuffer) SWITCHBOARD_REALTIME |
| Copies data from another AudioBuffer instance. | |
| void | clear () SWITCHBOARD_REALTIME |
| Sets all audio sample values to zero. | |
Provides an abstraction around raw audio buffers stored in memory.
AudioBuffer template class.
Can be used with multiple data types such as AudioBuffer<float> or AudioBuffer<int16>.
| switchboard::AudioBuffer< T >::AudioBuffer | ( | uint | numberOfChannels, |
| uint | numberOfFrames, | ||
| bool | isInterleaved, | ||
| uint | sampleRate, | ||
| T ** | data ) |
Creates an AudioBuffer instance from already allocated memory.
| numberOfChannels | The number of channels. |
| numberOfFrames | The number of frames. |
| isInterleaved | Flag indicating whether audio data should be interleaved or non-interleaved. Only effective when numberOfChannels > 1. |
| sampleRate | The sample rate of the audio buffer. |
| data | Pointer to the pre-allocated stacked audio memory location. |
| switchboard::AudioBuffer< T >::AudioBuffer | ( | uint | numberOfChannels, |
| uint | numberOfFrames, | ||
| uint | sampleRate, | ||
| T * | data ) |
Creates a mono or interleaved AudioBuffer instance from already allocated memory.
| numberOfChannels | The number of channels. |
| numberOfFrames | The number of frames. |
| sampleRate | The sample rate of the audio buffer. |
| data | Pointer to the pre-allocated mono or interleaved memory location. |
| void switchboard::AudioBuffer< T >::copyFrom | ( | const AudioBuffer< T > & | srcBuffer | ) |
Copies data from another AudioBuffer instance.
Number of channels, number of frames and interleavedness have to be identical in the two audio buffers.
| srcBuffer | The source buffer to copy data from. |
| bool switchboard::AudioBuffer< T >::getIsInterleaved | ( | ) | const |
Returns whether the audio buffer contains interleaved or non-interleaved data. Always false if the audio buffer is mono.
| uint switchboard::AudioBuffer< T >::getNumberOfChannels | ( | ) | const |
Returns the number of channels stored in the audio buffer.
| uint switchboard::AudioBuffer< T >::getNumberOfFrames | ( | ) | const |
Returns the number of frames stored in the audio buffer.
| const T ** switchboard::AudioBuffer< T >::getReadPointer | ( | ) | const |
Returns a read pointer to the data in the audio buffer.
| const T * switchboard::AudioBuffer< T >::getReadPointer | ( | uint | channel | ) | const |
Returns a read pointer to the data for a channel in the audio buffer.
| channel | The index of the channel. |
| T switchboard::AudioBuffer< T >::getSample | ( | uint | channel, |
| uint | sampleIndex ) const |
Returns a sample value from the audio buffer.
| channel | The index of the channel. |
| sampleIndex | The index of the sample. |
| uint switchboard::AudioBuffer< T >::getSampleRate | ( | ) | const |
Gets the sample rate of the audio buffer.
| T ** switchboard::AudioBuffer< T >::getWritePointer | ( | ) |
Returns a write pointer to the data in the audio buffer.
| T * switchboard::AudioBuffer< T >::getWritePointer | ( | uint | channel | ) |
Returns a write pointer to the data for a channel in the audio buffer.
| channel | The index of the channel. |
| bool switchboard::AudioBuffer< T >::isMono | ( | ) | const |
Returns whether the audio buffer is mono.
| void switchboard::AudioBuffer< T >::setNumberOfFrames | ( | const uint | newNumberOfFrames | ) |
Sets the number of frames in the buffer.
| newNumberOfFrames | The new number of frames. |
| void switchboard::AudioBuffer< T >::setSample | ( | uint | channel, |
| uint | sampleIndex, | ||
| T | value ) |
Sets a sample value in the audio buffer.
| channel | The index of the channel. |
| sampleIndex | The index of the sample. |
| value | The sample value to set. |
| void switchboard::AudioBuffer< T >::setSampleRate | ( | const uint | newSampleRate | ) |
Sets the sample rate of the audio buffer.
| newSampleRate | The new sample rate. |