11#include <switchboard_core/SwitchboardCore.hpp>
13namespace switchboard {
34 SB_WASM
AudioBuffer(uint numberOfChannels, uint numberOfFrames,
bool isInterleaved, uint sampleRate, T** data);
44 AudioBuffer(uint numberOfChannels, uint numberOfFrames, uint sampleRate, T* data);
103 SB_WASM T
getSample(uint channel, uint sampleIndex) const;
112 SB_WASM
void setSample(uint channel, uint sampleIndex, T value);
160 uint numberOfChannels;
167 uint getBufferSizeBytes() const;
168 uint getNumberOfBuffers() const;
SB_WASM const T * getReadPointer(uint channel) const
Returns a read pointer to the data for a channel in the audio buffer.
SB_WASM uint getNumberOfFrames() const
Returns the number of frames stored in the audio buffer.
SB_WASM void setSample(uint channel, uint sampleIndex, T value)
Sets a sample value in the audio buffer.
SB_WASM bool getIsInterleaved() const
Returns whether the audio buffer contains interleaved or non-interleaved data. Always false if the au...
SB_WASM T getSample(uint channel, uint sampleIndex) const
Returns a sample value from the audio buffer.
SB_WASM bool isMono() const
Returns whether the audio buffer is mono.
SB_WASM void setNumberOfFrames(const uint newNumberOfFrames)
Sets the number of frames in the buffer.
void copyFrom(const AudioBuffer< T > &srcBuffer)
Copies data from another AudioBuffer instance.
SB_WASM AudioBuffer(uint numberOfChannels, uint numberOfFrames, bool isInterleaved, uint sampleRate, T **data)
Creates an AudioBuffer instance from already allocated memory.
SB_WASM void setSampleRate(const uint newSampleRate)
Sets the sample rate of the audio buffer.
void clear()
Sets all audio sample values to zero.
SB_WASM T * getWritePointer(uint channel)
Returns a write pointer to the data for a channel in the audio buffer.
SB_WASM uint getNumberOfChannels() const
Returns the number of channels stored in the audio buffer.
SB_WASM uint getSampleRate() const
Gets the sample rate of the audio buffer.