SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | 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

MusicInformationgetMusicInformation (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. More...
 
bool initialized () const
 Returns if the music system is initialised. More...
 
MusicInformationgetCurrentMusic ()
 Returns the information object of the current music. More...
 
void clearCurrentMusic ()
 Stops and removes the current music. More...
 

Private Member Functions

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

Private Attributes

MusicInformationm_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). More...
 
float m_master_gain
 

Detailed Description

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

Member Function Documentation

◆ clearCurrentMusic()

void MusicManager::clearCurrentMusic ( )
inline

Stops and removes the current music.

◆ getCurrentMusic()

MusicInformation* MusicManager::getCurrentMusic ( )
inline

Returns the information object of the current music.

◆ getMasterMusicVolume()

float MusicManager::getMasterMusicVolume ( ) const
inline

Returns the master volume.

◆ getMusicInformation()

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

◆ initialized()

bool MusicManager::initialized ( ) const
inline

Returns if the music system is initialised.

◆ 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_all_music

std::map<std::string, MusicInformation*> MusicManager::m_all_music
private

Stores all music information files (read from the .music files).

◆ 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: