Loading...
Searching...
No Matches
Public Member Functions | List of all members
switchboard::AudioPlayerNode Class Reference

AudioNode that plays the loaded audio file. More...

#include <AudioPlayerNode.hpp>

Inheritance diagram for switchboard::AudioPlayerNode:
switchboard::SingleBusAudioSourceNode switchboard::AudioSourceNode switchboard::AudioNode

Public Member Functions

 AudioPlayerNode ()
 Creates a AudioPlayerNode instance.
 
 ~AudioPlayerNode ()
 AudioPlayerNode destructor.
 
bool load (const std::string &path, Codec format)
 Loads the file on the give path to the playback buffer. Stops playback.
 
bool load (const std::vector< uint8_t > &inputData, Codec format)
 Loads the input data to the playback buffer. Stops playback.
 
void play ()
 Starts the audio playback.
 
void pause ()
 Pauses the audio playback.
 
void stop ()
 Stops the audio playback.
 
bool isPlaying ()
 
bool isLoopingEnabled ()
 
void setLoopingEnabled (bool loopingEnabled)
 
bool setBusFormat (AudioBusFormat &busFormat) override
 Sets bus format.
 
bool produce (AudioBus &bus) override
 Produces audio data in the given bus.
 
- Public Member Functions inherited from switchboard::SingleBusAudioSourceNode
virtual bool setBusFormat (AudioBusFormat &busFormat)=0
 Sets bus format.
 
virtual bool produce (AudioBus &bus)=0
 Produces audio data in the given bus.
 
bool setNumberOfBuses (const uint numberOfBuses) override
 Sets number of buses.
 
bool setBusFormats (AudioBusFormatList &busFormats) override
 Sets bus formats.
 
bool produce (AudioBusList &buses) override
 Produces audio data in the given buses.
 
virtual bool setNumberOfBuses (const uint numberOfBuses)=0
 Sets number of buses.
 
virtual bool setBusFormats (AudioBusFormatList &busFormats)=0
 Sets bus formats.
 
virtual bool produce (AudioBusList &buses)=0
 Produces audio data in the given buses.
 
- Public Member Functions inherited from switchboard::AudioNode
virtual ~AudioNode ()=default
 AudioNode virtual destructor.
 
const std::string & getType () const
 Gets the type of the audio node.
 
virtual const std::string getDisplayName () const
 Gets the display name of the audio node.
 

Additional Inherited Members

- Public Attributes inherited from switchboard::AudioNode
std::string name
 The name of the audio node.
 
- Protected Attributes inherited from switchboard::AudioNode
std::string type
 

Detailed Description

AudioNode that plays the loaded audio file.

AudioPlayerNode class.

Member Function Documentation

◆ isLoopingEnabled()

bool switchboard::AudioPlayerNode::isLoopingEnabled ( )

Indicates whether looping of the audio file is enabled.

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

◆ isPlaying()

bool switchboard::AudioPlayerNode::isPlaying ( )

Indicates whether the system is currently playing.

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

◆ load() [1/2]

bool switchboard::AudioPlayerNode::load ( const std::string &  path,
Codec  format 
)

Loads the file on the give path to the playback buffer. Stops playback.

Parameters
pathThe path the audio file to load.
formatThe audio recording format.
Returns
True when loading of the file was successful.

◆ load() [2/2]

bool switchboard::AudioPlayerNode::load ( const std::vector< uint8_t > &  inputData,
Codec  format 
)

Loads the input data to the playback buffer. Stops playback.

Parameters
inputDataVector containing the input data.
formatThe audio recording format.
Returns
True when the load was successful.

◆ produce()

bool switchboard::AudioPlayerNode::produce ( AudioBus bus)
overridevirtual

Produces audio data in the given bus.

Should be overridden by subclasses.

Parameters
busThe bus that should be filled with audio data.
Returns
True if audio was produced successfully, false otherwise.

Implements switchboard::SingleBusAudioSourceNode.

◆ setBusFormat()

bool switchboard::AudioPlayerNode::setBusFormat ( AudioBusFormat busFormat)
overridevirtual

Sets bus format.

Should be overridden by subclasses.

Parameters
busFormatThe bus format to set.
Returns
True if the bus format was set successfully, false otherwise.

Implements switchboard::SingleBusAudioSourceNode.

◆ setLoopingEnabled()

void switchboard::AudioPlayerNode::setLoopingEnabled ( bool  loopingEnabled)

Indicates whether looping of the audio file is enabled.

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

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