From 71e0895dc60303d364c7972608e51c1a027f19fc Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 19 Aug 2021 10:53:14 +0300 Subject: Add AUDIO_REVERB define --- src/audio/AudioCollision.cpp | 4 +- src/audio/AudioLogic.cpp | 152 ++++++++++++++++++++++--------------------- src/audio/AudioManager.cpp | 13 +++- src/audio/AudioManager.h | 9 ++- src/audio/PolRadio.cpp | 5 +- src/audio/sampman_miles.cpp | 6 +- src/audio/sampman_oal.cpp | 6 +- src/core/config.h | 2 + 8 files changed, 110 insertions(+), 87 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 19212889..5289cc16 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -270,7 +270,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -300,7 +300,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 225a275a..f1166215 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -249,6 +249,7 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer) void cAudioManager::ProcessReverb() { +#ifdef AUDIO_REVERB #ifdef FIX_BUGS const uint32 numChannels = NUM_CHANNELS_GENERIC; #else @@ -263,6 +264,7 @@ cAudioManager::ProcessReverb() } #endif } +#endif // AUDIO_REVERB } float @@ -327,56 +329,56 @@ cAudioManager::ProcessEntity(int32 id) switch (m_asAudioEntities[id].m_nType) { case AUDIOTYPE_PHYSICAL: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessPhysical(id); } break; case AUDIOTYPE_EXPLOSION: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessExplosions(id); } break; case AUDIOTYPE_FIRE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessFires(id); } break; case AUDIOTYPE_WEATHER: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); if(CGame::currArea == AREA_MAIN_MAP || CGame::currArea == AREA_EVERYWHERE) ProcessWeather(id); } break; /* case AUDIOTYPE_CRANE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessCrane(); } break;*/ case AUDIOTYPE_SCRIPTOBJECT: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessScriptObject(id); } break; #ifdef GTA_BRIDGE case AUDIOTYPE_BRIDGE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessBridge(); } break; #endif case AUDIOTYPE_FRONTEND: - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); ProcessFrontEnd(); break; case AUDIOTYPE_PROJECTILE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessProjectiles(); } break; @@ -386,25 +388,25 @@ cAudioManager::ProcessEntity(int32 id) break; case AUDIOTYPE_FIREHYDRANT: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessFireHydrant(); } break; case AUDIOTYPE_WATERCANNON: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessWaterCannon(id); } break; case AUDIOTYPE_ESCALATOR: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessEscalators(); } break; case AUDIOTYPE_EXTRA_SOUNDS: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); ProcessExtraSounds(); } break; @@ -917,7 +919,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -968,7 +970,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } else if (boat != nil) { @@ -993,7 +995,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } else { @@ -1009,7 +1011,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1053,7 +1055,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1086,7 +1088,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 30.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1121,7 +1123,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 20.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1152,7 +1154,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 27.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1197,7 +1199,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1250,7 +1252,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = reverseGearIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1307,7 +1309,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1370,7 +1372,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1433,7 +1435,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1503,7 +1505,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1565,7 +1567,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1624,7 +1626,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1846,7 +1848,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1912,7 +1914,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1938,7 +1940,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1958,7 +1960,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_SoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2320,7 +2322,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; SampleManager.SetChannelFrequency(nChannel, freq); if (!channelUsed) { +#ifdef AUDIO_REVERB SampleManager.SetChannelReverbFlag(nChannel, m_bDynamicAcousticModelingStatus != FALSE); +#endif SampleManager.StartChannel(nChannel); } } @@ -2462,7 +2466,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2568,7 +2572,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2649,7 +2653,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2695,7 +2699,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2739,7 +2743,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 1.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } @@ -2784,7 +2788,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2841,7 +2845,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2889,7 +2893,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3478,7 +3482,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) } SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) SET_EMITTING_VOLUME(emittingVol); - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); if (stereo) { if(m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_bIs2D = TRUE; @@ -3539,7 +3543,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3561,7 +3565,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3683,7 +3687,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3707,7 +3711,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3754,7 +3758,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3921,7 +3925,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3952,7 +3956,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3982,7 +3986,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -4011,7 +4015,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -4042,7 +4046,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 12; m_sQueueSample.m_nOffset = 0; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); m_sQueueSample.m_nCounter = 6; @@ -5064,7 +5068,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) stereo = FALSE; } } - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); AddSampleToRequestedQueue(); if (stereo) { m_sQueueSample.m_nOffset = 127; @@ -7870,7 +7874,9 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_SoundIntensity = 40.0f; AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE; AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; +#ifdef AUDIO_REVERB AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; +#endif // AUDIO_REVERB #ifdef AUDIO_REFLECTIONS AudioManager.m_sQueueSample.m_bRequireReflection = TRUE; #endif // AUDIO_REFLECTIONS @@ -7996,7 +8002,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bReleasingSoundFlag = TRUE; SET_EMITTING_VOLUME(MAX_VOLUME); RESET_LOOP_OFFSETS - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); AddSampleToRequestedQueue(); } } @@ -8062,7 +8068,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_bReleasingSoundFlag = FALSE; SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -8085,7 +8091,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_bReleasingSoundFlag = FALSE; SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -8120,7 +8126,7 @@ cAudioManager::ProcessWaterCannon(int32) m_sQueueSample.m_bReleasingSoundFlag = FALSE; SET_EMITTING_VOLUME(50); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -8402,7 +8408,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bReleasingSoundFlag = TRUE; SET_EMITTING_VOLUME(emittingVolume); RESET_LOOP_OFFSETS - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); AddSampleToRequestedQueue(); } } @@ -8616,7 +8622,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) SET_SOUND_REFLECTION(FALSE); @@ -8664,7 +8670,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_bReleasingSoundFlag = TRUE; SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); RESET_LOOP_OFFSETS - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -8680,7 +8686,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) SET_SOUND_REFLECTION(FALSE); @@ -8704,7 +8710,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) SET_SOUND_REFLECTION(FALSE); @@ -8920,7 +8926,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_fDistance = 1.0f; } } - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); if (stereo) { @@ -8969,7 +8975,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -8979,7 +8985,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } @@ -9039,7 +9045,7 @@ cAudioManager::ProcessProjectiles() SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -9077,7 +9083,7 @@ cAudioManager::ProcessEscalators() m_sQueueSample.m_nLoopCount = 0; SET_EMITTING_VOLUME(EMITTING_VOLUME); SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); m_sQueueSample.m_bReleasingSoundFlag = FALSE; SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); @@ -9115,7 +9121,7 @@ cAudioManager::ProcessExtraSounds() m_sQueueSample.m_fSpeedMultiplier = 3.0f; SET_EMITTING_VOLUME(EMITTING_VOLUME); SET_LOOP_OFFSETS(SFX_ARCADE) - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; SET_SOUND_REFLECTION(FALSE); m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -9197,7 +9203,7 @@ cAudioManager::ProcessGarages() SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -9227,7 +9233,7 @@ cAudioManager::ProcessGarages() SET_EMITTING_VOLUME(60); m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReverbFlag = TRUE; + SET_SOUND_REVERB(TRUE); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nLoopCount = 1; @@ -9332,7 +9338,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_SoundIntensity = 450.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -9358,7 +9364,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); AddSampleToRequestedQueue(); } } @@ -9391,7 +9397,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 366807c2..834c7eef 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -509,7 +509,9 @@ cAudioManager::ServiceSoundEffects() ClearActiveSamples(); } m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1; +#ifdef AUDIO_REVERB if(m_bReverb) ProcessReverb(); +#endif ProcessSpecial(); ClearRequestedQueue(); InterrogateAudioEntities(); @@ -667,9 +669,10 @@ cAudioManager::AddSampleToRequestedQueue() if ( m_bReverb && m_sQueueSample.m_bIs2D ) m_sQueueSample.m_nFrontRearOffset = 30; - +#ifdef AUDIO_REVERB if (!m_bDynamicAcousticModelingStatus) m_sQueueSample.m_bReverbFlag = FALSE; +#endif #endif m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; @@ -1061,7 +1064,9 @@ cAudioManager::ProcessActiveQueues() SampleManager.SetChannelPan(j, sample.m_nOffset); #endif } +#if !defined(GTA_PS2) || defined(AUDIO_REVERB) SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag); +#endif break; //continue for i } sample.m_bIsProcessed = FALSE; @@ -1141,7 +1146,9 @@ cAudioManager::ProcessActiveQueues() SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd); SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount); #endif +#if !defined(GTA_PS2) || defined(AUDIO_REVERB) SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag); +#endif #ifdef EXTERNAL_3D_SOUND if (m_asActiveSamples[k].m_bIs2D) { uint8 offset = m_asActiveSamples[k].m_nOffset; @@ -1217,11 +1224,13 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_nReleasingVolumeDivider = 0; m_asActiveSamples[i].m_nVolumeChange = -1; m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f); +#ifdef AUDIO_REVERB m_asActiveSamples[i].m_bReverbFlag = FALSE; +#endif // AUDIO_REVERB #ifdef AUDIO_REFLECTIONS m_asActiveSamples[i].m_nLoopsRemaining = 0; m_asActiveSamples[i].m_bRequireReflection = FALSE; -#endif +#endif // AUDIO_REFLECTIONS } } diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 34b2ce61..9d57e91e 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -30,8 +30,8 @@ public: float m_SoundIntensity; bool8 m_bReleasingSoundFlag; CVector m_vecPos; -#ifndef GTA_PS2 - bool8 m_bReverbFlag; // TODO: ifdef all the occurrences +#if !defined(GTA_PS2) || defined(AUDIO_REVERB) // GTA_PS2 because this field exists on mobile but not on PS2 + bool8 m_bReverbFlag; #endif #ifdef AUDIO_REFLECTIONS uint8 m_nLoopsRemaining; @@ -616,6 +616,11 @@ public: #else #define SET_SOUND_REFLECTION(b) #endif +#ifdef AUDIO_REVERB +#define SET_SOUND_REVERB(b) m_sQueueSample.m_bReverbFlag = b +#else +#define SET_SOUND_REVERB(b) +#endif #if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS) static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 1cda7529..cf46daf9 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -64,8 +64,9 @@ cAudioManager::InitialisePoliceRadio() m_sPoliceRadioQueue.policeChannelCounterSeconds = 0; for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; - +#if !defined(GTA_PS2) || defined(AUDIO_REVERB) SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE); +#endif gSpecialSuspectLastSeenReport = FALSE; for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) gMinTimeToNextReport[i] = m_FrameCounter; @@ -110,7 +111,7 @@ cAudioManager::DoPoliceRadioCrackle() SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE) m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bReverbFlag = FALSE; + SET_SOUND_REVERB(FALSE); m_sQueueSample.m_nOffset = 63; m_sQueueSample.m_nReleasingVolumeDivider = 3; SET_SOUND_REFLECTION(FALSE); diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 737616b7..00663add 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -2198,7 +2198,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) bool8 cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { - int i = 0; + uint32 i = 0; uint32 position = nPos; char filename[MAX_PATH]; @@ -2280,7 +2280,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if ( !_pMP3List ) { nFile = 0; - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; #ifdef PS2_AUDIO_PATHS strcpy(filename, m_MiscomPath); strcat(filename, PS2StreamedNameTable[nFile]); @@ -2329,7 +2329,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) } } - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; } while ( ++i < nNumMP3s ); position = 0; diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 3d693870..e20da0b2 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1680,7 +1680,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) bool8 cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { - int i = 0; + uint32 i = 0; uint32 position = nPos; char filename[MAX_PATH]; @@ -1759,7 +1759,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if ( !_pMP3List ) { nFile = 0; - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; CStream *stream = aStream[nStream]; #ifdef PS2_AUDIO_PATHS @@ -1802,7 +1802,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) } } - _bIsMp3Active = 0; + _bIsMp3Active = FALSE; } while ( ++i < nNumMP3s ); position = 0; diff --git a/src/core/config.h b/src/core/config.h index 72bd6052..100b0ec1 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -181,6 +181,7 @@ enum Config { # define PS2_MENU #elif defined GTA_PC # define EXTERNAL_3D_SOUND +# define AUDIO_REVERB # ifndef GTA_HANDHELD # define PC_PLAYER_CONTROLS // mouse player/cam mode # endif @@ -440,6 +441,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space // originally and making it work in 2d only requires more resource). Will not work on PS2 #define AUDIO_REFLECTIONS // Enable audio reflections. This is enabled in all vanilla versions +#define AUDIO_REVERB // Enable audio reverb. It was disabled in PS2 and mobile versions #define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS #define AUDIO_CACHE // cache sound lengths to speed up the cold boot #define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally) -- cgit v1.2.3