Provides audio data from an encoded audio file. More...
#include <AudioPlayerMemorySource.hpp>
Public Member Functions | |
AudioPlayerMemorySource (const std::string &path, Codec format) | |
AudioPlayerMemorySource constructor for loading audio from file path. | |
AudioPlayerMemorySource (const std::vector< uint8 > &inputData, Codec format) | |
AudioPlayerMemorySource constructor for loading audio from encoded data. | |
const uint | getSampleRate () const override |
Get the sample rate of the audio. | |
const uint | getNumberOfChannels () const override |
Get the number of channels of the audio. | |
const uint | getNumberOfFrames () const override |
Get the number of frames of the audio. | |
const bool | isFinished () const override |
Check if the provided audio has reached its end. | |
const uint | read (float *outputBuffer, const uint numberOfSamples) override |
Gets the next available chunk of audio. | |
void | rewind () override |
Sets the audio position back to its start. | |
![]() | |
virtual | ~AudioPlayerSource ()=default |
Default destructor. | |
virtual const uint | getSampleRate () const =0 |
Get the sample rate of the audio. | |
virtual const uint | getNumberOfChannels () const =0 |
Get the number of channels of the audio. | |
virtual const uint | getNumberOfFrames () const =0 |
Get the number of frames of the audio. | |
virtual const bool | isFinished () const =0 |
Check if the provided audio has reached its end. | |
const bool | isLoopingEnabled () const |
void | setLoopingEnabled (bool enabled) |
virtual const uint | read (float *outputBuffer, const uint numberOfSamples)=0 |
Gets the next available chunk of audio. | |
virtual void | rewind ()=0 |
Sets the audio position back to its start. | |
Additional Inherited Members | |
![]() | |
bool | loopingEnabled { false } |
Provides audio data from an encoded audio file.
AudioPlayerMemorySource class.
This source loads the entire decoded audio data in memory.
switchboard::AudioPlayerMemorySource::AudioPlayerMemorySource | ( | const std::string & | path, |
Codec | format | ||
) |
AudioPlayerMemorySource constructor for loading audio from file path.
This constructor throws std::runtime_error if loading the audio file fails.
path | The path the audio file to load. |
format | The audio recording format. |
switchboard::AudioPlayerMemorySource::AudioPlayerMemorySource | ( | const std::vector< uint8 > & | inputData, |
Codec | format | ||
) |
AudioPlayerMemorySource constructor for loading audio from encoded data.
This constructor throws std::runtime_error if loading the audio data fails.
inputData | Vector containing the input data. |
format | The audio recording format. |
|
overridevirtual |
Get the number of channels of the audio.
Implements switchboard::AudioPlayerSource.
|
overridevirtual |
Get the number of frames of the audio.
Implements switchboard::AudioPlayerSource.
|
overridevirtual |
Get the sample rate of the audio.
Implements switchboard::AudioPlayerSource.
|
overridevirtual |
Check if the provided audio has reached its end.
Implements switchboard::AudioPlayerSource.
|
overridevirtual |
Gets the next available chunk of audio.
outputBuffer | The buffer that will contain the output samples. |
numberOfSamples | The number of samples to put in the output buffer. |
Implements switchboard::AudioPlayerSource.
|
overridevirtual |
Sets the audio position back to its start.
Implements switchboard::AudioPlayerSource.