SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
MusicInformation Class Reference

Wrapper around an instance of the Music interface Adds information like composer, song title, etc... Delegates many calls to the underlying Music instance. More...

#include <music_information.hpp>

Inheritance diagram for MusicInformation:
Inheritance graph
[legend]

Public Member Functions

void addMusicToTracks ()
 
bool isPlaying () const
 
const stringw & getComposer () const
 Returns the composer of the music.
 
const stringw & getTitle () const
 Returns the title of the music.
 
const std::string & getNormalFilename () const
 Returns the filename of the normal speed music.
 
const std::string & getFastFilename () const
 If available, returns the file name of the faster/last-lap music.
 
float getMaxPitch () const
 

Static Public Member Functions

static MusicInformationcreate (const std::string &filename)
 A simple factory to create music information files without raising an exception on error, instead a NULL will be returned.
 

Private Types

enum  { SOUND_NORMAL , SOUND_FADING , SOUND_FASTER , SOUND_FAST }
 

Private Member Functions

 MusicInformation (const XMLNode *root, const std::string &filename)
 
void update (float dt)
 
void startMusic ()
 Starts the music.
 
void stopMusic ()
 
void pauseMusic ()
 
void resumeMusic ()
 
void setDefaultVolume ()
 
void switchToFastMusic ()
 
void setTemporaryVolume (float volume)
 Overwrites the current volume with a temporary value (used e.g.
 
bool preStart ()
 Return false if it should not be started, done in sfx thread.
 
void setMusicWaiting ()
 Sets the music to be waiting, i.e.
 

Private Attributes

stringw m_composer
 
stringw m_title
 
std::string m_normal_filename
 
std::string m_fast_filename
 
std::vector< std::string > m_all_tracks
 
bool m_music_waiting
 If music is loaded but hasn't been started yet (MusicManager::startMusic() was told not to start right away).
 
bool m_enable_fast
 If faster music is enabled at all (either separate file or using the pitch shift approach).
 
float m_gain
 
float m_normal_loop_start
 
float m_fast_loop_start
 
float m_normal_loop_end
 
float m_fast_loop_end
 
float m_faster_time
 Either time for fading faster music in, or time to change pitch.
 
float m_max_pitch
 Maximum pitch for faster music.
 
std::mutex m_music_mutex
 
Musicm_normal_music
 
Musicm_fast_music
 
enum MusicInformation:: { ... }  m_mode
 < playing faster music or max pitch reached
 
float m_time_since_faster
 

Static Private Attributes

static const int LOOP_FOREVER =-1
 

Friends

class SFXManager
 

Detailed Description

Wrapper around an instance of the Music interface Adds information like composer, song title, etc... Delegates many calls to the underlying Music instance.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
SOUND_NORMAL 

normal music is played

SOUND_FADING 

normal music fading out, faster fading in

SOUND_FASTER 

change pitch of normal music

Member Function Documentation

◆ create()

MusicInformation * MusicInformation::create ( const std::string &  filename)
static

A simple factory to create music information files without raising an exception on error, instead a NULL will be returned.

This avoids resource freeing problems if the exception is raised, and simplifies calling code.

Parameters
filenameThe name of a music file.
Returns
The MusicInformation object, or NULL in case of an error.

◆ setMusicWaiting()

void MusicInformation::setMusicWaiting ( )
inlineprivate

Sets the music to be waiting, i.e.

startMusic still needs to be called. Used to pre-load track music during track loading time.

◆ setTemporaryVolume()

void MusicInformation::setTemporaryVolume ( float  volume)
private

Overwrites the current volume with a temporary value (used e.g.

to fade from normal music to last lap music).


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