audio::AudioManager
#include <AudioManager.hpp>
Public Functions
~AudioManager() =default
bool
loadBGM(const std::string & key) load a background music to be played
bool
playBGM(bool loop =true)
bool
stopBGM()
bool
setBGMVolume(float volume)
float
sf::SoundSource::Status
void
loopBGM(bool loop)
void
loadSFX(const std::string & key) load a sound effect to be played
void
playSFX(const std::string & key)
void
setSFXVolume(float volume)
float
Detailed Description
class audio::AudioManager;
This class manages all the sounds and musics of the game Basic operations on background musics and sound effects are supported
Public Functions Documentation
function ~AudioManager
~AudioManager() =default
function loadBGM
static bool loadBGM(
const std::string & key
)
load a background music to be played
Parameters:
key the key relative to the AssetLoader
Return: true if the music was loaded
function playBGM
static bool playBGM(
bool loop =true
)
Parameters:
loop if the music should loop, defaulted to true
volume the volume of the music, defaulted to 100
Return: true if the music is playing, false otherwise
play the current background music
function stopBGM
static bool stopBGM()
Return: true if the music is stopped, false otherwise
stop the current background music
function setBGMVolume
static bool setBGMVolume(
float volume
)
Parameters:
volume0 = min, 100 = max
Return: true if the volume is set, false otherwise
Set the background music volume
function getBGMVolume
static float getBGMVolume()
function getBGMStatus
static sf::SoundSource::Status getBGMStatus()
function loopBGM
static void loopBGM(
bool loop
)
Parameters:
loop true to play in loop, false to play once
Set whether or not the stream should loop after reaching the end.
function loadSFX
static void loadSFX(
const std::string & key
)
load a sound effect to be played
Parameters:
key the key relative to the AssetLoader
Warning: Do not use, this is for development only
function playSFX
static void playSFX(
const std::string & key
)
function setSFXVolume
static void setSFXVolume(
float volume
)
Parameters:
volume0 = min, 100 = max
Return: true if the volume is set, false otherwise
Set the sound effects volume
function getSFXVolume
static float getSFXVolume()
Updated on 2022-11-13 at 17:21:37 +0100
Last updated