Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix car fake/cruise top gear SFX at high FPS.
- Loading branch information
Showing
with
11 additions
and
5 deletions.
-
+11
−5
src/audio/AudioLogic.cpp
There are no files selected for viewing
|
|
@@ -2347,11 +2347,17 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh |
|
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
|
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
|
if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn
|
|
if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn
|
|
&& !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) {
|
|
&& !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) {
|
|
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
|
|
#ifdef FIX_BUGS
|
|
if (nCruising < 800)
|
|
// Prevent the fake top gear ("cruise gear") rising in pitch too quickly at high FPS.
|
|
++nCruising;
|
|
if (CTimer::GetLogicalFramesPassed())
|
|
} else if (nCruising > 3) {
|
|
#endif
|
|
--nCruising;
|
|
{
|
|
|
|
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
|
|
|
|
if (nCruising < 800)
|
|
|
|
++nCruising;
|
|
|
|
} else if (nCruising > 3) {
|
|
|
|
--nCruising;
|
|
|
|
}
|
|
}
|
|
}
|
|
freq = 27 * nCruising + freqModifier + 22050;
|
|
freq = 27 * nCruising + freqModifier + 22050;
|
|
if (engineSoundType == SFX_BANK_TRUCK)
|
|
if (engineSoundType == SFX_BANK_TRUCK)
|
|
|
|