More small audio fixes

This commit is contained in:
Sergeanur 2020-05-16 21:00:27 +03:00
parent 13a0bf1c43
commit 4ff0697b4d
2 changed files with 13 additions and 14 deletions

View file

@ -1304,7 +1304,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
SampleManager.SetChannelFrequency(m_nActiveSamples, freq); SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
if (!channelUsed) { if (!channelUsed) {
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false);
SampleManager.StartChannel(m_nActiveSamples); SampleManager.StartChannel(m_nActiveSamples);
} }
LastAccel = accelerateState; LastAccel = accelerateState;
@ -1326,7 +1326,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
freq /= 2; freq /= 2;
SampleManager.SetChannelFrequency(m_nActiveSamples, freq); SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
if (!channelUsed) { if (!channelUsed) {
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false);
SampleManager.StartChannel(m_nActiveSamples); SampleManager.StartChannel(m_nActiveSamples);
} }
LastAccel = accelerateState; LastAccel = accelerateState;
@ -1349,7 +1349,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
freq /= 2; freq /= 2;
SampleManager.SetChannelFrequency(m_nActiveSamples, freq); SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
if (!channelUsed) { if (!channelUsed) {
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false);
SampleManager.StartChannel(m_nActiveSamples); SampleManager.StartChannel(m_nActiveSamples);
} }
LastAccel = accelerateState; LastAccel = accelerateState;
@ -1515,11 +1515,10 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo
{ {
float relativeVelChange; float relativeVelChange;
if (automobile->m_aWheelState[wheel] == 2) { if (automobile->m_aWheelState[wheel] == WHEEL_STATE_SKIDDING)
relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
} else { else
relativeVelChange = 0.0f; relativeVelChange = 0.0f;
}
return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
} }
@ -1606,7 +1605,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
CVehicle *veh = params->m_pVehicle; CVehicle *veh = params->m_pVehicle;
if (veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) if (veh->m_bSirenOrAlarm == false && veh->m_nAlarmState <= 0)
return; return;
#ifdef FIX_BUGS #ifdef FIX_BUGS

View file

@ -32,7 +32,7 @@ cAudioManager::cAudioManager()
ClearActiveSamples(); ClearActiveSamples();
GenerateIntegerRandomNumberTable(); GenerateIntegerRandomNumberTable();
field_4 = 0; field_4 = 0;
m_bDynamicAcousticModelingStatus = 1; m_bDynamicAcousticModelingStatus = true;
for (int i = 0; i < NUM_AUDIOENTITIES; i++) { for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = false; m_asAudioEntities[i].m_bIsUsed = false;
@ -514,19 +514,19 @@ cAudioManager::RandomDisplacement(uint32 seed) const
{ {
int32 value; int32 value;
static bool bIsEven = true; static bool bPos = true;
static uint32 base = 0; static uint32 Adjustment = 0;
if (!seed) if (!seed)
return 0; return 0;
value = m_anRandomTable[(base + seed) % 5] % seed; value = m_anRandomTable[(Adjustment + seed) % 5] % seed;
base += value; Adjustment += value;
if (value % 2) { if (value % 2) {
bIsEven = !bIsEven; bPos = !bPos;
} }
if (!bIsEven) if (!bPos)
value = -value; value = -value;
return value; return value;
} }