Provides an abstraction around raw audio buffers stored in memory.
More...
#include <AudioBuffer.hpp>
|
| SB_WASM | AudioBuffer (uint numberOfChannels, uint numberOfFrames, bool isInterleaved, uint sampleRate, T **data) |
| | Creates an AudioBuffer instance from already allocated memory.
|
| | AudioBuffer (uint numberOfChannels, uint numberOfFrames, uint sampleRate, T *data) |
| | Creates a mono or interleaved AudioBuffer instance from already allocated memory.
|
| SB_WASM uint | getNumberOfChannels () const |
| | Returns the number of channels stored in the audio buffer.
|
| SB_WASM uint | getNumberOfFrames () const |
| | Returns the number of frames stored in the audio buffer.
|
| SB_WASM void | setNumberOfFrames (const uint newNumberOfFrames) |
| | Sets the number of frames in the buffer.
|
| SB_WASM bool | getIsInterleaved () const |
| | Returns whether the audio buffer contains interleaved or non-interleaved data. Always false if the audio buffer is mono.
|
| SB_WASM uint | getSampleRate () const |
| | Gets the sample rate of the audio buffer.
|
| SB_WASM void | setSampleRate (const uint newSampleRate) |
| | Sets the sample rate of the audio buffer.
|
| SB_WASM bool | isMono () const |
| | Returns whether the audio buffer is mono.
|
| SB_WASM T | getSample (uint channel, uint sampleIndex) const |
| | Returns a sample value from the audio buffer.
|
| SB_WASM void | setSample (uint channel, uint sampleIndex, T value) |
| | Sets a sample value in the audio buffer.
|
| SB_WASM const T * | getReadPointer (uint channel) const |
| | Returns a read pointer to the data for a channel in the audio buffer.
|
| SB_WASM T * | getWritePointer (uint channel) |
| | Returns a write pointer to the data for a channel in the audio buffer.
|
| const T ** | getReadPointer () const |
| | Returns a read pointer to the data in the audio buffer.
|
| T ** | getWritePointer () |
| | Returns a write pointer to the data in the audio buffer.
|
| void | copyFrom (const AudioBuffer< T > &srcBuffer) |
| | Copies data from another AudioBuffer instance.
|
|
void | clear () |
| | Sets all audio sample values to zero.
|
template<typename T>
class switchboard::AudioBuffer< T >
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>.
◆ AudioBuffer() [1/2]
template<typename T>
| SB_WASM switchboard::AudioBuffer< T >::AudioBuffer |
( |
uint | numberOfChannels, |
|
|
uint | numberOfFrames, |
|
|
bool | isInterleaved, |
|
|
uint | sampleRate, |
|
|
T ** | data ) |
Creates an AudioBuffer instance from already allocated memory.
- Parameters
-
| 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. |
◆ AudioBuffer() [2/2]
Creates a mono or interleaved AudioBuffer instance from already allocated memory.
- Parameters
-
| 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. |
◆ copyFrom()
Copies data from another AudioBuffer instance.
Number of channels, number of frames and interleavedness have to be identical in the two audio buffers.
- Parameters
-
| srcBuffer | The source buffer to copy data from. |
◆ getIsInterleaved()
Returns whether the audio buffer contains interleaved or non-interleaved data. Always false if the audio buffer is mono.
- Returns
- Boolean that is true if the audio data is interleaved, false otherwise or if the audio buffer is mono.
◆ getNumberOfChannels()
Returns the number of channels stored in the audio buffer.
- Returns
- The number of channels.
◆ getNumberOfFrames()
Returns the number of frames stored in the audio buffer.
- Returns
- The number of frames.
◆ getReadPointer() [1/2]
Returns a read pointer to the data in the audio buffer.
- Returns
- The read pointer the the audio buffer's data.
◆ getReadPointer() [2/2]
Returns a read pointer to the data for a channel in the audio buffer.
- Parameters
-
| channel | The index of the channel. |
- Returns
- The read pointer to the channel data.
◆ getSample()
Returns a sample value from the audio buffer.
- Parameters
-
| channel | The index of the channel. |
| sampleIndex | The index of the sample. |
- Returns
- The sample value.
◆ getSampleRate()
Gets the sample rate of the audio buffer.
- Returns
- The sample rate.
◆ getWritePointer() [1/2]
Returns a write pointer to the data in the audio buffer.
- Returns
- The write pointer the the audio buffer's data.
◆ getWritePointer() [2/2]
Returns a write pointer to the data for a channel in the audio buffer.
- Parameters
-
| channel | The index of the channel. |
- Returns
- The write pointer to the channel data.
◆ isMono()
Returns whether the audio buffer is mono.
- Returns
- Boolean that is true if the audio data is single channel, false otherwise.
◆ setNumberOfFrames()
Sets the number of frames in the buffer.
- Parameters
-
| newNumberOfFrames | The new number of frames. |
◆ setSample()
Sets a sample value in the audio buffer.
- Parameters
-
| channel | The index of the channel. |
| sampleIndex | The index of the sample. |
| value | The sample value to set. |
◆ setSampleRate()
Sets the sample rate of the audio buffer.
- Parameters
-
| newSampleRate | The new sample rate. |
The documentation for this class was generated from the following file: