VoxelEngine
 
Loading...
Searching...
No Matches
engine::Audio Class Reference

Public Member Functions

void play ()
 Plays the audio with the current settings.
 
void stop ()
 Stops the audio.
 
void restart ()
 Restarts the audio.
 
bool finished () const
 Checks if the audio has finished playing.
 
void pause ()
 
void resume ()
 
bool isPaused () const
 
bool isPlaying () const
 
void setVolume (float volume)
 
void setLooping (bool looping)
 
void setPosition (const glm::vec3 &position)
 
void setVelocity (const glm::vec3 &velocity)
 
void applySettings (const AudioSettings &settings)
 Applies the given settings to the audio.
 
void playWithSettings (const AudioSettings &settings, bool saveSettings=false)
 Plays the audio with the given settings.
 
const AudioSettingsgetSettings () const
 

Friends

class AudioManager
 

Member Function Documentation

◆ applySettings()

void Audio::applySettings ( const AudioSettings settings)

Applies the given settings to the audio.

Parameters
settingsThe settings to apply to the audio.
Note
It will be used rightaway for currently playing audio and for future plays.

◆ finished()

bool Audio::finished ( ) const

Checks if the audio has finished playing.

Returns
True if the audio has finished playing, false otherwise.

◆ play()

void Audio::play ( )

Plays the audio with the current settings.

Note
For effects, it will spawn a new instance of the audio and it is not possible to control the settings of previous instances. If you need to control settings of all instances, use AudioManager::playEffect and store the Audio object.

◆ playWithSettings()

void Audio::playWithSettings ( const AudioSettings settings,
bool  saveSettings = false 
)

Plays the audio with the given settings.

Parameters
settingsThe settings to apply to the audio.
saveSettingsIf true, the settings will be saved and used for future plays.
Note
If the audio is already playing, it will restart.
If the audio is later restarted and saveSettings is false, this settings will be lost.

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