diff --git a/source/frontend/options.cpp b/source/frontend/options.cpp index 6a12d4029..084290006 100644 --- a/source/frontend/options.cpp +++ b/source/frontend/options.cpp @@ -487,7 +487,7 @@ void CFrontEndOptions::select() m_closingDown=false; CSoundMediator::setSong(CSoundMediator::SONG_OPTIONS); - CSoundMediator::playSong(); + m_musicStarted=false; CFader::setFadingIn(); } @@ -578,6 +578,12 @@ void CFrontEndOptions::think(int _frames) if(!CFader::isFading()) { + if(!m_musicStarted) + { + CSoundMediator::playSong(); + m_musicStarted=true; + } + if(m_nextMode!=m_mode) { if(m_nextMode==MODE__LOAD) diff --git a/source/frontend/options.h b/source/frontend/options.h index 7cd44e427..2916af7df 100644 --- a/source/frontend/options.h +++ b/source/frontend/options.h @@ -154,6 +154,8 @@ private: int m_screenXOff; int m_screenYOff; + int m_musicStarted; + static int s_controlStyleValues[]; static CGUITextReadout::TextReadoutData s_controlStyleReadoutText[]; diff --git a/source/frontend/start.cpp b/source/frontend/start.cpp index bd83a0ab5..d4fb50256 100644 --- a/source/frontend/start.cpp +++ b/source/frontend/start.cpp @@ -198,7 +198,7 @@ void CFrontEndStart::select() m_slotDrawOffset=0; CSoundMediator::setSong(CSoundMediator::SONG_MEMCARD2); - CSoundMediator::playSong(); + m_musicStarted=false; } /*---------------------------------------------------------------------- @@ -409,6 +409,12 @@ void CFrontEndStart::think(int _frames) { if(!CFader::isFading()) { + if(!m_musicStarted) + { + CSoundMediator::playSong(); + m_musicStarted=true; + } + if(m_slotDrawOffset==0) { if(m_state==STATE_SELECT) diff --git a/source/frontend/start.h b/source/frontend/start.h index 3fe4ad29a..b6a66b474 100644 --- a/source/frontend/start.h +++ b/source/frontend/start.h @@ -114,6 +114,8 @@ private: static const int s_itemFrames[]; + int m_musicStarted; + }; diff --git a/source/game/game.cpp b/source/game/game.cpp index 7e87e1095..c6c055b1b 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -434,6 +434,14 @@ void CGameScene::render_boss_intro() /*****************************************************************************/ void CGameScene::think(int _frames) { + if(!m_musicStarted&&!CFader::isFading()) + { + // Song is loaded/dumped by the level, and played from here. This just gives some + // better timing over when it starts (pkg) + CSoundMediator::playSong(); + m_musicStarted=true; + } + switch(m_gamestate) { case GAMESTATE_SHOWING_LIVES: @@ -757,10 +765,10 @@ void CGameScene::initLevel() m_levelHasTimer=false; } - // Song is loaded/dumped by the level, and played from here. This just gives some - // better timing over when it starts (pkg) - CSoundMediator::playSong(); CActorPool::SetUpCache(); + + m_musicStarted=false; + SYSTEM_DBGMSG("InitLevelDone\n"); } diff --git a/source/game/game.h b/source/game/game.h index 2a4955480..a6d4df221 100644 --- a/source/game/game.h +++ b/source/game/game.h @@ -136,6 +136,8 @@ static DVECTOR s_CamShake; int m_levelHasTimer; int m_timer; + int m_musicStarted; + }; diff --git a/source/sound/xmplay.cpp b/source/sound/xmplay.cpp index c0064c97f..0790e0fe3 100644 --- a/source/sound/xmplay.cpp +++ b/source/sound/xmplay.cpp @@ -54,6 +54,13 @@ Vars ---- */ +#ifdef __USER_paul__ +static int sounddebug=true; +#else +static int sounddebug=false; +#endif + + /*---------------------------------------------------------------------- Function: Purpose: @@ -215,6 +222,7 @@ void CXMPlaySound::think() ////////////// +if(sounddebug) { static const int colours[6][3]= {