Audio: ifdef more things that aren't on ps2

This commit is contained in:
Sergeanur 2021-08-18 21:07:33 +03:00
parent 01c70dfb76
commit eda2c05448
3 changed files with 27 additions and 2 deletions

View file

@ -246,6 +246,12 @@ cAudioManager::ProcessReverb()
} }
#else #else
// TODO: PS2 code // TODO: PS2 code
static uint8 OldVolL = 0;
static uint8 OldVolR = 0;
// SoundDistUp, SoundDistLeft, SoundDistRight used in here from TheCamera
SampleManager.UpdateReverb(); SampleManager.UpdateReverb();
#endif #endif
} }
@ -1197,6 +1203,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
uint8 currentGear; uint8 currentGear;
float gasPedalAudio; float gasPedalAudio;
CVector pos; CVector pos;
bool8 slowingDown;
static int16 LastAccel = 0; static int16 LastAccel = 0;
static int16 LastBrake = 0; static int16 LastBrake = 0;
@ -1223,6 +1230,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
else else
accelerateState = Pads[0].GetAccelerate(); accelerateState = Pads[0].GetAccelerate();
slowingDown = params.m_fVelocityChange < -0.001f;
channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE); channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE);
transmission = params.m_pTransmission; transmission = params.m_pTransmission;
velocityChange = params.m_fVelocityChange; velocityChange = params.m_fVelocityChange;
@ -1260,7 +1268,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f);
else else
freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f); freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f);
if (params.m_fVelocityChange < -0.001f) if (slowingDown)
freqModifier = -freqModifier; freqModifier = -freqModifier;
} else } else
freqModifier = 0; freqModifier = 0;
@ -1268,7 +1276,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank; engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank;
soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET); soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET);
if (accelerateState <= 0) { if (accelerateState <= 0) {
if (params.m_fVelocityChange < -0.001f) { if (slowingDown) {
if (channelUsed) { if (channelUsed) {
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
bAccelSampleStopped = TRUE; bAccelSampleStopped = TRUE;
@ -1356,10 +1364,14 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
} }
} }
#ifdef GTA_PS2
SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0);
#else
if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0))
return; return;
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
#endif
} }
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
@ -1376,7 +1388,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
freq /= 2; freq /= 2;
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
if (!channelUsed) { if (!channelUsed) {
#if GTA_VERSION >= GTA3_PC_10
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE);
#else
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, TRUE);
#endif
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
} }
} }

View file

@ -955,7 +955,12 @@ cAudioManager::ProcessActiveQueues()
#else #else
emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume; emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume;
#endif #endif
#ifdef GTA_PS2
{
SampleManager.InitialiseChannel(j, m_asActiveSamples[j].m_nSampleIndex, m_asActiveSamples[j].m_nBankIndex);
#else
if (SampleManager.InitialiseChannel(j, m_asActiveSamples[j].m_nSampleIndex, m_asActiveSamples[j].m_nBankIndex)) { if (SampleManager.InitialiseChannel(j, m_asActiveSamples[j].m_nSampleIndex, m_asActiveSamples[j].m_nBankIndex)) {
#endif
SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency); SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(j, emittingVol); SampleManager.SetChannelEmittingVolume(j, emittingVol);
@ -963,8 +968,10 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannelVolume(j, emittingVol); SampleManager.SetChannelVolume(j, emittingVol);
SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset); SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
#endif #endif
#ifndef GTA_PS2
SampleManager.SetChannelLoopPoints(j, m_asActiveSamples[j].m_nLoopStart, m_asActiveSamples[j].m_nLoopEnd); SampleManager.SetChannelLoopPoints(j, m_asActiveSamples[j].m_nLoopStart, m_asActiveSamples[j].m_nLoopEnd);
SampleManager.SetChannelLoopCount(j, m_asActiveSamples[j].m_nLoopCount); SampleManager.SetChannelLoopCount(j, m_asActiveSamples[j].m_nLoopCount);
#endif
SampleManager.SetChannelReverbFlag(j, m_asActiveSamples[j].m_bReverbFlag); SampleManager.SetChannelReverbFlag(j, m_asActiveSamples[j].m_bReverbFlag);
#ifdef EXTERNAL_3D_SOUND #ifdef EXTERNAL_3D_SOUND
if (m_asActiveSamples[j].m_bIs2D) { if (m_asActiveSamples[j].m_bIs2D) {

View file

@ -271,8 +271,10 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq); SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100); SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63); SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
#ifndef GTA_PS2
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1); SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1); SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
#endif
SampleManager.StartChannel(CHANNEL_POLICE_RADIO); SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
} }
if (processed) ResetPoliceRadio(); if (processed) ResetPoliceRadio();