From 1cc8a1d2470e691a6214af5fa9759e9d6eb2f738 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 25 Dec 2020 09:13:01 +0200 Subject: Small audio code fix --- src/audio/AudioLogic.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/audio') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 88f48db6..8180a97a 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -2002,27 +2002,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } } else { nCruising = 1; - params.m_pVehicle->bAudioChangingGear = true; - bAccelSampleStopped = true; - SampleManager.StopChannel(m_nActiveSamples); - if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn - && !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) { - if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) { - if (nCruising < 800) - ++nCruising; - } else if (nCruising > 3) { - --nCruising; - } - freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == SFX_BANK_TRUCK) - freq /= 2; - AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); - } else { - nCruising = 0; - } + goto PlayCruising; } } } else { +PlayCruising: bAccelSampleStopped = true; SampleManager.StopChannel(m_nActiveSamples); if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn @@ -2036,7 +2020,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq = 27 * nCruising + freqModifier + 22050; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); + AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); } else { nCruising = 0; } -- cgit v1.2.3