From fe51abd53420fdeb241c1a733651ea9ec615453a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 21 Aug 2021 08:42:00 +0300 Subject: [PATCH] Audio: bits of PS2 code --- src/audio/AudioLogic.cpp | 6 +++++- src/audio/AudioManager.cpp | 23 +++++++++++++++++++++-- src/audio/audio_enums.h | 8 +++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index c1181888..9d6fa51d 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -2017,7 +2017,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh bool8 isMoped = FALSE; bool8 processedAccelSampleStopped = FALSE; static uint32 gearSoundStartTime = CTimer::GetTimeInMilliseconds(); - uint8 nChannel = CHANNEL_PLAYER_VEHICLE_ENGINE; // TODO: PS2 channels +#ifdef GTA_PS2 + uint8 nChannel = m_bIsSurround ? CHANNEL_DTS_PLAYER_VEHICLE_ENGINE : CHANNEL_PLAYER_VEHICLE_ENGINE; +#else + uint8 nChannel = CHANNEL_PLAYER_VEHICLE_ENGINE; +#endif if (bPlayerJustEnteredCar) { bAccelSampleStopped = TRUE; bPlayerJustEnteredCar = FALSE; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 614511f3..2bb17bfb 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -493,9 +493,28 @@ cAudioManager::ServiceSoundEffects() #endif m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0; if (m_nUserPause && !m_nPreviousUserPause) { - for (int32 i = 0; i < NUM_CHANNELS; i++) - SampleManager.StopChannel(i); +#ifdef GTA_PS2 + if (m_bIsSurround) { + for (uint32 i = 0; i < NUM_CHANNELS_DTS_GENERIC; i++) + SampleManager.StopChannel(i); + + SampleManager.SetChannelFrequency(CHANNEL_DTS_POLICE_RADIO, 0); + SampleManager.SetChannelFrequency(CHANNEL_DTS_MISSION_AUDIO_1, 0); + SampleManager.SetChannelFrequency(CHANNEL_DTS_MISSION_AUDIO_2, 0); + SampleManager.SetChannelFrequency(CHANNEL_DTS_PLAYER_VEHICLE_ENGINE, 0); + } else { + for (uint32 i = 0; i < NUM_CHANNELS_GENERIC; i++) + SampleManager.StopChannel(i); + SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, 0); + SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO_1, 0); + SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO_2, 0); + SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, 0); + } +#else + for (uint32 i = 0; i < NUM_CHANNELS; i++) + SampleManager.StopChannel(i); +#endif ClearRequestedQueue(); if (m_nActiveSampleQueue) { m_nActiveSampleQueue = 0; diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 5a14d312..2a70f2e7 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -1304,7 +1304,13 @@ enum CHANNEL_MISSION_AUDIO_1, CHANNEL_MISSION_AUDIO_2, CHANNEL_PLAYER_VEHICLE_ENGINE, - NUM_CHANNELS + NUM_CHANNELS, + + NUM_CHANNELS_DTS_GENERIC = 18, + CHANNEL_DTS_POLICE_RADIO = NUM_CHANNELS_DTS_GENERIC, + CHANNEL_DTS_MISSION_AUDIO_1, + CHANNEL_DTS_MISSION_AUDIO_2, + CHANNEL_DTS_PLAYER_VEHICLE_ENGINE, }; #else enum