fix issues with menu mode and playlist, harden code and clear out ambient noises at game end, fixes #2066
This was SVN commit r13784.
This commit is contained in:
parent
3047470858
commit
df190cbbd1
@ -157,7 +157,9 @@ Music.prototype.startPlayList = function(tracks, fadeInPeriod, isLooping)
|
||||
|
||||
Music.prototype.switchMusic = function(track, fadeInPeriod, isLooping)
|
||||
{
|
||||
Engine.PlayMusic(this.RELATIVE_MUSIC_PATH + track, isLooping);
|
||||
Engine.ClearPlaylist();
|
||||
Engine.AddPlaylistItem( this.RELATIVE_MUSIC_PATH + track );
|
||||
Engine.StartPlaylist(isLooping);
|
||||
};
|
||||
|
||||
Music.prototype.isPlaying = function()
|
||||
|
@ -684,6 +684,8 @@ void EndGame()
|
||||
SAFE_DELETE(g_NetServer);
|
||||
SAFE_DELETE(g_NetClient);
|
||||
SAFE_DELETE(g_Game);
|
||||
|
||||
ISoundManager::CloseGame();
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
|
||||
static void CreateSoundManager();
|
||||
static void SetEnabled(bool doEnable);
|
||||
static void CloseGame();
|
||||
|
||||
virtual void IdleTask() = 0;
|
||||
virtual void Pause(bool pauseIt) = 0;
|
||||
|
@ -222,6 +222,11 @@ void ISoundManager::SetEnabled(bool doEnable)
|
||||
ISoundManager::CreateSoundManager();
|
||||
}
|
||||
}
|
||||
void ISoundManager::CloseGame()
|
||||
{
|
||||
if ( CSoundManager* aSndMgr = (CSoundManager*)g_SoundManager )
|
||||
aSndMgr->SetAmbientItem( NULL );
|
||||
}
|
||||
|
||||
void CSoundManager::al_ReportError(ALenum err, const char* caller, int line)
|
||||
{
|
||||
@ -578,17 +583,20 @@ void CSoundManager::IdleTask()
|
||||
{
|
||||
m_PlaylistGap = 0;
|
||||
PlayList::iterator it = find (m_PlayListItems->begin(), m_PlayListItems->end(), *(m_CurrentTune->GetName()) );
|
||||
++it;
|
||||
if ( it != m_PlayListItems->end() )
|
||||
{
|
||||
++it;
|
||||
|
||||
Path nextPath;
|
||||
if ( it == m_PlayListItems->end() )
|
||||
nextPath = m_PlayListItems->at( 0 );
|
||||
else
|
||||
nextPath = *it;
|
||||
Path nextPath;
|
||||
if ( it == m_PlayListItems->end() )
|
||||
nextPath = m_PlayListItems->at( 0 );
|
||||
else
|
||||
nextPath = *it;
|
||||
|
||||
ISoundItem* aSnd = LoadItem( nextPath );
|
||||
if ( aSnd )
|
||||
SetMusicItem( aSnd );
|
||||
ISoundItem* aSnd = LoadItem( nextPath );
|
||||
if ( aSnd )
|
||||
SetMusicItem( aSnd );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -808,6 +816,7 @@ void CSoundManager::SetAmbientItem(ISoundItem* anItem)
|
||||
|
||||
void ISoundManager::CreateSoundManager(){}
|
||||
void ISoundManager::SetEnabled(bool UNUSED(doEnable)){}
|
||||
void ISoundManager::CloseGame(){}
|
||||
|
||||
#endif // CONFIG2_AUDIO
|
||||
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
static void ScriptingInit();
|
||||
static void CreateSoundManager();
|
||||
static void SetEnabled(bool doEnable);
|
||||
|
||||
static void CloseGame();
|
||||
|
||||
static void al_ReportError(ALenum err, const char* caller, int line);
|
||||
static void al_check(const char* caller, int line);
|
||||
|
||||
@ -146,12 +147,12 @@ public:
|
||||
void PauseMusic (bool pauseIt);
|
||||
void PauseAmbient (bool pauseIt);
|
||||
void PauseAction (bool pauseIt);
|
||||
void SetAmbientItem(ISoundItem* anItem);
|
||||
|
||||
protected:
|
||||
void InitListener();
|
||||
Status AlcInit();
|
||||
void SetMusicItem(ISoundItem* anItem);
|
||||
void SetAmbientItem(ISoundItem* anItem);
|
||||
void SetMasterGain(float gain);
|
||||
void SetMusicGain(float gain);
|
||||
void SetAmbientGain(float gain);
|
||||
|
Loading…
Reference in New Issue
Block a user