summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioLogic.cpp
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2020-10-18 15:14:03 +0200
committerFilip Gawin <filip.gawin@zoho.com>2020-10-18 15:14:03 +0200
commit747fe7ab67890903ede4f3277a430c5d33fc9316 (patch)
tree7860c2e6d323f63b97d5412aa31f122fe64c771f /src/audio/AudioLogic.cpp
parentAdd missing breaks in AudioLogic.cpp (diff)
parentScript.cpp missing breaks (diff)
downloadre3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar.gz
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar.bz2
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar.lz
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar.xz
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.tar.zst
re3-747fe7ab67890903ede4f3277a430c5d33fc9316.zip
Diffstat (limited to 'src/audio/AudioLogic.cpp')
-rw-r--r--src/audio/AudioLogic.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index d0e426ab..3fc9334f 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -813,7 +813,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int32 emittingVol;
uint32 freq;
- float modificator;
+ float multiplier;
int sampleFreq;
float velocity;
@@ -836,9 +836,9 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
freq = 6050 * emittingVol / 30 + 16000;
} else {
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
- modificator = m_sQueueSample.m_fDistance / 190.f;
+ multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
+ freq = (sampleFreq * multiplier) + ((3 * sampleFreq) / 4);
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
@@ -866,7 +866,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
float relativeVelocity;
int32 emittingVol;
- float modificator;
+ float multiplier;
int freq;
float velChange;
@@ -886,9 +886,13 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
- modificator = m_sQueueSample.m_fDistance / 6.f;
+#ifdef FIX_BUGS
+ multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
+#else
+ multiplier = (m_sQueueSample.m_fDistance / 3.0f) * 0.5f;
+#endif
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- m_sQueueSample.m_nFrequency = freq + freq * modificator;
+ m_sQueueSample.m_nFrequency = freq + freq * multiplier;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -6459,17 +6463,25 @@ cAudioManager::ProcessFires(int32)
void
cAudioManager::ProcessWaterCannon(int32)
{
- const float SOUND_INTENSITY = 900.0f;
+ const float SOUND_INTENSITY = 30.0f;
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
if (CWaterCannons::aCannons[i].m_nId) {
m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SOUND_INTENSITY) {
+ if (distSquared < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
+#ifdef FIX_BUGS
+ m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+#else
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+#endif
if (m_sQueueSample.m_nVolume != 0) {
+#ifdef FIX_BUGS
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+#else
+ m_sQueueSample.m_fSoundIntensity = SQR(SOUND_INTENSITY);
+#endif
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = 15591;