From a13089cd2e32d9d5f63ab1035d6eef03c45ce774 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 18 Aug 2021 15:49:06 +0300 Subject: Port audio changes from master --- src/audio/AudioLogic.cpp | 355 +++++++++++++++++++++++------------------------ 1 file changed, 173 insertions(+), 182 deletions(-) (limited to 'src/audio/AudioLogic.cpp') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 564881b8..699dec79 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -894,7 +894,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) emittingVol = 0; if (emittingVol != 0) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 88; if (boat != nil) { m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO3; @@ -918,7 +918,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -953,7 +953,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) //sound from front of helicopter emittingVol = (1.0f - cameraAngle) * volumeModifier * 127.0f; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 3; if (hunterBool) { m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_1; @@ -969,7 +969,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } else if (boat != nil) { m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO1; @@ -994,7 +994,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } else { m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI; @@ -1010,7 +1010,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1019,7 +1019,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) //after accel rotor sound emittingVol = ((cameraAngle + 1.0f) * volumeModifier * 127.0f) / 2.0f; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; if (hunterBool) { m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_2; @@ -1054,7 +1054,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -1065,7 +1065,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (propellerSpeed < 1.0f) { emittingVol = (1.0f - propellerSpeed / 2.0f) * 70.0f; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume > 0) { if (hunterBool) { m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_4; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1087,7 +1087,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1098,7 +1098,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (boat) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIXED && m_sQueueSample.m_fDistance < 20.0f && propellerSpeed > 0.0f) { m_sQueueSample.m_nVolume = ComputeVolume(propellerSpeed * 100.0f, 20.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume > 0) { if (accelerateState > 0 || brakeState > 0) m_sQueueSample.m_nFrequency = 18000 + Min(1.0f, (Max(accelerateState, brakeState) / 255.0f) * freqModifier) * 2204; @@ -1122,7 +1122,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1138,7 +1138,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (params.m_fDistance < SQR(27.0f)) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(volumeModifier * 25.0f, 27.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1153,7 +1153,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1182,7 +1182,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); emittingVol = 30.0f * CWeather::Rain; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++; if (veh->m_bRainSamplesCounter > 4) veh->m_bRainSamplesCounter = 68; @@ -1198,7 +1198,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1231,7 +1231,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) emittingVolume = modificator * 24.0f; m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, reverseGearIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (params.m_pVehicle->m_fGasPedal >= 0.0f) { m_sQueueSample.m_nCounter = 62; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; @@ -1251,7 +1251,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1293,7 +1293,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) freq = Clamp2(5 * acceletateState + 22050, (int)prevFreq, 30); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(70, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CAR_RC_HELI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1308,7 +1308,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (isPlayerVeh) @@ -1356,7 +1356,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) if (volume > 0) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_RC_REV; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1371,7 +1371,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1413,7 +1413,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) if (volume > 0) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (vehSlowdown) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_RC_IDLE; @@ -1434,7 +1434,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1489,7 +1489,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) emittingVol = (100.0f * modifier); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 95; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -1504,7 +1504,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1546,7 +1546,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); emittingVol = 30.f * Min(1.f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity)); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -1569,7 +1569,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1611,7 +1611,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) relativeVelocity = Min(1.0f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity)); emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1628,7 +1628,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1808,7 +1808,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_nCounter = 2; } m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (!caddyBool) { if (veh->GetStatus() == STATUS_SIMPLE) { if (modificator < 0.02f) { @@ -1850,7 +1850,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1893,7 +1893,7 @@ void cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_nSampleIndex = sample; #ifdef GTA_PS2 @@ -1916,7 +1916,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -1927,7 +1927,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) if(params.m_fDistance < SQR(200)) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); - if(m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1942,12 +1942,12 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if(params.m_fDistance < SQR(90)) { m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); - if(m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -1962,7 +1962,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_SoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2457,7 +2457,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) if (skidVal > 0.0f) { emittingVol = 50.f * skidVal; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 3; switch (params.m_pVehicle->m_nSurfaceTouched) { case SURFACE_GRASS: @@ -2497,7 +2497,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2584,7 +2584,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); volume = veh->bIsDrowning ? 20 : 80; m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 4; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2603,7 +2603,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2650,7 +2650,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); volume = veh->bIsDrowning ? 20 : 80; m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 5; if (UsesSiren(params)) { if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED) @@ -2684,7 +2684,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -2711,7 +2711,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); volume = veh->bIsDrowning ? 15 : 60; m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2730,7 +2730,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2760,7 +2760,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) if (velocity > 0.0035f) { emittingVol = (100.0f * velocity * 10.0f / 3.0f); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i + 6; m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); @@ -2774,7 +2774,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -2804,7 +2804,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); volume = m_anRandomTable[0] % 10 + 70; m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 13; m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); @@ -2819,7 +2819,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -2864,7 +2864,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) if (params.m_pVehicle->bIsDrowning) emittingVolume /= 2; m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -2876,7 +2876,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2909,7 +2909,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) if (bombType == CARBOMB_TIMEDACTIVE) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 35; m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -2924,7 +2924,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -2940,14 +2940,14 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) float relVol; float vol; bool8 noReflections; - bool8 isHeli; + bool8 stereo; float maxDist; static uint8 GunIndex = 53; for (uint16 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { noReflections = FALSE; - isHeli = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + stereo = FALSE; + SET_SOUND_REFLECTION(FALSE); event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (event) { case SOUND_CAR_DOOR_CLOSE_BONNET: @@ -2990,7 +2990,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_DOOR_OPEN_BONNET: @@ -3030,7 +3030,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_WINDSHIELD_CRACK: { @@ -3105,7 +3105,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_LIGHT_BREAK: { @@ -3248,7 +3248,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = 60; break; } @@ -3330,8 +3330,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; - isHeli = TRUE; + SET_SOUND_REFLECTION(TRUE); + stereo = TRUE; break; default: { @@ -3384,7 +3384,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } } @@ -3416,7 +3416,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = 50; maxDist = SQR(SOUND_INTENSITY); break; @@ -3457,7 +3457,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVol = m_anRandomTable[4] % 20 + 90; break; } @@ -3475,7 +3475,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 20 + 55; CrunchOffset %= 2; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_CAR_PED_COLLISION: { @@ -3502,7 +3502,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (noReflections) { m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3513,42 +3513,25 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bReverbFlag = TRUE; - if (isHeli) { - if (0.2f * m_sQueueSample.m_SoundIntensity > m_sQueueSample.m_fDistance) { + if (stereo) { + if(m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nOffset = 0; -#ifdef THIS_IS_STUPID - goto AddSample; -#else - AddSampleToRequestedQueue(); - m_sQueueSample.m_nOffset = 127; - m_sQueueSample.m_nSampleIndex++; - m_sQueueSample.m_nCounter = GunIndex++; - if (GunIndex > 58) - GunIndex = 53; - m_sQueueSample.m_bRequireReflection = FALSE; - AddSampleToRequestedQueue(); - continue; -#endif + } else { + stereo = FALSE; + m_sQueueSample.m_bIs2D = FALSE; } - isHeli = FALSE; - } - m_sQueueSample.m_bIs2D = FALSE; -#ifdef THIS_IS_STUPID -AddSample: + } else m_sQueueSample.m_bIs2D = FALSE; AddSampleToRequestedQueue(); - if (isHeli) { + if (stereo) { m_sQueueSample.m_nOffset = 127; m_sQueueSample.m_nSampleIndex++; m_sQueueSample.m_nCounter = GunIndex++; if (GunIndex > 58) GunIndex = 53; - m_sQueueSample.m_bRequireReflection = 0; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } -#else - AddSampleToRequestedQueue(); -#endif continue; } @@ -3576,7 +3559,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) emittingVol = (75.f * speedMultipler); if (train->m_fWagonPosition == 0.0f) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 32; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -3591,14 +3574,14 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } const float SOUND_INTENSITY = 70.0f; if (params.m_fDistance < SQR(SOUND_INTENSITY)) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 33; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -3613,7 +3596,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -3717,7 +3700,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) if (Vol > 0) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(Vol, intensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nFrequency = Freq; m_sQueueSample.m_nCounter = 40; if (isV12) @@ -3735,7 +3718,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -3743,7 +3726,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) if(boat->GetModelIndex() == MI_REEFER) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, intensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nFrequency = 6000; m_sQueueSample.m_nCounter = 39; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; @@ -3759,7 +3742,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -3791,7 +3774,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); vol = (30.f * multiplier); m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 38; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -3806,7 +3789,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } @@ -3958,7 +3941,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -3973,7 +3956,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -3989,7 +3972,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -4004,7 +3987,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -4019,7 +4002,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 3; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -4034,7 +4017,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -4048,7 +4031,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = vol; - if(m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -4063,7 +4046,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; // todo port fix to re3 + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } return TRUE; @@ -4078,7 +4061,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 5; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -4094,7 +4077,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nReleasingVolumeDivider = 12; m_sQueueSample.m_nOffset = 0; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); m_sQueueSample.m_nCounter = 6; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; @@ -4150,7 +4133,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { stereo = FALSE; narrowSoundRange = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (sound) { case SOUND_STEP_START: @@ -4228,7 +4211,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_FALL_LAND: case SOUND_FALL_COLLAPSE: @@ -4255,7 +4238,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_FIGHT_37: m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; @@ -4350,7 +4333,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_WEAPON_BAT_ATTACK: case SOUND_WEAPON_KNIFE_ATTACK: @@ -4405,7 +4388,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_WEAPON_CHAINSAW_IDLE: @@ -4502,7 +4485,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_COLT45: @@ -4522,7 +4505,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_PYTHON: @@ -4542,7 +4525,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_SHOTGUN: @@ -4563,7 +4546,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_SPAS12_SHOTGUN: @@ -4583,7 +4566,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_TEC9: @@ -4719,7 +4702,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); stereo = TRUE; break; case WEAPONTYPE_FLAMETHROWER: @@ -4815,7 +4798,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(75); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_WEAPON_AK47_BULLET_ECHO: { @@ -4879,7 +4862,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_WEAPON_FLAMETHROWER_FIRE: @@ -4936,7 +4919,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_MELEE_ATTACK_START: { @@ -4972,7 +4955,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_SKATING: @@ -4998,7 +4981,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; } case SOUND_WEAPON_MINIGUN_ATTACK: @@ -5050,7 +5033,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) SET_EMITTING_VOLUME(127); m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SOUND_SHIRT_WIND_FLAP: if (params.m_pPed->IsPlayer() && params.m_pPed->m_pMyVehicle) { @@ -5106,7 +5089,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (stereo) { if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_bIs2D = TRUE; @@ -5239,7 +5222,7 @@ cAudioManager::SetupPedComments(cPedParams ¶ms, uint16 sound) emittingVol = 31; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); pedComment.m_nProcess = 10; - if(m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex; pedComment.m_vecPos = m_sQueueSample.m_vecPos; pedComment.m_fDistance = m_sQueueSample.m_fDistance; @@ -7879,7 +7862,7 @@ cPedComments::Process() static uint8 counter = 0; static int32 prevSamples[10]; - if(AudioManager.m_nUserPause != 0) return; + if(AudioManager.m_nUserPause) return; if(m_nCommentsInBank[m_nActiveBank]) { for(int i = 0; i < ARRAY_SIZE(prevSamples); i++) { @@ -7922,10 +7905,15 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE; AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; +#ifdef AUDIO_REFLECTIONS AudioManager.m_sQueueSample.m_bRequireReflection = TRUE; +#endif // AUDIO_REFLECTIONS AudioManager.m_sQueueSample.m_bIs2D = FALSE; #ifdef FIX_BUGS - if (sampleIndex >= SFX_PLAYER_ANGRY_BUSTED_1 && sampleIndex < TOTAL_AUDIO_SAMPLES) { // check if player sfx + if((sampleIndex >= SFX_POLICE_BOAT_1 && sampleIndex <= SFX_POLICE_BOAT_23) || + (sampleIndex >= SFX_POLICE_HELI_1 && sampleIndex <= SFX_POLICE_HELI_20)) + AudioManager.m_sQueueSample.m_SoundIntensity = 400.0f; + else if (sampleIndex >= SFX_PLAYER_ANGRY_BUSTED_1 && sampleIndex <= SFX_PLAYER_ON_FIRE_16) { // check if player sfx AudioManager.m_sQueueSample.m_bIs2D = TRUE; AudioManager.m_sQueueSample.m_nOffset = 63; } @@ -7997,7 +7985,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case EXPLOSION_MOLOTOV: m_sQueueSample.m_SoundIntensity = 150.0f; @@ -8005,7 +7993,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); break; case EXPLOSION_MINE: case EXPLOSION_HELI_BOMB: @@ -8014,7 +8002,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; default: m_sQueueSample.m_SoundIntensity = 200.0f; @@ -8024,6 +8012,9 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; //same *= 8 / 10; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA; +#ifdef FIX_BUGS + SET_SOUND_REFLECTION(TRUE); +#endif break; } m_sQueueSample.m_vecPos = *CExplosion::GetExplosionPosition(i); @@ -8031,7 +8022,7 @@ cAudioManager::ProcessExplosions(int32 explosion) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_bIs2D = FALSE; @@ -8095,7 +8086,7 @@ cAudioManager::ProcessFires(int32) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -8106,7 +8097,7 @@ cAudioManager::ProcessFires(int32) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8114,7 +8105,7 @@ cAudioManager::ProcessFires(int32) gFireManager.m_aFires[i].m_bExtinguishedWithWater = FALSE; emittingVol = 100.0f * gFireManager.m_aFires[i].m_fWaterExtinguishCountdown; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nFrequency = 19591; m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); @@ -8129,7 +8120,7 @@ cAudioManager::ProcessFires(int32) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8149,7 +8140,7 @@ cAudioManager::ProcessWaterCannon(int32) if (distSquared < SQR(SOUND_INTENSITY)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -8164,7 +8155,7 @@ cAudioManager::ProcessWaterCannon(int32) SET_EMITTING_VOLUME(50); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8211,7 +8202,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = 60; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SCRIPT_SOUND_GARAGE_DOOR_CLUNK: m_sQueueSample.m_SoundIntensity = 80.0f; @@ -8223,7 +8214,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = 60; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_HIT: case SCRIPT_SOUND_BULLET_HIT_GROUND_1: @@ -8248,7 +8239,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 1.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); break; case SCRIPT_SOUND_MALE_AMBULANCE_OUCH: { @@ -8273,7 +8264,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); break; case SCRIPT_SOUND_PAYPHONE_RINGING: m_sQueueSample.m_SoundIntensity = 80.0f; @@ -8284,7 +8275,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); break; case SCRIPT_SOUND_GLASS_BREAK_L: m_sQueueSample.m_SoundIntensity = 60.0f; @@ -8315,7 +8306,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); break; case SCRIPT_SOUND_GLASS_LIGHT_BREAK: m_sQueueSample.m_SoundIntensity = 55.0f; @@ -8335,7 +8326,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_BOX_DESTROYED_2: @@ -8346,7 +8337,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_METAL_COLLISION: @@ -8358,7 +8349,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 30 + 70; break; case SCRIPT_SOUND_TIRE_COLLISION: @@ -8370,7 +8361,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_HIT_BALL: @@ -8382,7 +8373,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_GUNSHELL_DROP: @@ -8439,7 +8430,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -8654,7 +8645,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) if(distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if(m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; @@ -8662,7 +8653,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bReverbFlag = TRUE; SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -8708,7 +8699,7 @@ cAudioManager::ProcessWeather(int32 id) SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { @@ -8726,7 +8717,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_bReverbFlag = FALSE; SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } x = 0.0f; @@ -8750,7 +8741,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_bReverbFlag = FALSE; SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); CObject::fDistToNearestTree = 999999.9f; } @@ -8964,7 +8955,7 @@ cAudioManager::ProcessFrontEnd() } } m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); if (stereo) { ++m_sQueueSample.m_nSampleIndex; @@ -8998,7 +8989,7 @@ cAudioManager::ProcessCrane() if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -9013,7 +9004,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) { @@ -9023,7 +9014,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -9075,7 +9066,7 @@ cAudioManager::ProcessProjectiles() if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; @@ -9083,7 +9074,7 @@ cAudioManager::ProcessProjectiles() SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -9107,7 +9098,7 @@ cAudioManager::ProcessEscalators() if (distance < SQR(SOUND_INTENSITY)) { m_sQueueSample.m_fDistance = Sqrt(distance); m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973; @@ -9122,7 +9113,7 @@ cAudioManager::ProcessEscalators() SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -9146,7 +9137,7 @@ cAudioManager::ProcessExtraSounds() if (distance < SQR(SOUND_INTENSITY)) { m_sQueueSample.m_fDistance = Sqrt(distance); m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nSampleIndex = SFX_ARCADE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -9160,7 +9151,7 @@ cAudioManager::ProcessExtraSounds() SET_LOOP_OFFSETS(SFX_ARCADE) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); m_sQueueSample.m_nReleasingVolumeDivider = 3; AddSampleToRequestedQueue(); } @@ -9197,7 +9188,7 @@ cAudioManager::ProcessGarages() while (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(90, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { if (m_FrameCounter & 1) { @@ -9241,7 +9232,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } break; @@ -9254,7 +9245,7 @@ cAudioManager::ProcessGarages() if (distSquared < SQR(SOUND_INTENSITY)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; m_sQueueSample.m_nFrequency = 6735; @@ -9278,7 +9269,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; - m_sQueueSample.m_bRequireReflection = TRUE; + SET_SOUND_REFLECTION(TRUE); AddSampleToRequestedQueue(); } } @@ -9303,7 +9294,7 @@ cAudioManager::ProcessFireHydrant() if (distSquared < SQR(SOUND_INTENSITY)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(40, 35.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_nFrequency = 15591; @@ -9315,7 +9306,7 @@ cAudioManager::ProcessFireHydrant() SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; AddSampleToRequestedQueue(); @@ -9361,7 +9352,7 @@ cAudioManager::ProcessBridgeWarning() { if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS; @@ -9376,7 +9367,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } @@ -9387,7 +9378,7 @@ cAudioManager::ProcessBridgeMotor() { if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -9422,7 +9413,7 @@ cAudioManager::ProcessBridgeOneShots() if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { + if (m_sQueueSample.m_nVolume > 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; @@ -9435,7 +9426,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; + SET_SOUND_REFLECTION(FALSE); AddSampleToRequestedQueue(); } } -- cgit v1.2.3 From 296e7ed9ad28a681ed22c2afaa518fee79eec1f1 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 18 Aug 2021 17:31:34 +0300 Subject: Possible fix of ProcessVehicleOneShots crash --- src/audio/AudioLogic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio/AudioLogic.cpp') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 699dec79..10382a77 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3341,7 +3341,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) int32 frequency; CPed *pPed = params.m_pVehicle->pDriver; if(!pPed) - break; + continue; if(!pPed->HasWeaponSlot(WEAPONSLOT_SUBMACHINEGUN) || (params.m_pVehicle->GetModelIndex() == MI_PREDATOR && !pPed->IsPedDoingDriveByShooting())) { sampleIndex = SFX_UZI_LEFT; frequency = SampleManager.GetSampleBaseFrequency(sampleIndex); -- cgit v1.2.3 From 2120d4d3ce32892b78b91b304dc00e0c2eef6244 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 18 Aug 2021 18:37:43 +0300 Subject: Fix acceleration sound playing when exiting the vehicle, code fixes in ProcessPlayersVehicleEngine --- src/audio/AudioLogic.cpp | 119 ++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 78 deletions(-) (limited to 'src/audio/AudioLogic.cpp') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 10382a77..915659a4 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -298,6 +298,7 @@ void cAudioManager::ProcessSpecial() { CPlayerPed *playerPed; + CVehicle *remoteVehicle; if (m_nUserPause) { if (!m_nPreviousUserPause) { @@ -307,13 +308,12 @@ cAudioManager::ProcessSpecial() } else { if (!CReplay::IsPlayingBack()) ProcessPlayerMood(); + remoteVehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle; playerPed = FindPlayerPed(); - if (playerPed != nil) { + if (playerPed) { if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) { - if (playerPed->EnteringCar()) { - if(!playerPed->bInVehicle && CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); - } + if(!playerPed->EnteringCar() && !playerPed->bInVehicle && !remoteVehicle) + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } } @@ -1522,9 +1522,6 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) float velocity; uint8 wheelsOnGround; - if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return FALSE; - if (params.m_fDistance >= SQR(SOUND_INTENSITY)) return FALSE; switch (params.m_VehicleType) { @@ -1980,8 +1977,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh CVector pos; float* gasPedalAudioPtr; - int32 accelerateState; - int32 brakeState; + int16 accelerateState; + int16 brakeState; int32 freq; int32 baseFreq; int32 freqModifier; @@ -2015,7 +2012,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh static bool8 bAccelSampleStopped = TRUE; lostTraction = FALSE; - isMoped = params.m_pVehicle->m_modelIndex == MI_PIZZABOY || params.m_pVehicle->m_modelIndex == MI_FAGGIO; + isMoped = FALSE; processedAccelSampleStopped = FALSE; if (bPlayerJustEnteredCar) { bAccelSampleStopped = TRUE; @@ -2034,7 +2031,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh brakeState = Pads[0].GetBrake(); } channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE); - if (isMoped) { + if (params.m_pVehicle->m_modelIndex == MI_PIZZABOY || params.m_pVehicle->m_modelIndex == MI_FAGGIO) { CurrentPretendGear = params.m_pTransmission->nNumberOfGears; currentGear = CurrentPretendGear; if (params.m_pVehicle->bIsHandbrakeOn) { @@ -2045,6 +2042,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } else { nCruising = 1; } + isMoped = TRUE; } else { currentGear = params.m_pVehicle->m_nCurrentGear; } @@ -2209,7 +2207,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh *gasPedalAudioPtr = Max(0.0f, gasPedalAudio); } else if (LastAccel > 0) { if (channelUsed) { - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); bAccelSampleStopped = TRUE; } nCruising = 0; @@ -2225,8 +2223,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } } if (gasPedalAudio > 0.05f) { - freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; - vol = (25.0f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40; + freq = (5000.f * ((gasPedalAudio - 0.05f) * 20.f / 19)) + 19000; + vol = (25.0f * ((gasPedalAudio - 0.05f) * 20.f / 19)) + 40; if (params.m_pVehicle->bIsDrowning) vol /= 4; if (engineSoundType == SFX_BANK_TRUCK) @@ -2287,83 +2285,50 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh processedAccelSampleStopped = TRUE; bAccelSampleStopped = FALSE; } - if (channelUsed) { -#ifdef EXTERNAL_3D_SOUND - SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); - SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f); -#else - SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); - SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset); -#endif - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == SFX_BANK_TRUCK) - freq /= 2; - SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); - } - } else if (processedAccelSampleStopped) { - gearSoundStartTime = CTimer::GetTimeInMilliseconds(); - params.m_pVehicle->bAudioChangingGear = TRUE; - if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) - return; - SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); - SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); - -#ifdef EXTERNAL_3D_SOUND - SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); - SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f); -#else - SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); - SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset); -#endif - freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); - if (engineSoundType == SFX_BANK_TRUCK) - freq /= 2; - SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + if (!channelUsed) { + if (!processedAccelSampleStopped) { + if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1) + ++CurrentPretendGear; + else { + nCruising = 1; + params.m_pVehicle->bAudioChangingGear = TRUE; + //break; // while was used just for this fucking place + goto PlayCruising; + } } - } else if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1) { - ++CurrentPretendGear; gearSoundStartTime = CTimer::GetTimeInMilliseconds(); params.m_pVehicle->bAudioChangingGear = TRUE; if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); + } #ifdef EXTERNAL_3D_SOUND - SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); - SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f); + SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); + SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f); #else - SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); - SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset); + SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); + SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset); #endif - freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); - if (engineSoundType == SFX_BANK_TRUCK) - freq /= 2; - SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); - } - } else { - nCruising = 1; - goto PlayCruising; + freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; + if (engineSoundType == SFX_BANK_TRUCK) + freq /= 2; + SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); + SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } } else { PlayCruising: bAccelSampleStopped = TRUE; SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); - if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn - && !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) { + if (!isMoped && (accelerateState < 150 || wheelsOnGround == 0 || brakeState > 0 || params.m_pVehicle->bIsHandbrakeOn + || lostTraction || currentGear < params.m_pTransmission->nNumberOfGears - 1)) { + nCruising = 0; + } else { if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) { if (nCruising < 800) ++nCruising; @@ -2374,15 +2339,13 @@ PlayCruising: if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, TRUE); - } else { - nCruising = 0; } } } LastAccel = accelerateState; + bHandbrakeOnLastFrame = params.m_pVehicle->bIsHandbrakeOn; bLostTractionLastFrame = lostTraction; - return; } bool8 -- cgit v1.2.3 From 51ba90dd522b82b4376888b50be7d1d1afab31fc Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 19 Aug 2021 08:45:56 +0300 Subject: Audio: ifdef more things that aren't on ps2 --- src/audio/AudioLogic.cpp | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'src/audio/AudioLogic.cpp') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 915659a4..225a275a 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1997,23 +1997,22 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh float relativeVelocityChange; float time; bool8 channelUsed; - bool8 lostTraction; + bool8 slowingDown; bool8 noGearBox; bool8 stuckInSand; - bool8 processedAccelSampleStopped; - bool8 isMoped; - static uint32 gearSoundStartTime = CTimer::GetTimeInMilliseconds(); - static int32 nCruising = 0; static int16 LastAccel = 0; static uint8 CurrentPretendGear = 1; static bool8 bLostTractionLastFrame = FALSE; static bool8 bHandbrakeOnLastFrame = FALSE; + static int32 nCruising = 0; static bool8 bAccelSampleStopped = TRUE; - lostTraction = FALSE; - isMoped = FALSE; - processedAccelSampleStopped = FALSE; + bool8 lostTraction = FALSE; + bool8 isMoped = FALSE; + bool8 processedAccelSampleStopped = FALSE; + static uint32 gearSoundStartTime = CTimer::GetTimeInMilliseconds(); + uint8 nChannel = CHANNEL_PLAYER_VEHICLE_ENGINE; // TODO: PS2 channels if (bPlayerJustEnteredCar) { bAccelSampleStopped = TRUE; bPlayerJustEnteredCar = FALSE; @@ -2030,7 +2029,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh accelerateState = Pads[0].GetAccelerate(); brakeState = Pads[0].GetBrake(); } - channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE); + slowingDown = params.m_fVelocityChange < -0.001f; + channelUsed = SampleManager.GetChannelUsedFlag(nChannel); if (params.m_pVehicle->m_modelIndex == MI_PIZZABOY || params.m_pVehicle->m_modelIndex == MI_FAGGIO) { CurrentPretendGear = params.m_pTransmission->nNumberOfGears; currentGear = CurrentPretendGear; @@ -2110,7 +2110,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); else freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f); - if (params.m_fVelocityChange < -0.001f) + if (slowingDown) freqModifier = -freqModifier; } else freqModifier = 0; @@ -2193,9 +2193,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh break; } if (accelerateState <= 0) { - if (params.m_fVelocityChange < -0.001f) { + if (slowingDown) { if (channelUsed) { - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.StopChannel(nChannel); bAccelSampleStopped = TRUE; } if (wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction) @@ -2207,7 +2207,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh *gasPedalAudioPtr = Max(0.0f, gasPedalAudio); } else if (LastAccel > 0) { if (channelUsed) { - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.StopChannel(nChannel); bAccelSampleStopped = TRUE; } nCruising = 0; @@ -2268,7 +2268,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; if (channelUsed) { - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.StopChannel(nChannel); bAccelSampleStopped = TRUE; } if (params.m_pVehicle->bIsDrowning) @@ -2292,16 +2292,19 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh else { nCruising = 1; params.m_pVehicle->bAudioChangingGear = TRUE; - //break; // while was used just for this fucking place goto PlayCruising; } } gearSoundStartTime = CTimer::GetTimeInMilliseconds(); params.m_pVehicle->bAudioChangingGear = TRUE; +#ifdef GTA_PS2 + SampleManager.InitialiseChannel(nChannel, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0); +#else if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); +#endif } #ifdef EXTERNAL_3D_SOUND @@ -2309,22 +2312,22 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f); #else - SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); - SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset); + SampleManager.SetChannelVolume(nChannel, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance)); + SampleManager.SetChannelPan(nChannel, m_sQueueSample.m_nOffset); #endif freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); + SampleManager.SetChannelFrequency(nChannel, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.SetChannelReverbFlag(nChannel, m_bDynamicAcousticModelingStatus != FALSE); + SampleManager.StartChannel(nChannel); } } } else { PlayCruising: bAccelSampleStopped = TRUE; - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + SampleManager.StopChannel(nChannel); if (!isMoped && (accelerateState < 150 || wheelsOnGround == 0 || brakeState > 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction || currentGear < params.m_pTransmission->nNumberOfGears - 1)) { nCruising = 0; -- cgit v1.2.3 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/AudioLogic.cpp | 152 ++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 73 deletions(-) (limited to 'src/audio/AudioLogic.cpp') 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(); } -- cgit v1.2.3