Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
switchboard::AudioPlayerSource Struct Referenceabstract

Provides an interface to provide audio data in chunks. More...

#include <AudioPlayerSource.hpp>

Inheritance diagram for switchboard::AudioPlayerSource:
switchboard::AudioPlayerMemorySource

Public Member Functions

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.
 

Protected Attributes

bool loopingEnabled { false }
 

Detailed Description

Provides an interface to provide audio data in chunks.

AudioPlayerSource interface.

It can be used to implement audio streaming.

Member Function Documentation

◆ getNumberOfChannels()

virtual const uint switchboard::AudioPlayerSource::getNumberOfChannels ( ) const
pure virtual

Get the number of channels of the audio.

Returns
The number of channels of the audio.

Implemented in switchboard::AudioPlayerMemorySource.

◆ getNumberOfFrames()

virtual const uint switchboard::AudioPlayerSource::getNumberOfFrames ( ) const
pure virtual

Get the number of frames of the audio.

Returns
The number of frames of the audio.

Implemented in switchboard::AudioPlayerMemorySource.

◆ getSampleRate()

virtual const uint switchboard::AudioPlayerSource::getSampleRate ( ) const
pure virtual

Get the sample rate of the audio.

Returns
The sample rate of the audio.

Implemented in switchboard::AudioPlayerMemorySource.

◆ isFinished()

virtual const bool switchboard::AudioPlayerSource::isFinished ( ) const
pure virtual

Check if the provided audio has reached its end.

Returns
True if the provided audio has reached its end.

Implemented in switchboard::AudioPlayerMemorySource.

◆ isLoopingEnabled()

const bool switchboard::AudioPlayerSource::isLoopingEnabled ( ) const

Indicates whether looping of the audio is enabled.

Returns
True when it is enabled, false when it is not.

◆ read()

virtual const uint switchboard::AudioPlayerSource::read ( float *  outputBuffer,
const uint  numberOfSamples 
)
pure virtual

Gets the next available chunk of audio.

Parameters
outputBufferThe buffer that will contain the output samples.
numberOfSamplesThe number of samples to put in the output buffer.
Returns
The number of "useful" audio samples put in outputBuffer.

Implemented in switchboard::AudioPlayerMemorySource.

◆ rewind()

virtual void switchboard::AudioPlayerSource::rewind ( )
pure virtual

Sets the audio position back to its start.

Implemented in switchboard::AudioPlayerMemorySource.

◆ setLoopingEnabled()

void switchboard::AudioPlayerSource::setLoopingEnabled ( bool  enabled)

Enables or disables the looping of the loaded audio.

Parameters
enabledTrue when it is enabled, false when it is not.

The documentation for this struct was generated from the following files: