summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioCollision.cpp8
-rw-r--r--src/audio/AudioLogic.cpp355
-rw-r--r--src/audio/AudioManager.cpp50
-rw-r--r--src/audio/AudioManager.h41
-rw-r--r--src/audio/DMAudio.cpp2
-rw-r--r--src/audio/MusicManager.cpp6
-rw-r--r--src/audio/PolRadio.cpp40
-rw-r--r--src/audio/sampman_miles.cpp2
-rw-r--r--src/audio/sampman_oal.cpp2
-rw-r--r--src/core/config.h2
10 files changed, 271 insertions, 237 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index 4bf6a404..19212889 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -205,7 +205,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume) {
+ if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
switch(m_sQueueSample.m_nSampleIndex) {
case SFX_COL_TARMAC_1:
@@ -271,7 +271,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -287,7 +287,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
if(emittingVol) {
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume) {
+ if(m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -301,7 +301,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 564881b8..699dec79 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -894,7 +894,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
emittingVol = 0;
if (emittingVol != 0) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 88;
if (boat != nil) {
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO3;
@@ -918,7 +918,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -953,7 +953,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
//sound from front of helicopter
emittingVol = (1.0f - cameraAngle) * volumeModifier * 127.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 3;
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_1;
@@ -969,7 +969,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
} else if (boat != nil) {
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO1;
@@ -994,7 +994,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
} else {
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI;
@@ -1010,7 +1010,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1019,7 +1019,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
//after accel rotor sound
emittingVol = ((cameraAngle + 1.0f) * volumeModifier * 127.0f) / 2.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 140.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 1;
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_2;
@@ -1054,7 +1054,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
@@ -1065,7 +1065,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
if (propellerSpeed < 1.0f) {
emittingVol = (1.0f - propellerSpeed / 2.0f) * 70.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (hunterBool) {
m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_4;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1087,7 +1087,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1098,7 +1098,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
if (boat) {
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIXED && m_sQueueSample.m_fDistance < 20.0f && propellerSpeed > 0.0f) {
m_sQueueSample.m_nVolume = ComputeVolume(propellerSpeed * 100.0f, 20.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (accelerateState > 0 || brakeState > 0)
m_sQueueSample.m_nFrequency = 18000 + Min(1.0f, (Max(accelerateState, brakeState) / 255.0f) * freqModifier) * 2204;
@@ -1122,7 +1122,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1138,7 +1138,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
if (params.m_fDistance < SQR(27.0f)) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(volumeModifier * 25.0f, 27.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1153,7 +1153,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1182,7 +1182,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
emittingVol = 30.0f * CWeather::Rain;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++;
if (veh->m_bRainSamplesCounter > 4)
veh->m_bRainSamplesCounter = 68;
@@ -1198,7 +1198,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1231,7 +1231,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params)
emittingVolume = modificator * 24.0f;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, reverseGearIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (params.m_pVehicle->m_fGasPedal >= 0.0f) {
m_sQueueSample.m_nCounter = 62;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
@@ -1251,7 +1251,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1293,7 +1293,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params)
freq = Clamp2(5 * acceletateState + 22050, (int)prevFreq, 30);
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(70, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_CAR_RC_HELI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1308,7 +1308,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
if (isPlayerVeh)
@@ -1356,7 +1356,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
if (volume > 0) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_RC_REV;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1371,7 +1371,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1413,7 +1413,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
if (volume > 0) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (vehSlowdown) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_RC_IDLE;
@@ -1434,7 +1434,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1489,7 +1489,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params)
emittingVol = (100.0f * modifier);
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 95;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
@@ -1504,7 +1504,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1546,7 +1546,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
emittingVol = 30.f * Min(1.f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity));
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
@@ -1569,7 +1569,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1611,7 +1611,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params)
relativeVelocity = Min(1.0f, velocity / (0.5f * params.m_pTransmission->fMaxVelocity));
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1628,7 +1628,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1808,7 +1808,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
m_sQueueSample.m_nCounter = 2;
}
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (!caddyBool) {
if (veh->GetStatus() == STATUS_SIMPLE) {
if (modificator < 0.02f) {
@@ -1850,7 +1850,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1893,7 +1893,7 @@ void
cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping)
{
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_nSampleIndex = sample;
#ifdef GTA_PS2
@@ -1916,7 +1916,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp
m_sQueueSample.m_SoundIntensity = 50.0f;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -1927,7 +1927,7 @@ cAudioManager::ProcessCesna(cVehicleParams &params)
if(params.m_fDistance < SQR(200)) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1942,12 +1942,12 @@ cAudioManager::ProcessCesna(cVehicleParams &params)
m_sQueueSample.m_SoundIntensity = 200.0f;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
if(params.m_fDistance < SQR(90)) {
m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -1962,7 +1962,7 @@ cAudioManager::ProcessCesna(cVehicleParams &params)
m_sQueueSample.m_SoundIntensity = 90.0f;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2457,7 +2457,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
if (skidVal > 0.0f) {
emittingVol = 50.f * skidVal;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 3;
switch (params.m_pVehicle->m_nSurfaceTouched) {
case SURFACE_GRASS:
@@ -2497,7 +2497,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2584,7 +2584,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
volume = veh->bIsDrowning ? 20 : 80;
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -2603,7 +2603,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2650,7 +2650,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
volume = veh->bIsDrowning ? 20 : 80;
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 5;
if (UsesSiren(params)) {
if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED)
@@ -2684,7 +2684,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
return TRUE;
@@ -2711,7 +2711,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
volume = veh->bIsDrowning ? 15 : 60;
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -2730,7 +2730,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2760,7 +2760,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
if (velocity > 0.0035f) {
emittingVol = (100.0f * velocity * 10.0f / 3.0f);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = i + 6;
m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000);
@@ -2774,7 +2774,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
AddSampleToRequestedQueue();
}
}
@@ -2804,7 +2804,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
volume = m_anRandomTable[0] % 10 + 70;
m_sQueueSample.m_nVolume = ComputeVolume(volume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 13;
m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES);
@@ -2819,7 +2819,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params)
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
@@ -2864,7 +2864,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params)
if (params.m_pVehicle->bIsDrowning)
emittingVolume /= 2;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 28;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
@@ -2876,7 +2876,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2909,7 +2909,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params)
if (bombType == CARBOMB_TIMEDACTIVE) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 35;
m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -2924,7 +2924,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -2940,14 +2940,14 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
float relVol;
float vol;
bool8 noReflections;
- bool8 isHeli;
+ bool8 stereo;
float maxDist;
static uint8 GunIndex = 53;
for (uint16 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
noReflections = FALSE;
- isHeli = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ stereo = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
switch (event) {
case SOUND_CAR_DOOR_CLOSE_BONNET:
@@ -2990,7 +2990,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_CAR_DOOR_OPEN_BONNET:
@@ -3030,7 +3030,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_CAR_WINDSHIELD_CRACK: {
@@ -3105,7 +3105,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_CAR_LIGHT_BREAK: {
@@ -3248,7 +3248,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVol = 60;
break;
}
@@ -3330,8 +3330,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
- isHeli = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
+ stereo = TRUE;
break;
default:
{
@@ -3384,7 +3384,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
}
@@ -3416,7 +3416,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVol = 50;
maxDist = SQR(SOUND_INTENSITY);
break;
@@ -3457,7 +3457,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVol = m_anRandomTable[4] % 20 + 90;
break;
}
@@ -3475,7 +3475,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
maxDist = SQR(SOUND_INTENSITY);
emittingVol = m_anRandomTable[4] % 20 + 55;
CrunchOffset %= 2;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_CAR_PED_COLLISION: {
@@ -3502,7 +3502,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
if (params.m_fDistance < maxDist) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (noReflections) {
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
@@ -3513,42 +3513,25 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bReverbFlag = TRUE;
- if (isHeli) {
- if (0.2f * m_sQueueSample.m_SoundIntensity > m_sQueueSample.m_fDistance) {
+ if (stereo) {
+ if(m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) {
m_sQueueSample.m_bIs2D = TRUE;
m_sQueueSample.m_nOffset = 0;
-#ifdef THIS_IS_STUPID
- goto AddSample;
-#else
- AddSampleToRequestedQueue();
- m_sQueueSample.m_nOffset = 127;
- m_sQueueSample.m_nSampleIndex++;
- m_sQueueSample.m_nCounter = GunIndex++;
- if (GunIndex > 58)
- GunIndex = 53;
- m_sQueueSample.m_bRequireReflection = FALSE;
- AddSampleToRequestedQueue();
- continue;
-#endif
+ } else {
+ stereo = FALSE;
+ m_sQueueSample.m_bIs2D = FALSE;
}
- isHeli = FALSE;
- }
- m_sQueueSample.m_bIs2D = FALSE;
-#ifdef THIS_IS_STUPID
-AddSample:
+ } else m_sQueueSample.m_bIs2D = FALSE;
AddSampleToRequestedQueue();
- if (isHeli) {
+ if (stereo) {
m_sQueueSample.m_nOffset = 127;
m_sQueueSample.m_nSampleIndex++;
m_sQueueSample.m_nCounter = GunIndex++;
if (GunIndex > 58)
GunIndex = 53;
- m_sQueueSample.m_bRequireReflection = 0;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
-#else
- AddSampleToRequestedQueue();
-#endif
continue;
}
@@ -3576,7 +3559,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
emittingVol = (75.f * speedMultipler);
if (train->m_fWagonPosition == 0.0f) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 32;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -3591,14 +3574,14 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
const float SOUND_INTENSITY = 70.0f;
if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 33;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -3613,7 +3596,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -3717,7 +3700,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
if (Vol > 0) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(Vol, intensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nFrequency = Freq;
m_sQueueSample.m_nCounter = 40;
if (isV12)
@@ -3735,7 +3718,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -3743,7 +3726,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
if(boat->GetModelIndex() == MI_REEFER) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, intensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nFrequency = 6000;
m_sQueueSample.m_nCounter = 39;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
@@ -3759,7 +3742,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -3791,7 +3774,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params)
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
vol = (30.f * multiplier);
m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 38;
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -3806,7 +3789,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 6;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
@@ -3958,7 +3941,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -3973,7 +3956,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
return TRUE;
@@ -3989,7 +3972,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq)
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -4004,7 +3987,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
return TRUE;
@@ -4019,7 +4002,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq)
uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 3;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -4034,7 +4017,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
return TRUE;
@@ -4048,7 +4031,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
m_sQueueSample.m_nVolume = vol;
- if(m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -4063,7 +4046,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE; // todo port fix to re3
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
return TRUE;
@@ -4078,7 +4061,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 5;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -4094,7 +4077,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_nReleasingVolumeDivider = 12;
m_sQueueSample.m_nOffset = 0;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
m_sQueueSample.m_nCounter = 6;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
@@ -4150,7 +4133,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
stereo = FALSE;
narrowSoundRange = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
switch (sound) {
case SOUND_STEP_START:
@@ -4228,7 +4211,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_FALL_LAND:
case SOUND_FALL_COLLAPSE:
@@ -4255,7 +4238,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_FIGHT_37:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
@@ -4350,7 +4333,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_WEAPON_BAT_ATTACK:
case SOUND_WEAPON_KNIFE_ATTACK:
@@ -4405,7 +4388,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_WEAPON_CHAINSAW_IDLE:
@@ -4502,7 +4485,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_COLT45:
@@ -4522,7 +4505,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_PYTHON:
@@ -4542,7 +4525,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_SHOTGUN:
@@ -4563,7 +4546,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_SPAS12_SHOTGUN:
@@ -4583,7 +4566,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_TEC9:
@@ -4719,7 +4702,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
stereo = TRUE;
break;
case WEAPONTYPE_FLAMETHROWER:
@@ -4815,7 +4798,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(75);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_WEAPON_AK47_BULLET_ECHO:
{
@@ -4879,7 +4862,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_WEAPON_FLAMETHROWER_FIRE:
@@ -4936,7 +4919,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_MELEE_ATTACK_START:
{
@@ -4972,7 +4955,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_SKATING:
@@ -4998,7 +4981,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
}
case SOUND_WEAPON_MINIGUN_ATTACK:
@@ -5050,7 +5033,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
SET_EMITTING_VOLUME(127);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SOUND_SHIRT_WIND_FLAP:
if (params.m_pPed->IsPlayer() && params.m_pPed->m_pMyVehicle) {
@@ -5106,7 +5089,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
if (params.m_fDistance < maxDist) {
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (stereo) {
if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) {
m_sQueueSample.m_bIs2D = TRUE;
@@ -5239,7 +5222,7 @@ cAudioManager::SetupPedComments(cPedParams &params, uint16 sound)
emittingVol = 31;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
pedComment.m_nProcess = 10;
- if(m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
pedComment.m_fDistance = m_sQueueSample.m_fDistance;
@@ -7879,7 +7862,7 @@ cPedComments::Process()
static uint8 counter = 0;
static int32 prevSamples[10];
- if(AudioManager.m_nUserPause != 0) return;
+ if(AudioManager.m_nUserPause) return;
if(m_nCommentsInBank[m_nActiveBank]) {
for(int i = 0; i < ARRAY_SIZE(prevSamples); i++) {
@@ -7922,10 +7905,15 @@ cPedComments::Process()
AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE;
AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
AudioManager.m_sQueueSample.m_bReverbFlag = TRUE;
+#ifdef AUDIO_REFLECTIONS
AudioManager.m_sQueueSample.m_bRequireReflection = TRUE;
+#endif // AUDIO_REFLECTIONS
AudioManager.m_sQueueSample.m_bIs2D = FALSE;
#ifdef FIX_BUGS
- if (sampleIndex >= SFX_PLAYER_ANGRY_BUSTED_1 && sampleIndex < TOTAL_AUDIO_SAMPLES) { // check if player sfx
+ if((sampleIndex >= SFX_POLICE_BOAT_1 && sampleIndex <= SFX_POLICE_BOAT_23) ||
+ (sampleIndex >= SFX_POLICE_HELI_1 && sampleIndex <= SFX_POLICE_HELI_20))
+ AudioManager.m_sQueueSample.m_SoundIntensity = 400.0f;
+ else if (sampleIndex >= SFX_PLAYER_ANGRY_BUSTED_1 && sampleIndex <= SFX_PLAYER_ON_FIRE_16) { // check if player sfx
AudioManager.m_sQueueSample.m_bIs2D = TRUE;
AudioManager.m_sQueueSample.m_nOffset = 63;
}
@@ -7997,7 +7985,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case EXPLOSION_MOLOTOV:
m_sQueueSample.m_SoundIntensity = 150.0f;
@@ -8005,7 +7993,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
break;
case EXPLOSION_MINE:
case EXPLOSION_HELI_BOMB:
@@ -8014,7 +8002,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
default:
m_sQueueSample.m_SoundIntensity = 200.0f;
@@ -8024,6 +8012,9 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; //same *= 8 / 10;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA;
+#ifdef FIX_BUGS
+ SET_SOUND_REFLECTION(TRUE);
+#endif
break;
}
m_sQueueSample.m_vecPos = *CExplosion::GetExplosionPosition(i);
@@ -8031,7 +8022,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bIs2D = FALSE;
@@ -8095,7 +8086,7 @@ cAudioManager::ProcessFires(int32)
if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
@@ -8106,7 +8097,7 @@ cAudioManager::ProcessFires(int32)
SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -8114,7 +8105,7 @@ cAudioManager::ProcessFires(int32)
gFireManager.m_aFires[i].m_bExtinguishedWithWater = FALSE;
emittingVol = 100.0f * gFireManager.m_aFires[i].m_fWaterExtinguishCountdown;
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nFrequency = 19591;
m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
@@ -8129,7 +8120,7 @@ cAudioManager::ProcessFires(int32)
SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -8149,7 +8140,7 @@ cAudioManager::ProcessWaterCannon(int32)
if (distSquared < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -8164,7 +8155,7 @@ cAudioManager::ProcessWaterCannon(int32)
SET_EMITTING_VOLUME(50);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -8211,7 +8202,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
emittingVolume = 60;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SCRIPT_SOUND_GARAGE_DOOR_CLUNK:
m_sQueueSample.m_SoundIntensity = 80.0f;
@@ -8223,7 +8214,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
emittingVolume = 60;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_HIT:
case SCRIPT_SOUND_BULLET_HIT_GROUND_1:
@@ -8248,7 +8239,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_fSpeedMultiplier = 1.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
break;
case SCRIPT_SOUND_MALE_AMBULANCE_OUCH:
{
@@ -8273,7 +8264,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
break;
case SCRIPT_SOUND_PAYPHONE_RINGING:
m_sQueueSample.m_SoundIntensity = 80.0f;
@@ -8284,7 +8275,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
break;
case SCRIPT_SOUND_GLASS_BREAK_L:
m_sQueueSample.m_SoundIntensity = 60.0f;
@@ -8315,7 +8306,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
break;
case SCRIPT_SOUND_GLASS_LIGHT_BREAK:
m_sQueueSample.m_SoundIntensity = 55.0f;
@@ -8335,7 +8326,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVolume = m_anRandomTable[2] % 20 + 80;
break;
case SCRIPT_SOUND_BOX_DESTROYED_2:
@@ -8346,7 +8337,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVolume = m_anRandomTable[2] % 20 + 80;
break;
case SCRIPT_SOUND_METAL_COLLISION:
@@ -8358,7 +8349,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVolume = m_anRandomTable[2] % 30 + 70;
break;
case SCRIPT_SOUND_TIRE_COLLISION:
@@ -8370,7 +8361,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVolume = m_anRandomTable[2] % 30 + 60;
break;
case SCRIPT_SOUND_HIT_BALL:
@@ -8382,7 +8373,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = FALSE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
emittingVolume = m_anRandomTable[2] % 30 + 60;
break;
case SCRIPT_SOUND_GUNSHELL_DROP:
@@ -8439,7 +8430,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
@@ -8654,7 +8645,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
if(distSquared < SQR(m_sQueueSample.m_SoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
@@ -8662,7 +8653,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bReverbFlag = TRUE;
SET_EMITTING_VOLUME(emittingVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -8708,7 +8699,7 @@ cAudioManager::ProcessWeather(int32 id)
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
RESET_LOOP_OFFSETS
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
@@ -8726,7 +8717,7 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bReverbFlag = FALSE;
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
x = 0.0f;
@@ -8750,7 +8741,7 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bReverbFlag = FALSE;
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
CObject::fDistToNearestTree = 999999.9f;
}
@@ -8964,7 +8955,7 @@ cAudioManager::ProcessFrontEnd()
}
}
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
if (stereo) {
++m_sQueueSample.m_nSampleIndex;
@@ -8998,7 +8989,7 @@ cAudioManager::ProcessCrane()
if (distSquared < SQR(intensity)) {
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -9013,7 +9004,7 @@ cAudioManager::ProcessCrane()
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) {
@@ -9023,7 +9014,7 @@ cAudioManager::ProcessCrane()
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
AddSampleToRequestedQueue();
}
}
@@ -9075,7 +9066,7 @@ cAudioManager::ProcessProjectiles()
if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
@@ -9083,7 +9074,7 @@ cAudioManager::ProcessProjectiles()
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -9107,7 +9098,7 @@ cAudioManager::ProcessEscalators()
if (distance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distance);
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973;
@@ -9122,7 +9113,7 @@ cAudioManager::ProcessEscalators()
SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -9146,7 +9137,7 @@ cAudioManager::ProcessExtraSounds()
if (distance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distance);
m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_nSampleIndex = SFX_ARCADE;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -9160,7 +9151,7 @@ cAudioManager::ProcessExtraSounds()
SET_LOOP_OFFSETS(SFX_ARCADE)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
m_sQueueSample.m_nReleasingVolumeDivider = 3;
AddSampleToRequestedQueue();
}
@@ -9197,7 +9188,7 @@ cAudioManager::ProcessGarages()
while (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(90, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) {
if (m_FrameCounter & 1) {
@@ -9241,7 +9232,7 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
break;
@@ -9254,7 +9245,7 @@ cAudioManager::ProcessGarages()
if (distSquared < SQR(SOUND_INTENSITY)) {
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2;
m_sQueueSample.m_nFrequency = 6735;
@@ -9278,7 +9269,7 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nCounter = iSound++;
if (iSound < 32)
iSound = 32;
- m_sQueueSample.m_bRequireReflection = TRUE;
+ SET_SOUND_REFLECTION(TRUE);
AddSampleToRequestedQueue();
}
}
@@ -9303,7 +9294,7 @@ cAudioManager::ProcessFireHydrant()
if (distSquared < SQR(SOUND_INTENSITY)) {
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(40, 35.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nReleasingVolumeModificator = 4;
m_sQueueSample.m_nFrequency = 15591;
@@ -9315,7 +9306,7 @@ cAudioManager::ProcessFireHydrant()
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
AddSampleToRequestedQueue();
@@ -9361,7 +9352,7 @@ cAudioManager::ProcessBridgeWarning()
{
if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS;
@@ -9376,7 +9367,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
@@ -9387,7 +9378,7 @@ cAudioManager::ProcessBridgeMotor()
{
if (m_sQueueSample.m_fDistance < bridgeIntensity) {
m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
@@ -9422,7 +9413,7 @@ cAudioManager::ProcessBridgeOneShots()
if (m_sQueueSample.m_fDistance < bridgeIntensity) {
m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
+ if (m_sQueueSample.m_nVolume > 0) {
m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
@@ -9435,7 +9426,7 @@ cAudioManager::ProcessBridgeOneShots()
m_sQueueSample.m_SoundIntensity = bridgeIntensity;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
}
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 686b9206..182aa0d5 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -32,7 +32,9 @@ cAudioManager::cAudioManager()
ClearActiveSamples();
GenerateIntegerRandomNumberTable();
m_bDoubleVolume = FALSE;
+#ifdef AUDIO_REFLECTIONS
m_bDynamicAcousticModelingStatus = TRUE;
+#endif
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = FALSE;
@@ -116,7 +118,9 @@ cAudioManager::Service()
if (m_bIsInitialised) {
m_nPreviousUserPause = m_nUserPause;
m_nUserPause = CTimer::GetIsUserPaused();
+#ifdef AUDIO_REFLECTIONS
UpdateReflections();
+#endif
ServiceSoundEffects();
MusicManager.Service();
}
@@ -451,11 +455,13 @@ cAudioManager::ReacquireDigitalHandle()
}
}
+#ifdef AUDIO_REFLECTIONS
void
cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
{
m_bDynamicAcousticModelingStatus = status;
}
+#endif
bool8
cAudioManager::CheckForAnAudioFileOnCD()
@@ -628,9 +634,11 @@ cAudioManager::InterrogateAudioEntities()
void
cAudioManager::AddSampleToRequestedQueue()
{
- int32 calculatedVolume;
+ uint32 calculatedVolume;
uint8 sampleIndex;
+#ifdef AUDIO_REFLECTIONS
bool8 bReflections;
+#endif
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume);
@@ -644,11 +652,12 @@ cAudioManager::AddSampleToRequestedQueue()
}
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
m_sQueueSample.m_bLoopEnded = FALSE;
+#ifdef AUDIO_REFLECTIONS
if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) {
m_sQueueSample.m_bRequireReflection = FALSE;
m_sQueueSample.m_nLoopsRemaining = 0;
}
- if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) {
+ if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount > 0) {
bReflections = m_sQueueSample.m_bRequireReflection;
} else {
bReflections = FALSE;
@@ -657,16 +666,19 @@ cAudioManager::AddSampleToRequestedQueue()
m_sQueueSample.m_bRequireReflection = FALSE;
if ( m_bReverb && m_sQueueSample.m_bIs2D )
- m_sQueueSample.field_4C = 30;
+ m_sQueueSample.m_nFrontRearOffset = 30;
if (!m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bReverbFlag = FALSE;
+#endif
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
AddDetailsToRequestedOrderList(sampleIndex);
+#ifdef AUDIO_REFLECTIONS
if (bReflections)
AddReflectionsToRequestedQueue();
+#endif
}
}
@@ -674,7 +686,7 @@ void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
uint32 i = 0;
- if (sample != 0) {
+ if (sample > 0) {
for (; i < sample; i++) {
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
@@ -687,6 +699,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
}
+#ifdef AUDIO_REFLECTIONS
void
cAudioManager::AddReflectionsToRequestedQueue()
{
@@ -710,7 +723,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
}
m_sQueueSample.m_SoundIntensity /= 2.f;
- int halfOldFreq = oldFreq >> 1;
+ uint32 halfOldFreq = oldFreq >> 1;
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
if ( CTimer::GetIsSlowMotionActive() )
@@ -726,15 +739,15 @@ cAudioManager::AddReflectionsToRequestedQueue()
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
- if (m_sQueueSample.m_nLoopCount) {
+ if (m_sQueueSample.m_nLoopCount > 0) {
if ( CTimer::GetIsSlowMotionActive() ) {
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
} else {
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- if (noise <= 0)
- m_sQueueSample.m_nFrequency += noise;
- else
+ if (noise > 0)
m_sQueueSample.m_nFrequency -= noise;
+ else
+ m_sQueueSample.m_nFrequency += noise;
}
}
m_sQueueSample.m_nReleasingVolumeModificator += 20;
@@ -869,6 +882,7 @@ cAudioManager::UpdateReflections()
}
#endif
}
+#endif // AUDIO_REFLECTIONS
void
cAudioManager::AddReleasingSounds()
@@ -895,8 +909,11 @@ cAudioManager::AddReleasingSounds()
break;
}
}
- if (!toProcess[i]) {
- if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) {
+ if(!toProcess[i]) {
+#ifdef AUDIO_REFLECTIONS
+ if(sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) // check if not reflection
+#endif
+ {
if (sample.m_nReleasingVolumeDivider == 0)
continue;
if (sample.m_nLoopCount == 0) {
@@ -1064,14 +1081,17 @@ cAudioManager::ProcessActiveQueues()
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
- if (sample.m_nCounter > 255 && sample.m_nLoopCount != 0 && sample.m_nLoopsRemaining != 0) {
+#ifdef AUDIO_REFLECTIONS
+ if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nLoopsRemaining > 0) { // check if reflection
sample.m_nLoopsRemaining--;
sample.m_nReleasingVolumeDivider = 1;
- } else {
+ } else
+#endif
+ {
for (uint8 j = 0; j < m_nActiveSamples; j++) {
uint8 k = (j + field_6) % m_nActiveSamples;
if (!m_asActiveSamples[k].m_bIsProcessed) {
- if (sample.m_nLoopCount != 0) {
+ if (sample.m_nLoopCount > 0) {
samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
if (samplesPerFrame == 0)
@@ -1191,8 +1211,10 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nVolumeChange = -1;
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
m_asActiveSamples[i].m_bReverbFlag = FALSE;
+#ifdef AUDIO_REFLECTIONS
m_asActiveSamples[i].m_nLoopsRemaining = 0;
m_asActiveSamples[i].m_bRequireReflection = FALSE;
+#endif
}
}
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 94443ce2..34b2ce61 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -10,17 +10,17 @@ class tSound
{
public:
int32 m_nEntityIndex;
- int32 m_nCounter;
- int32 m_nSampleIndex;
+ uint32 m_nCounter;
+ uint32 m_nSampleIndex;
uint8 m_nBankIndex;
bool8 m_bIs2D;
- int32 m_nReleasingVolumeModificator;
+ uint32 m_nReleasingVolumeModificator;
uint32 m_nFrequency;
uint8 m_nVolume;
float m_fDistance;
- int32 m_nLoopCount;
+ uint32 m_nLoopCount;
#ifndef GTA_PS2
- int32 m_nLoopStart;
+ uint32 m_nLoopStart;
int32 m_nLoopEnd;
#endif
#ifdef EXTERNAL_3D_SOUND
@@ -33,14 +33,16 @@ public:
#ifndef GTA_PS2
bool8 m_bReverbFlag; // TODO: ifdef all the occurrences
#endif
+#ifdef AUDIO_REFLECTIONS
uint8 m_nLoopsRemaining;
bool8 m_bRequireReflection; // Used for oneshots
+#endif
uint8 m_nOffset;
- uint8 field_4C;
- int32 m_nReleasingVolumeDivider;
+ uint8 m_nFrontRearOffset;
+ uint32 m_nReleasingVolumeDivider;
bool8 m_bIsProcessed;
bool8 m_bLoopEnded;
- int32 m_nCalculatedVolume;
+ uint32 m_nCalculatedVolume;
int8 m_nVolumeChange;
};
@@ -120,7 +122,7 @@ class cMissionAudio
public:
CVector m_vecPos[MISSION_AUDIO_SLOTS];
bool8 m_bPredefinedProperties[MISSION_AUDIO_SLOTS];
- int32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
+ uint32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
bool8 m_bIsPlaying[MISSION_AUDIO_SLOTS];
@@ -170,7 +172,7 @@ public:
float m_fDistance;
CVehicle *m_pVehicle;
cTransmission *m_pTransmission;
- int32 m_nIndex;
+ uint32 m_nIndex;
float m_fVelocityChange;
cVehicleParams()
@@ -225,10 +227,10 @@ class cAudioManager
{
public:
bool8 m_bIsInitialised;
- uint8 m_bReverb; // unused
+ bool8 m_bReverb; // unused
bool8 m_bFifthFrameFlag;
uint8 m_nActiveSamples;
- uint8 m_bDoubleVolume; // unused
+ bool8 m_bDoubleVolume; // unused
bool8 m_bDynamicAcousticModelingStatus;
int8 field_6;
float m_fSpeedOfSound;
@@ -243,8 +245,10 @@ public:
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
int32 m_nAudioEntitiesTotal;
+#ifdef AUDIO_REFLECTIONS
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
float m_afReflectionsDistances[MAX_REFLECTIONS];
+#endif
cAudioScriptObjectManager m_sAudioScriptObjectManager;
// miami
@@ -272,8 +276,8 @@ public:
uint8 field_5538; // something related to phone dialogues
int32 m_anRandomTable[5];
uint8 m_nTimeSpent;
- uint8 m_nUserPause;
- uint8 m_nPreviousUserPause;
+ bool8 m_nUserPause;
+ bool8 m_nPreviousUserPause;
uint32 m_FrameCounter;
cAudioManager();
@@ -307,7 +311,9 @@ public:
bool8 IsMP3RadioChannelAvailable();
void ReleaseDigitalHandle();
void ReacquireDigitalHandle();
+#ifdef AUDIO_REFLECTIONS
void SetDynamicAcousticModelingStatus(bool8 status);
+#endif
bool8 CheckForAnAudioFileOnCD();
char GetCDAudioDriveLetter();
bool8 IsAudioInitialised();
@@ -323,8 +329,10 @@ public:
void InterrogateAudioEntities(); // inlined
void AddSampleToRequestedQueue();
void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc
+#ifdef AUDIO_REFLECTIONS
void AddReflectionsToRequestedQueue();
void UpdateReflections();
+#endif
void AddReleasingSounds();
void ProcessActiveQueues();
void ClearRequestedQueue(); // inlined in vc
@@ -603,6 +611,11 @@ public:
#else
#define SET_EMITTING_VOLUME(vol)
#endif
+#ifdef AUDIO_REFLECTIONS
+#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bRequireReflection = b
+#else
+#define SET_SOUND_REFLECTION(b)
+#endif
#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 3843007d..68e879e6 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -169,7 +169,9 @@ cDMAudio::ReacquireDigitalHandle(void)
void
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
{
+#ifdef AUDIO_REFLECTIONS
AudioManager.SetDynamicAcousticModelingStatus(status);
+#endif
}
bool8
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index a099f10d..59cec9b3 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -263,7 +263,7 @@ cMusicManager::GetRadioInCar(void)
CVehicle* veh = AudioManager.FindVehicleOfPlayer();
if (veh != nil) {
if (UsesPoliceRadio(veh) || UsesTaxiRadio(veh)) {
- if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
+ if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return STREAMED_SOUND_RADIO_POLICE;
return m_nRadioInCar;
}
@@ -271,7 +271,7 @@ cMusicManager::GetRadioInCar(void)
}
}
- if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
+ if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
return RADIO_OFF;
return m_nRadioInCar;
}
@@ -461,7 +461,7 @@ cMusicManager::ServiceFrontEndMode()
} else {
if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER)
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
- else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && AudioManager.m_nUserPause == 0)
+ else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && !AudioManager.m_nUserPause)
ChangeMusicMode(MUSICMODE_GAME);
}
} else {
diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp
index b19886f5..30b19086 100644
--- a/src/audio/PolRadio.cpp
+++ b/src/audio/PolRadio.cpp
@@ -24,8 +24,8 @@ struct tPoliceRadioZone {
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
-int8 g_nMissionAudioPlayingStatus = 2;
-uint8 gSpecialSuspectLastSeenReport;
+int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
+bool8 gSpecialSuspectLastSeenReport;
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
void
@@ -83,8 +83,8 @@ void
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
{
if (!m_bIsInitialised) return;
- if (g_nMissionAudioPlayingStatus != 1) {
- g_nMissionAudioPlayingStatus = 0;
+ if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
+ g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
g_nMissionAudioSfx = sfx;
}
}
@@ -113,7 +113,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bReverbFlag = FALSE;
m_sQueueSample.m_nOffset = 63;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bRequireReflection = FALSE;
+ SET_SOUND_REFLECTION(FALSE);
AddSampleToRequestedQueue();
}
@@ -125,7 +125,7 @@ cAudioManager::ServicePoliceRadio()
if(!m_bIsInitialised) return;
- if(m_nUserPause == 0) {
+ if(!m_nUserPause) {
bool8 crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
@@ -162,20 +162,20 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
static int cWait = 0;
static bool8 bChannelOpen = FALSE;
- static uint8 bMissionAudioPhysicalPlayingStatus = 0;
+ static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
static int32 PoliceChannelFreq = 22050;
if (!m_bIsInitialised) return;
- if (m_nUserPause != 0) {
+ if (m_nUserPause) {
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
- if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 &&
+ if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
SampleManager.IsStreamPlaying(1)) {
SampleManager.PauseStream(TRUE, 1);
}
} else {
if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE &&
- bMissionAudioPhysicalPlayingStatus == 1) {
+ bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
SampleManager.PauseStream(FALSE, 1);
}
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE;
@@ -188,17 +188,17 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
return;
}
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
- if (g_nMissionAudioPlayingStatus) {
- if (g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus &&
+ if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
+ if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
SampleManager.IsStreamPlaying(1)) {
- bMissionAudioPhysicalPlayingStatus = 1;
+ bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
}
- if (bMissionAudioPhysicalPlayingStatus == 1) {
+ if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
if (SampleManager.IsStreamPlaying(1)) {
DoPoliceRadioCrackle();
} else {
- bMissionAudioPhysicalPlayingStatus = 2;
- g_nMissionAudioPlayingStatus = 2;
+ bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
+ g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
g_nMissionAudioSfx = NO_SAMPLE;
cWait = 30;
}
@@ -208,13 +208,13 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
SampleManager.StartPreloadedStreamedFile(1);
- g_nMissionAudioPlayingStatus = 1;
- bMissionAudioPhysicalPlayingStatus = 0;
+ g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
+ bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
return;
}
}
if (bChannelOpen) DoPoliceRadioCrackle();
- if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) &&
+ if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
if (m_sPoliceRadioQueue.policeChannelTimer) {
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
@@ -225,7 +225,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
}
if (wantedLevel == 0) {
if (gSpecialSuspectLastSeenReport) {
- gSpecialSuspectLastSeenReport = 0;
+ gSpecialSuspectLastSeenReport = FALSE;
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
bChannelOpen = FALSE;
processed = TRUE;
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 7636ceb3..737616b7 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1706,6 +1706,7 @@ cSampleManager::UpdateReverb(void)
float fRatio = 0.0f;
+#ifdef AUDIO_REFLECTIONS
#define MIN_DIST 0.5f
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
@@ -1719,6 +1720,7 @@ cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
+#endif
fRatio = Clamp(fRatio, 0.0f, 0.6f);
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 8a9379ea..3d693870 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -1390,6 +1390,7 @@ bool8 cSampleManager::UpdateReverb(void)
float fRatio = 0.0f;
+#ifdef AUDIO_REFLECTIONS
#define MIN_DIST 0.5f
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
@@ -1403,6 +1404,7 @@ bool8 cSampleManager::UpdateReverb(void)
#undef CALCULATE_RATIO
#undef MIN_DIST
+#endif
fRatio = Clamp(fRatio, 0.0f, 0.6f);
diff --git a/src/core/config.h b/src/core/config.h
index e6af6ccd..72bd6052 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -227,6 +227,7 @@ enum Config {
#define DONT_FIX_REPLAY_BUGS
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
//#define USE_TEXTURE_POOL // not possible because R* used custom RW33
+#define AUDIO_REFLECTIONS
#else
// This enables things from the PS2 version on PC
#define GTA_PS2_STUFF
@@ -438,6 +439,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Audio
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
// originally and making it work in 2d only requires more resource). Will not work on PS2
+#define AUDIO_REFLECTIONS // Enable audio reflections. This is enabled in all vanilla versions
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally)