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