Pause radio when game is paused

This commit is contained in:
Sergeanur 2021-06-30 21:21:45 +03:00
parent b1c9340fd3
commit a73a2c9179
2 changed files with 17 additions and 1 deletions

View File

@ -310,7 +310,16 @@ cMusicManager::ChangeMusicMode(uint8 mode)
switch (mode) switch (mode)
{ {
case MUSICMODE_FRONTEND: m_nUpcomingMusicMode = MUSICMODE_FRONTEND; break; case MUSICMODE_FRONTEND:
m_nUpcomingMusicMode = MUSICMODE_FRONTEND;
#ifdef PAUSE_RADIO_IN_FRONTEND
// rewind those streams we weren't listening right now
for( uint32 i = STREAMED_SOUND_RADIO_WILD; i < STREAMED_SOUND_CUTSCENE_ASS_1; i++ )
m_aTracks[i].m_nPosition = GetTrackStartPos(i);
#endif
break;
case MUSICMODE_GAME: m_nUpcomingMusicMode = MUSICMODE_GAME; break; case MUSICMODE_GAME: m_nUpcomingMusicMode = MUSICMODE_GAME; break;
case MUSICMODE_CUTSCENE: case MUSICMODE_CUTSCENE:
m_nUpcomingMusicMode = MUSICMODE_CUTSCENE; m_nUpcomingMusicMode = MUSICMODE_CUTSCENE;
@ -414,6 +423,12 @@ cMusicManager::ServiceFrontEndMode()
{ {
static bool8 bRadioStatsRecorded = FALSE; static bool8 bRadioStatsRecorded = FALSE;
#ifdef PAUSE_RADIO_IN_FRONTEND
// pause radio
for (uint32 i = STREAMED_SOUND_RADIO_WILD; i < STREAMED_SOUND_CUTSCENE_ASS_1; i++)
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
#endif
if (m_bAnnouncementInProgress) { if (m_bAnnouncementInProgress) {
SampleManager.StopStreamedFile(); SampleManager.StopStreamedFile();
if (SampleManager.IsStreamPlaying()) if (SampleManager.IsStreamPlaying())

View File

@ -400,6 +400,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later #define MULTITHREADED_AUDIO // for streams. requires C++11 or later
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
#ifdef AUDIO_OPUS #ifdef AUDIO_OPUS
#define AUDIO_OAL_USE_OPUS // enable support of opus files #define AUDIO_OAL_USE_OPUS // enable support of opus files