SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MusicManager Class Reference

Central place to request for musics to be loaded, played, stopped, etc... More...

#include <music_manager.hpp>

Inheritance diagram for MusicManager:
Inheritance graph
[legend]

Public Member Functions

MusicInformation * getMusicInformation (const std::string &filename)
 
void addMusicToTracks ()
 
void startMusic ()
 Special shortcut vor overworld (which skips other phases where the music would normally be started.
 
void startMusic (MusicInformation *mi, bool start_right_now=true)
 Schedules the indicated music to be played next. More...
 
void stopMusic ()
 Queues a stop current music event for the audio thread.
 
void pauseMusic ()
 Insert a command into the sfx queue to pause the current music.
 
void resumeMusic ()
 Inserts a resume current music event into the queue.
 
void switchToFastMusic ()
 Switches to fast (last lap ) music (if defined for the current music).
 
void setMasterMusicVolume (float gain)
 Sets the master music volume. More...
 
void resetTemporaryVolume ()
 Queues a command for the sfx manager to reset a temporary volume change.
 
void setTemporaryVolume (float gain)
 Queues a command to temporarily change the volume. More...
 
float getMasterMusicVolume () const
 Returns the master volume.
 
bool initialized () const
 Returns if the music system is initialised.
 
MusicInformation * getCurrentMusic ()
 Returns the information object of the current music.
 
void clearCurrentMusic ()
 Stops and removes the current music.
 

Private Member Functions

void loadMusicInformation ()
 
void loadMusicFromOneDir (const std::string &dir)
 

Private Attributes

std::atomic< MusicInformation * > m_current_music
 
bool m_initialized
 If the sound could not be initialized, e.g. More...
 
std::map< std::string, MusicInformation * > m_all_music
 Stores all music information files (read from the .music files).
 
float m_master_gain
 

Friends

class MusicInformation
 

Detailed Description

Central place to request for musics to be loaded, played, stopped, etc...

Member Function Documentation

◆ getMusicInformation()

MusicInformation * MusicManager::getMusicInformation ( const std::string &  filename)
Exceptions
runtime_errorif the music file could not be found/opened

◆ setMasterMusicVolume()

void MusicManager::setMasterMusicVolume ( float  gain)

Sets the master music volume.

Parameters
gainThe volume.

◆ setTemporaryVolume()

void MusicManager::setTemporaryVolume ( float  gain)

Queues a command to temporarily change the volume.

This is used to make the music a bit quieter while the 'last lap fanfare' is being played.

Parameters
gainThe temporary volume value.

◆ startMusic()

void MusicManager::startMusic ( MusicInformation *  mi,
bool  start_right_now = true 
)

Schedules the indicated music to be played next.

Parameters
miMusic information of the music to be played.
start_right_now

Member Data Documentation

◆ m_initialized

bool MusicManager::m_initialized
private

If the sound could not be initialized, e.g.

if the player doesn't has a sound card, we want to avoid anything sound related so we crash the game.


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