summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-18 20:07:33 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-18 20:07:33 +0200
commiteda2c054489e83a03a14976747cd19e3ac60d7a4 (patch)
treefd5338b76e24286a0900d4964a38a576ef8bad99 /src/audio
parentFix acceleration sound playing when exiting the vehicle (diff)
downloadre3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar.gz
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar.bz2
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar.lz
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar.xz
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.tar.zst
re3-eda2c054489e83a03a14976747cd19e3ac60d7a4.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioLogic.cpp20
-rw-r--r--src/audio/AudioManager.cpp7
-rw-r--r--src/audio/PolRadio.cpp2
3 files changed, 27 insertions, 2 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 9b8e278b..6756925d 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -246,6 +246,12 @@ cAudioManager::ProcessReverb()
}
#else
// TODO: PS2 code
+
+ static uint8 OldVolL = 0;
+ static uint8 OldVolR = 0;
+
+ // SoundDistUp, SoundDistLeft, SoundDistRight used in here from TheCamera
+
SampleManager.UpdateReverb();
#endif
}
@@ -1197,6 +1203,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
uint8 currentGear;
float gasPedalAudio;
CVector pos;
+ bool8 slowingDown;
static int16 LastAccel = 0;
static int16 LastBrake = 0;
@@ -1223,6 +1230,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
else
accelerateState = Pads[0].GetAccelerate();
+ slowingDown = params.m_fVelocityChange < -0.001f;
channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE);
transmission = params.m_pTransmission;
velocityChange = params.m_fVelocityChange;
@@ -1260,7 +1268,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
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;
@@ -1268,7 +1276,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank;
soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET);
if (accelerateState <= 0) {
- if (params.m_fVelocityChange < -0.001f) {
+ if (slowingDown) {
if (channelUsed) {
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
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))
return;
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
+#endif
}
#ifdef EXTERNAL_3D_SOUND
@@ -1376,7 +1388,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
freq /= 2;
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
if (!channelUsed) {
+#if GTA_VERSION >= GTA3_PC_10
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE);
+#else
+ SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, TRUE);
+#endif
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
}
}
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 15c8c00e..a288ac12 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -955,7 +955,12 @@ cAudioManager::ProcessActiveQueues()
#else
emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume;
#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)) {
+#endif
SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(j, emittingVol);
@@ -963,8 +968,10 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannelVolume(j, emittingVol);
SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
#endif
+#ifndef GTA_PS2
SampleManager.SetChannelLoopPoints(j, m_asActiveSamples[j].m_nLoopStart, m_asActiveSamples[j].m_nLoopEnd);
SampleManager.SetChannelLoopCount(j, m_asActiveSamples[j].m_nLoopCount);
+#endif
SampleManager.SetChannelReverbFlag(j, m_asActiveSamples[j].m_bReverbFlag);
#ifdef EXTERNAL_3D_SOUND
if (m_asActiveSamples[j].m_bIs2D) {
diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp
index b5df5c14..b1460b3c 100644
--- a/src/audio/PolRadio.cpp
+++ b/src/audio/PolRadio.cpp
@@ -271,8 +271,10 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
+#ifndef GTA_PS2
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
+#endif
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
}
if (processed) ResetPoliceRadio();