Updated documentation and minor style changes.
This commit is contained in:
parent
0b0c1fbaee
commit
c37e1eec0d
@ -137,6 +137,8 @@ void MusicInformation::addMusicToTracks()
|
||||
} // addMusicToTracks
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Starts the music.
|
||||
*/
|
||||
void MusicInformation::startMusic()
|
||||
{
|
||||
m_time_since_faster = 0.0f;
|
||||
@ -153,7 +155,7 @@ void MusicInformation::startMusic()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_normal_music != NULL) delete m_normal_music;
|
||||
if (m_normal_music) delete m_normal_music;
|
||||
|
||||
#if HAVE_OGGVORBIS
|
||||
m_normal_music = new MusicOggStream();
|
||||
@ -175,7 +177,7 @@ void MusicInformation::startMusic()
|
||||
|
||||
// Then (if available) load the music for the last track
|
||||
// -----------------------------------------------------
|
||||
if (m_fast_music != NULL) delete m_fast_music;
|
||||
if (m_fast_music) delete m_fast_music;
|
||||
if (m_fast_filename == "")
|
||||
{
|
||||
m_fast_music = NULL;
|
||||
@ -246,14 +248,12 @@ void MusicInformation::update(float dt)
|
||||
break;
|
||||
}
|
||||
case SOUND_NORMAL:
|
||||
if ( m_normal_music == NULL ) break;
|
||||
|
||||
m_normal_music->update();
|
||||
if ( m_normal_music )
|
||||
m_normal_music->update();
|
||||
break;
|
||||
case SOUND_FAST:
|
||||
if ( m_fast_music == NULL ) break;
|
||||
|
||||
m_fast_music->update();
|
||||
if ( m_fast_music )
|
||||
m_fast_music->update();
|
||||
break;
|
||||
} // switch
|
||||
|
||||
|
@ -84,26 +84,38 @@ public:
|
||||
#endif
|
||||
~MusicInformation ();
|
||||
static MusicInformation *create(const std::string &filename);
|
||||
const stringw& getComposer () const {return m_composer; }
|
||||
const stringw& getTitle () const {return m_title; }
|
||||
const std::string& getNormalFilename() const {return m_normal_filename; }
|
||||
const std::string& getFastFilename () const {return m_fast_filename; }
|
||||
//int getNumLoops () const {return m_numLoops; }
|
||||
float getFasterTime () const {return m_faster_time; }
|
||||
float getMaxPitch () const {return m_max_pitch; }
|
||||
void setMusicWaiting () {m_music_waiting = true;}
|
||||
void addMusicToTracks ();
|
||||
void update (float dt);
|
||||
void startMusic ();
|
||||
void stopMusic ();
|
||||
void pauseMusic ();
|
||||
void resumeMusic ();
|
||||
void volumeMusic (float gain);
|
||||
|
||||
void addMusicToTracks();
|
||||
void update(float dt);
|
||||
void startMusic();
|
||||
void stopMusic();
|
||||
void pauseMusic();
|
||||
void resumeMusic();
|
||||
void volumeMusic(float gain);
|
||||
void setTemporaryVolume(float gain);
|
||||
void resetTemporaryVolume() { volumeMusic(m_adjusted_gain); }
|
||||
|
||||
void switchToFastMusic();
|
||||
bool isPlaying() const;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the composer of the music. */
|
||||
const stringw& getComposer() const { return m_composer; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the title of the music. */
|
||||
const stringw& getTitle() const { return m_title; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the filename of the normal speed music. */
|
||||
const std::string& getNormalFilename() const { return m_normal_filename; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** If available, returns the file name of the faster/last-lap music. */
|
||||
const std::string& getFastFilename() const { return m_fast_filename; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getMaxPitch() const { return m_max_pitch; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the music to be waiting, i.e. startMusic still needs to be
|
||||
* called. Used to pre-load track music during track loading time. */
|
||||
void setMusicWaiting () {m_music_waiting = true;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Resets a temporary volume change. */
|
||||
void resetTemporaryVolume() { volumeMusic(m_adjusted_gain); }
|
||||
|
||||
}; // MusicInformation
|
||||
#endif
|
||||
|
@ -162,7 +162,11 @@ void MusicManager::addMusicToTracks()
|
||||
} // addMusicToTracks
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MusicManager::startMusic(MusicInformation* mi, bool startRightNow)
|
||||
/** Schedules the indicated music to be played next.
|
||||
* \param mi Music information of the music to be played.
|
||||
* \param start_right_now
|
||||
*/
|
||||
void MusicManager::startMusic(MusicInformation* mi, bool start_right_now)
|
||||
{
|
||||
// If this music is already playing, ignore this call.
|
||||
if (m_current_music != NULL &&
|
||||
@ -181,8 +185,10 @@ void MusicManager::startMusic(MusicInformation* mi, bool startRightNow)
|
||||
if(!mi || !UserConfigParams::m_music || !m_initialized) return;
|
||||
|
||||
mi->volumeMusic(m_masterGain);
|
||||
if (startRightNow) mi->startMusic();
|
||||
else mi->setMusicWaiting();
|
||||
if (start_right_now)
|
||||
mi->startMusic();
|
||||
else
|
||||
mi->setMusicWaiting();
|
||||
} // startMusic
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
MusicManager();
|
||||
virtual ~MusicManager();
|
||||
|
||||
void startMusic(MusicInformation* mi, bool startRightNow=true);
|
||||
void startMusic(MusicInformation* mi,
|
||||
bool start_right_now=true);
|
||||
void stopMusic();
|
||||
bool initialized() const {return m_initialized; }
|
||||
void update(float dt) {if(m_current_music)
|
||||
|
@ -597,7 +597,7 @@ void SFXManager::deleteSFXMapping(const std::string &name)
|
||||
} // deleteSFXMapping
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/** Make sures that the sfx thread is started at least one per frame. It also
|
||||
/** Make sure that the sfx thread is started at least once per frame. It also
|
||||
* adds an update command for the music manager.
|
||||
* \param dt Time step size.
|
||||
*/
|
||||
@ -610,7 +610,8 @@ void SFXManager::update(float dt)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/** Updates the status of all playing sfx (to test if they are finished).
|
||||
* This function is executed once per thread (triggered by the
|
||||
* This function is executed once per frame (triggered by the audio thread).
|
||||
* \param current The sfx command - used to get timestep information.
|
||||
*/
|
||||
void SFXManager::reallyUpdateNow(SFXCommand *current)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user