Fixed music starting in menu, also corrected using the startRightNow parameter in MusicManager::startMusic()
This commit is contained in:
parent
472274561d
commit
15401c0b02
@ -273,6 +273,8 @@ void MusicInformation::stopMusic()
|
|||||||
delete m_fast_music;
|
delete m_fast_music;
|
||||||
m_fast_music=NULL;
|
m_fast_music=NULL;
|
||||||
}
|
}
|
||||||
|
if(m_music_waiting)
|
||||||
|
m_music_waiting = false;
|
||||||
} // stopMusic
|
} // stopMusic
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -284,6 +286,12 @@ void MusicInformation::pauseMusic()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void MusicInformation::resumeMusic()
|
void MusicInformation::resumeMusic()
|
||||||
{
|
{
|
||||||
|
if(m_music_waiting)
|
||||||
|
{
|
||||||
|
startMusic();
|
||||||
|
m_music_waiting = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (m_normal_music != NULL) m_normal_music->resumeMusic();
|
if (m_normal_music != NULL) m_normal_music->resumeMusic();
|
||||||
if (m_fast_music != NULL) m_fast_music->resumeMusic();
|
if (m_fast_music != NULL) m_fast_music->resumeMusic();
|
||||||
} // resumeMusic
|
} // resumeMusic
|
||||||
|
@ -48,6 +48,10 @@ private:
|
|||||||
std::vector<std::string> m_all_tracks;
|
std::vector<std::string> m_all_tracks;
|
||||||
//int m_numLoops;
|
//int m_numLoops;
|
||||||
|
|
||||||
|
/** If music is loaded but hasn't been started yet (MusicManager::startMusic()
|
||||||
|
* was told not to start right away). */
|
||||||
|
bool m_music_waiting;
|
||||||
|
|
||||||
/** If faster music is enabled at all (either separate file or using
|
/** If faster music is enabled at all (either separate file or using
|
||||||
* the pitch shift approach). */
|
* the pitch shift approach). */
|
||||||
bool m_enable_fast;
|
bool m_enable_fast;
|
||||||
@ -87,6 +91,7 @@ public:
|
|||||||
//int getNumLoops () const {return m_numLoops; }
|
//int getNumLoops () const {return m_numLoops; }
|
||||||
float getFasterTime () const {return m_faster_time; }
|
float getFasterTime () const {return m_faster_time; }
|
||||||
float getMaxPitch () const {return m_max_pitch; }
|
float getMaxPitch () const {return m_max_pitch; }
|
||||||
|
void setMusicWaiting () {m_music_waiting = true;}
|
||||||
void addMusicToTracks ();
|
void addMusicToTracks ();
|
||||||
void update (float dt);
|
void update (float dt);
|
||||||
void startMusic ();
|
void startMusic ();
|
||||||
|
@ -182,6 +182,7 @@ void MusicManager::startMusic(MusicInformation* mi, bool startRightNow)
|
|||||||
|
|
||||||
mi->volumeMusic(m_masterGain);
|
mi->volumeMusic(m_masterGain);
|
||||||
if (startRightNow) mi->startMusic();
|
if (startRightNow) mi->startMusic();
|
||||||
|
else mi->setMusicWaiting();
|
||||||
} // startMusic
|
} // startMusic
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -147,7 +147,7 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
|
|||||||
if(w->getState() == false)
|
if(w->getState() == false)
|
||||||
music_manager->stopMusic();
|
music_manager->stopMusic();
|
||||||
else
|
else
|
||||||
music_manager->startMusic(music_manager->getCurrentMusic());
|
music_manager->startMusic(music_manager->getCurrentMusic(), 0);
|
||||||
}
|
}
|
||||||
else if(name == "sfx_enabled")
|
else if(name == "sfx_enabled")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user