summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-12 13:57:16 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-12 13:57:16 +0200
commit92c5cf1877484eb209379da252766d1e9e1c8950 (patch)
tree6ce87dead9991c4106ba23dc94284661906665df /src
parentWaypoint text fix (diff)
downloadre3-92c5cf1877484eb209379da252766d1e9e1c8950.tar
re3-92c5cf1877484eb209379da252766d1e9e1c8950.tar.gz
re3-92c5cf1877484eb209379da252766d1e9e1c8950.tar.bz2
re3-92c5cf1877484eb209379da252766d1e9e1c8950.tar.lz
re3-92c5cf1877484eb209379da252766d1e9e1c8950.tar.xz
re3-92c5cf1877484eb209379da252766d1e9e1c8950.tar.zst
re3-92c5cf1877484eb209379da252766d1e9e1c8950.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioCollision.cpp4
-rw-r--r--src/audio/AudioLogic.cpp214
-rw-r--r--src/audio/AudioManager.cpp203
-rw-r--r--src/audio/AudioManager.h11
-rw-r--r--src/audio/PolRadio.cpp2
-rw-r--r--src/audio/sampman.h14
-rw-r--r--src/audio/sampman_miles.cpp84
-rw-r--r--src/core/Frontend.h8
-rw-r--r--src/core/Game.cpp2
-rw-r--r--src/core/MenuScreens.cpp6
-rw-r--r--src/core/MenuScreensCustom.cpp6
-rw-r--r--src/core/config.h12
12 files changed, 377 insertions, 189 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index d94d99ea..0a3c1edd 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -265,7 +265,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 11;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
@@ -294,7 +294,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index c547007c..329358a5 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -911,7 +911,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -962,7 +962,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
@@ -987,7 +987,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
@@ -1003,7 +1003,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
@@ -1047,7 +1047,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 140.0f;
@@ -1080,7 +1080,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
@@ -1115,7 +1115,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = propellerSpeed * 100.0f;
+ SET_EMITTING_VOLUME(propellerSpeed * 100.0f);
SET_LOOP_OFFSETS(SFX_SEAPLANE_PRO4)
m_sQueueSample.m_fSpeedMultiplier = 5.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
@@ -1146,7 +1146,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = volumeModifier * 25.0f;
+ SET_EMITTING_VOLUME(volumeModifier * 25.0f);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 27.0f;
@@ -1192,7 +1192,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 9;
m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1244,7 +1244,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nFrequency = (6000.0f * modificator) + 7000;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = reverseGearIntensity;
@@ -1301,7 +1301,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 70;
+ SET_EMITTING_VOLUME(70);
SET_LOOP_OFFSETS(SFX_CAR_RC_HELI)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1364,7 +1364,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
SET_LOOP_OFFSETS(SFX_RC_REV)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1428,7 +1428,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1497,7 +1497,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params)
m_sQueueSample.m_nSampleIndex = SFX_TYRE_BURST_L;
m_sQueueSample.m_nFrequency = (5500.0f * modifier) + 8000;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(SFX_TYRE_BURST_L)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1562,7 +1562,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params)
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1621,7 +1621,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params)
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
m_sQueueSample.m_nFrequency = freq + freq * multiplier;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1845,7 +1845,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_5 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_5)
m_sQueueSample.m_nFrequency /= 2;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -1908,7 +1908,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp
} else {
m_sQueueSample.m_nLoopCount = 1;
}
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
@@ -1934,7 +1934,7 @@ cAudioManager::ProcessCesna(cVehicleParams &params)
m_sQueueSample.m_nFrequency = 12500;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
- m_sQueueSample.m_nEmittingVolume = 80;
+ SET_EMITTING_VOLUME(80);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 200.0f;
@@ -1954,7 +1954,7 @@ cAudioManager::ProcessCesna(cVehicleParams &params)
m_sQueueSample.m_nFrequency = 25000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_nEmittingVolume = 80;
+ SET_EMITTING_VOLUME(80);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = 90.0f;
@@ -2276,6 +2276,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_REV_1, SFX_BANK_0, 2, TRUE);
} else {
TranslateEntity(&m_sQueueSample.m_vecPos, &pos);
+#ifndef EXTERNAL_3D_SOUND
+ m_sQueueSample.m_nOffset = ComputePan(m_sQueueSample.m_fDistance, &pos);
+#endif
if (bAccelSampleStopped) {
if (CurrentPretendGear != 1 || currentGear != 2)
CurrentPretendGear = Max(1, currentGear - 1);
@@ -2283,10 +2286,15 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
bAccelSampleStopped = FALSE;
}
if (channelUsed) {
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
- freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) ;
+ SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f);
+#else
+ SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance));
+ SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset);
+#endif
+ freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
@@ -2302,9 +2310,14 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
+ SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f);
+#else
+ SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance));
+ SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset);
+#endif
freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050);
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
@@ -2322,9 +2335,14 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
+ SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 50.0f * 0.25f);
+#else
+ SampleManager.SetChannelVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, ComputeVolume(120, 50.0f, m_sQueueSample.m_fDistance));
+ SampleManager.SetChannelPan(CHANNEL_PLAYER_VEHICLE_ENGINE, m_sQueueSample.m_nOffset);
+#endif
freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050);
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
@@ -2470,7 +2488,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 8;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -2573,9 +2591,9 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nHornFrequency;
m_sQueueSample.m_nLoopCount = 0;
#ifdef FIX_BUGS
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
#else
- m_sQueueSample.m_nEmittingVolume = 80;
+ SET_EMITTING_VOLUME(80);
#endif
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 5.0f;
@@ -2657,7 +2675,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 7.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -2700,9 +2718,9 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params)
m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING);
m_sQueueSample.m_nLoopCount = 0;
#ifdef FIX_BUGS
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
#else
- m_sQueueSample.m_nEmittingVolume = 60;
+ SET_EMITTING_VOLUME(60);
#endif
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
@@ -2748,7 +2766,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 10;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 1.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -2793,7 +2811,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 10;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = volume;
+ SET_EMITTING_VOLUME(volume);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -2849,7 +2867,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -2897,7 +2915,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
+ SET_EMITTING_VOLUME(EMITTING_VOLUME);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -3491,7 +3509,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
}
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bReverbFlag = TRUE;
if (isHeli) {
if (0.2f * m_sQueueSample.m_fSoundIntensity > m_sQueueSample.m_fDistance) {
@@ -3564,7 +3582,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR);
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -3586,7 +3604,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -3708,7 +3726,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = Vol;
+ SET_EMITTING_VOLUME(Vol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
@@ -3732,7 +3750,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 80;
+ SET_EMITTING_VOLUME(80);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
@@ -3779,7 +3797,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = vol;
+ SET_EMITTING_VOLUME(vol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
@@ -3946,7 +3964,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -3977,7 +3995,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -4007,7 +4025,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -4036,7 +4054,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY);
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -4066,7 +4084,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE);
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -4205,7 +4223,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4232,7 +4250,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_fSoundIntensity = 30.0f;
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4327,7 +4345,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 26 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4382,7 +4400,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[2] % 20 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4406,7 +4424,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 0;
emittingVol = 100;
SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_IDLE)
- m_sQueueSample.m_nEmittingVolume = 100;
+ SET_EMITTING_VOLUME(100);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
@@ -4429,7 +4447,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 0;
emittingVol = 100;
SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK)
- m_sQueueSample.m_nEmittingVolume = 100;
+ SET_EMITTING_VOLUME(100);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
@@ -4454,7 +4472,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 0;
emittingVol = 100;
SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK)
- m_sQueueSample.m_nEmittingVolume = 100;
+ SET_EMITTING_VOLUME(100);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
@@ -4479,7 +4497,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[0] % 20 + 80;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4499,7 +4517,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[1] % 10 + 90;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4519,7 +4537,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = 127;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4540,7 +4558,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[2] % 10 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4560,7 +4578,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[2] % 10 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4579,7 +4597,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 70;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4599,7 +4617,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 70;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4617,7 +4635,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 70;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4636,7 +4654,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 70;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4654,7 +4672,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 90;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4673,7 +4691,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[3] % 15 + 90;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4696,7 +4714,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[4] % 10 + 110;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4714,7 +4732,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(60);
m_sQueueSample.m_nLoopCount = 0;
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_nEmittingVolume = 90;
+ SET_EMITTING_VOLUME(90);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 6;
@@ -4735,7 +4753,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = 127;
- m_sQueueSample.m_nEmittingVolume = 127;
+ SET_EMITTING_VOLUME(127);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
stereo = TRUE;
@@ -4792,7 +4810,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(30);
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
- m_sQueueSample.m_nEmittingVolume = 75;
+ SET_EMITTING_VOLUME(75);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4856,7 +4874,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[4] % 10 + 80;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4875,7 +4893,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = 70;
- m_sQueueSample.m_nEmittingVolume = 70;
+ SET_EMITTING_VOLUME(70);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
break;
@@ -4893,7 +4911,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[0] % 20 + 90;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
break;
@@ -4913,7 +4931,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = m_anRandomTable[2] % 30 + 70;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4949,7 +4967,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(30);
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4975,7 +4993,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = (m_anRandomTable[2] % 20 + 70) * param1 / 127;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -4993,7 +5011,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(150);
m_sQueueSample.m_nLoopCount = 0;
SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_LEFT)
- m_sQueueSample.m_nEmittingVolume = 127;
+ SET_EMITTING_VOLUME(127);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@@ -5010,7 +5028,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(150);
m_sQueueSample.m_nLoopCount = 0;
SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_RIGHT)
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@@ -5027,7 +5045,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 1;
RESET_LOOP_OFFSETS
emittingVol = 127;
- m_sQueueSample.m_nEmittingVolume = 127;
+ SET_EMITTING_VOLUME(127);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
m_sQueueSample.m_bRequireReflection = TRUE;
@@ -5069,7 +5087,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
maxDist = SQR(15);
m_sQueueSample.m_nLoopCount = 0;
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@@ -7884,7 +7902,9 @@ cPedComments::Process()
AudioManager.m_sQueueSample.m_nLoopStart = 0;
AudioManager.m_sQueueSample.m_nLoopEnd = -1;
#endif
+#ifdef EXTERNAL_3D_SOUND
AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+#endif
AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f;
AudioManager.m_sQueueSample.m_fSoundIntensity = 40.0f;
AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE;
@@ -8005,7 +8025,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ SET_EMITTING_VOLUME(MAX_VOLUME);
RESET_LOOP_OFFSETS
m_sQueueSample.m_bReverbFlag = TRUE;
AddSampleToRequestedQueue();
@@ -8071,7 +8091,7 @@ cAudioManager::ProcessFires(int32)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bRequireReflection = FALSE;
@@ -8094,7 +8114,7 @@ cAudioManager::ProcessFires(int32)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bRequireReflection = FALSE;
@@ -8129,7 +8149,7 @@ cAudioManager::ProcessWaterCannon(int32)
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
- m_sQueueSample.m_nEmittingVolume = 50;
+ SET_EMITTING_VOLUME(50);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bRequireReflection = FALSE;
@@ -8411,7 +8431,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
RESET_LOOP_OFFSETS
m_sQueueSample.m_bReverbFlag = TRUE;
AddSampleToRequestedQueue();
@@ -8628,7 +8648,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bRequireReflection = FALSE;
AddSampleToRequestedQueue();
@@ -8671,7 +8691,7 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bIs2D = TRUE;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
RESET_LOOP_OFFSETS
m_sQueueSample.m_bReverbFlag = FALSE;
m_sQueueSample.m_bRequireReflection = FALSE;
@@ -8690,7 +8710,7 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bRequireReflection = FALSE;
AddSampleToRequestedQueue();
@@ -8714,7 +8734,7 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = FALSE;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bRequireReflection = FALSE;
AddSampleToRequestedQueue();
@@ -8907,7 +8927,7 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nBankIndex = SFX_BANK_FRONT_END_MENU;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bIs2D = TRUE;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
RESET_LOOP_OFFSETS
if (stereo) {
m_sQueueSample.m_nOffset = 0;
@@ -8972,7 +8992,7 @@ cAudioManager::ProcessCrane()
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nFrequency = 6000;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 100;
+ SET_EMITTING_VOLUME(100);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
@@ -9045,7 +9065,7 @@ cAudioManager::ProcessProjectiles()
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
+ SET_EMITTING_VOLUME(emittingVol);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = TRUE;
@@ -9084,7 +9104,7 @@ cAudioManager::ProcessEscalators()
m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
+ SET_EMITTING_VOLUME(EMITTING_VOLUME);
SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
@@ -9122,7 +9142,7 @@ cAudioManager::ProcessExtraSounds()
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 4;
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
+ SET_EMITTING_VOLUME(EMITTING_VOLUME);
SET_LOOP_OFFSETS(SFX_ARCADE)
m_sQueueSample.m_bReverbFlag = TRUE;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -9202,7 +9222,7 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nEmittingVolume = 90;
+ SET_EMITTING_VOLUME(90);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
@@ -9233,7 +9253,7 @@ cAudioManager::ProcessGarages()
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nReleasingVolumeModificator = 4;
- m_sQueueSample.m_nEmittingVolume = 60;
+ SET_EMITTING_VOLUME(60);
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
m_sQueueSample.m_bReverbFlag = TRUE;
@@ -9274,7 +9294,7 @@ cAudioManager::ProcessFireHydrant()
m_sQueueSample.m_nReleasingVolumeModificator = 4;
m_sQueueSample.m_nFrequency = 15591;
m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nEmittingVolume = 40;
+ SET_EMITTING_VOLUME(40);
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_nLoopCount = 0;
@@ -9335,7 +9355,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING);
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 100;
+ SET_EMITTING_VOLUME(100);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 450.0f;
@@ -9361,7 +9381,7 @@ cAudioManager::ProcessBridgeMotor()
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = 5500;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ SET_EMITTING_VOLUME(MAX_VOLUME);
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
@@ -9395,7 +9415,7 @@ cAudioManager::ProcessBridgeOneShots()
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ SET_EMITTING_VOLUME(MAX_VOLUME);
RESET_LOOP_OFFSETS
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index ad76b73a..fce86915 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -31,7 +31,7 @@ cAudioManager::cAudioManager()
ClearRequestedQueue();
ClearActiveSamples();
GenerateIntegerRandomNumberTable();
- field_4 = 0;
+ m_bDoubleVolume = FALSE;
m_bDynamicAcousticModelingStatus = TRUE;
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
@@ -58,11 +58,16 @@ cAudioManager::Initialise()
PreInitialiseGameSpecificSetup();
m_bIsInitialised = SampleManager.Initialise();
if (m_bIsInitialised) {
+#ifdef EXTERNAL_3D_SOUND
m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
if (m_nActiveSamples <= 1) {
Terminate();
} else {
--m_nActiveSamples;
+#else
+ {
+ m_nActiveSamples = NUM_CHANNELS_GENERIC;
+#endif
PostInitialiseGameSpecificSetup();
InitialisePoliceRadioZones();
InitialisePoliceRadio();
@@ -338,14 +343,19 @@ cAudioManager::DestroyAllGameCreatedEntities()
uint8
cAudioManager::GetNum3DProvidersAvailable()
{
+#ifdef EXTERNAL_3D_SOUND
if (m_bIsInitialised)
return SampleManager.GetNum3DProvidersAvailable();
+#endif
return 0;
}
char *
cAudioManager::Get3DProviderName(uint8 id)
{
+#ifndef EXTERNAL_3D_SOUND
+ return nil;
+#else
if (!m_bIsInitialised)
return nil;
#ifdef AUDIO_OAL
@@ -356,13 +366,16 @@ cAudioManager::Get3DProviderName(uint8 id)
return nil;
#endif
return SampleManager.Get3DProviderName(id);
+#endif
}
int8
cAudioManager::GetCurrent3DProviderIndex()
{
+#ifdef EXTERNAL_3D_SOUND
if (m_bIsInitialised)
return SampleManager.GetCurrent3DProviderIndex();
+#endif
return -1;
}
@@ -370,8 +383,10 @@ cAudioManager::GetCurrent3DProviderIndex()
int8
cAudioManager::AutoDetect3DProviders()
{
+#ifdef EXTERNAL_3D_SOUND
if (m_bIsInitialised)
return SampleManager.AutoDetect3DProviders();
+#endif
return -1;
}
@@ -379,6 +394,9 @@ cAudioManager::AutoDetect3DProviders()
int8
cAudioManager::SetCurrent3DProvider(uint8 which)
{
+#ifndef EXTERNAL_3D_SOUND
+ return -1;
+#else
if (!m_bIsInitialised)
return -1;
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
@@ -397,12 +415,15 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
--m_nActiveSamples;
}
return current;
+#endif
}
void
cAudioManager::SetSpeakerConfig(int32 conf)
{
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetSpeakerConfig(conf);
+#endif
}
bool8
@@ -490,7 +511,7 @@ cAudioManager::ServiceSoundEffects()
ServiceCollisions();
AddReleasingSounds();
ProcessMissionAudio();
-#ifdef GTA_PC
+#ifdef EXTERNAL_3D_SOUND
AdjustSamplesVolume();
#endif
ProcessActiveQueues();
@@ -521,7 +542,7 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
newEmittingVolume = emittingVolume * SQR((soundIntensity - newSoundIntensity - (distance - newSoundIntensity))
/ (soundIntensity - newSoundIntensity));
- return Min(127u, newEmittingVolume);
+ return Min(127, newEmittingVolume);
}
void
@@ -530,26 +551,28 @@ cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
*out = MultiplyInverse(TheCamera.GetMatrix(), *in);
}
-static uint8 PanTable[64] = { 0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53,
- 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63};
+Const static uint8 PanTable[64] = { 0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53,
+ 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63};
int32
cAudioManager::ComputeFrontRearMix(float dist, CVector *vec)
{
- int32 index = Min(63, Abs(int32(vec->y / (dist / 64.f))));
+ int32 index = vec->y / (dist / 64.f);
+ index = Min(63, ABS(index));
if (vec->y > 0.f)
- return Max(0, 63 - PanTable[index]);
+ return Max(0, 63 - (int8)PanTable[index]);
return Min(127, PanTable[index] + 63);
}
int32
cAudioManager::ComputePan(float dist, CVector *vec)
{
- int32 index = Min(63, Abs(int32(vec->x / (dist / 64.f))));
+ int32 index = vec->x / (dist / 64.f);
+ index = Min(63, ABS(index));
if (vec->x > 0.f)
- return Max(20, 63 - PanTable[index]);
+ return Max(20, 63 - (int8)PanTable[index]);
return Min(107, PanTable[index] + 63);
}
@@ -698,7 +721,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
m_sQueueSample.m_nLoopsRemaining = CTimer::GetIsSlowMotionActive() ? (reflectionDistance * 800.f / 1029.f) : (reflectionDistance * 500.f / 1029.f);
if (m_sQueueSample.m_nLoopsRemaining > 3) {
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ SET_EMITTING_VOLUME(emittingVolume);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
@@ -863,40 +886,42 @@ cAudioManager::AddReleasingSounds()
void
cAudioManager::ProcessActiveQueues()
{
- CVector position;
- uint32 freqDivided;
- uint32 loopCount;
- uint8 emittingVol;
- uint8 vol;
- uint8 offset;
- float x;
bool8 flag;
+ float position2;
+ float position1;
+
+ uint32 samplesPerFrame;
+ uint32 samplesToPlay;
+
+#ifdef EXTERNAL_3D_SOUND
+ float x;
+ float usedX;
+ float usedY;
+ float usedZ;
+#endif
+
+ uint8 vol;
+ uint8 emittingVol;
+ CVector position;
+
bool8 missionState;
for (int32 i = 0; i < m_nActiveSamples; i++) {
m_asSamples[m_nActiveSampleQueue][i].m_bIsProcessed = FALSE;
m_asActiveSamples[i].m_bIsProcessed = FALSE;
}
+
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (sample.m_nSampleIndex != NO_SAMPLE) {
for (int32 j = 0; j < m_nActiveSamples; j++) {
- if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
- sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
+ if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount) {
-
- if (m_FrameCounter & 1) {
- if (!(j & 1)) {
- flag = FALSE;
- } else {
- flag = TRUE;
- }
- } else if (j & 1) {
- flag = FALSE;
- } else {
- flag = TRUE;
- }
+ if (m_FrameCounter & 1)
+ flag = !!(j & 1);
+ else
+ flag = !(j & 1);
if (flag && !SampleManager.GetChannelUsedFlag(j)) {
sample.m_bLoopEnded = TRUE;
@@ -905,7 +930,7 @@ cAudioManager::ProcessActiveQueues()
m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE;
continue;
}
- if (!sample.m_nReleasingVolumeDivider)
+ if (sample.m_nReleasingVolumeDivider == 0)
sample.m_nReleasingVolumeDivider = 1;
}
sample.m_bIsProcessed = TRUE;
@@ -913,36 +938,39 @@ cAudioManager::ProcessActiveQueues()
sample.m_nVolumeChange = -1;
if (!sample.m_bReleasingSoundFlag) {
if (sample.m_bIs2D) {
- if (field_4) {
- emittingVol = 2 * Min(63, sample.m_nEmittingVolume);
- } else {
- emittingVol = sample.m_nEmittingVolume;
- }
+#ifdef EXTERNAL_3D_SOUND
+ emittingVol = m_bDoubleVolume ? 2 * Min(63, sample.m_nEmittingVolume) : sample.m_nEmittingVolume;
+#else
+ emittingVol = m_bDoubleVolume ? 2 * Min(63, sample.m_nVolume) : sample.m_nVolume;
+#endif
SampleManager.SetChannelFrequency(j, sample.m_nFrequency);
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(j, emittingVol);
+#else
+ SampleManager.SetChannelPan(j, sample.m_nOffset);
+ SampleManager.SetChannelVolume(j, emittingVol);
+#endif
} else {
+ position2 = sample.m_fDistance;
+ position1 = m_asActiveSamples[j].m_fDistance;
m_asActiveSamples[j].m_fDistance = sample.m_fDistance;
- sample.m_nFrequency = ComputeDopplerEffectedFrequency(
- sample.m_nFrequency,
- m_asActiveSamples[j].m_fDistance,
- sample.m_fDistance,
- sample.m_fSpeedMultiplier);
-
+ sample.m_nFrequency = ComputeDopplerEffectedFrequency(sample.m_nFrequency, position1, position2, sample.m_fSpeedMultiplier);
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
- m_asActiveSamples[j].m_nFrequency = Clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
- SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
+ uint32 freq = Clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
+ m_asActiveSamples[j].m_nFrequency = freq;
+ SampleManager.SetChannelFrequency(j, freq);
}
+#ifdef EXTERNAL_3D_SOUND
if (sample.m_nEmittingVolume != m_asActiveSamples[j].m_nEmittingVolume) {
vol = Clamp2((int8)sample.m_nEmittingVolume, (int8)m_asActiveSamples[j].m_nEmittingVolume, 10);
-
- if (field_4) {
- emittingVol = 2 * Min(63, vol);
- } else {
- emittingVol = vol;
- }
+#else
+ if (sample.m_nVolume != m_asActiveSamples[j].m_nVolume) {
+ vol = Clamp2((int8)sample.m_nVolume, (int8)m_asActiveSamples[j].m_nVolume, 10);
+#endif
+ emittingVol = m_bDoubleVolume ? 2 * Min(63, vol) : vol;
missionState = FALSE;
- for (int32 k = 0; k < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); k++) {
+ for (int32 k = 0; k < MISSION_AUDIO_SLOTS; k++) {
if (m_sMissionAudio.m_bIsMobile[k]) {
missionState = TRUE;
break;
@@ -955,12 +983,22 @@ cAudioManager::ProcessActiveQueues()
emittingVol = (emittingVol * field_5538) / 127;
}
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(j, emittingVol);
m_asActiveSamples[j].m_nEmittingVolume = vol;
+#else
+ SampleManager.SetChannelVolume(j, emittingVol);
+ m_asActiveSamples[j].m_nVolume = vol;
+#endif
}
TranslateEntity(&sample.m_vecPos, &position);
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannel3DPosition(j, position.x, position.y, position.z);
SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity);
+#else
+ sample.m_nOffset = ComputePan(sample.m_fDistance, &position);
+ SampleManager.SetChannelPan(j, sample.m_nOffset);
+#endif
}
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
break; //continue for i
@@ -980,10 +1018,9 @@ 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 && sample.m_nLoopsRemaining) {
+ 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) {
sample.m_nLoopsRemaining--;
sample.m_nReleasingVolumeDivider = 1;
} else {
@@ -991,24 +1028,28 @@ cAudioManager::ProcessActiveQueues()
uint8 k = (j + field_6) % m_nActiveSamples;
if (!m_asActiveSamples[k].m_bIsProcessed) {
if (sample.m_nLoopCount != 0) {
- freqDivided = sample.m_nFrequency / m_nTimeSpent;
- loopCount = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
- if (freqDivided == 0)
+ samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
+ samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
+ if (samplesPerFrame == 0)
continue;
- sample.m_nReleasingVolumeDivider = loopCount / freqDivided + 1;
+ sample.m_nReleasingVolumeDivider = samplesToPlay / samplesPerFrame + 1;
}
memcpy(&m_asActiveSamples[k], &sample, sizeof(tSound));
- if (!m_asActiveSamples[k].m_bIs2D)
+ if (!m_asActiveSamples[k].m_bIs2D) {
TranslateEntity(&m_asActiveSamples[k].m_vecPos, &position);
- if (field_4) {
- emittingVol = 2 * Min(63, m_asActiveSamples[k].m_nEmittingVolume);
- } else {
- emittingVol = m_asActiveSamples[k].m_nEmittingVolume;
+#ifndef EXTERNAL_3D_SOUND
+ m_asActiveSamples[j].m_nOffset = ComputePan(m_asActiveSamples[j].m_fDistance, &position);
+#endif
}
+#ifdef EXTERNAL_3D_SOUND
+ emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nEmittingVolume) : m_asActiveSamples[j].m_nEmittingVolume;
+#else
+ emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume;
+#endif
if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) {
SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency);
bool8 isMobile = FALSE;
- for (int32 l = 0; l < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); l++) {
+ for (int32 l = 0; l < MISSION_AUDIO_SLOTS; l++) {
if (m_sMissionAudio.m_bIsMobile[l]) {
isMobile = TRUE;
break;
@@ -1021,24 +1062,36 @@ cAudioManager::ProcessActiveQueues()
} else {
vol = (emittingVol * field_5538 / 127);
}
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetChannelEmittingVolume(k, vol);
+#else
+ SampleManager.SetChannelVolume(j, emittingVol);
+ SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
+#endif
SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd);
SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount);
SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag);
+#ifdef EXTERNAL_3D_SOUND
if (m_asActiveSamples[k].m_bIs2D) {
- offset = m_asActiveSamples[k].m_nOffset;
- if (offset == 63) {
+ uint8 offset = m_asActiveSamples[k].m_nOffset;
+ if (offset == 63)
x = 0.0f;
- } else if (offset >= 63) {
+ else if (offset >= 63)
x = (offset - 63) * 1000.0f / 63;
- } else {
+ else
x = -(63 - offset) * 1000.0f / 63; //same like line below
- }
- position = CVector(x, 0.0f, 0.0f);
+ usedX = x;
+ usedY = 0.0f;
+ usedZ = 0.0f;
m_asActiveSamples[k].m_fSoundIntensity = 100000.0f;
+ } else {
+ usedX = position.x;
+ usedY = position.y;
+ usedZ = position.z;
}
- SampleManager.SetChannel3DPosition(k, position.x, position.y, position.z);
+ SampleManager.SetChannel3DPosition(k, usedX, usedY, usedZ);
SampleManager.SetChannel3DDistances(k, m_asActiveSamples[k].m_fSoundIntensity, 0.25f * m_asActiveSamples[k].m_fSoundIntensity);
+#endif
SampleManager.StartChannel(k);
}
m_asActiveSamples[k].m_bIsProcessed = TRUE;
@@ -1074,7 +1127,9 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nReleasingVolumeModificator = 5;
m_asActiveSamples[i].m_nFrequency = 0;
m_asActiveSamples[i].m_nVolume = 0;
+#ifdef EXTERNAL_3D_SOUND
m_asActiveSamples[i].m_nEmittingVolume = 0;
+#endif
m_asActiveSamples[i].m_fDistance = 0.0f;
m_asActiveSamples[i].m_bIsProcessed = FALSE;
m_asActiveSamples[i].m_bLoopEnded = FALSE;
@@ -1112,7 +1167,7 @@ cAudioManager::GenerateIntegerRandomNumberTable()
}
}
-#ifdef GTA_PC
+#ifdef EXTERNAL_3D_SOUND
void
cAudioManager::AdjustSamplesVolume()
{
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index df978d5b..526df1f8 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -22,6 +22,8 @@ public:
#ifndef GTA_PS2
int32 m_nLoopStart;
int32 m_nLoopEnd;
+#endif
+#ifdef EXTERNAL_3D_SOUND
uint8 m_nEmittingVolume;
#endif
float m_fSpeedMultiplier;
@@ -202,7 +204,7 @@ public:
uint8 m_bReverb; // unused
bool8 m_bFifthFrameFlag;
uint8 m_nActiveSamples;
- uint8 field_4; // unused
+ uint8 m_bDoubleVolume; // unused
bool8 m_bDynamicAcousticModelingStatus;
int8 field_6;
float m_fSpeedOfSound;
@@ -310,7 +312,7 @@ public:
void GenerateIntegerRandomNumberTable();
void LoadBankIfNecessary(uint8 bank);
-#ifdef GTA_PC
+#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
void AdjustSamplesVolume(); // inlined
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); // inlined
#endif
@@ -576,6 +578,11 @@ public:
#define RESET_LOOP_OFFSETS
#define SET_LOOP_OFFSETS(sample)
#endif
+#ifdef EXTERNAL_3D_SOUND
+#define SET_EMITTING_VOLUME(vol) m_sQueueSample.m_nEmittingVolume = vol
+#else
+#define SET_EMITTING_VOLUME(vol)
+#endif
#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp
index 28c18256..b19886f5 100644
--- a/src/audio/PolRadio.cpp
+++ b/src/audio/PolRadio.cpp
@@ -107,7 +107,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
m_sQueueSample.m_bReverbFlag = FALSE;
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 9b21ddb3..3af2c51f 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -116,9 +116,15 @@ enum
#define MAXPROVIDERS 64
+#ifdef EXTERNAL_3D_SOUND
#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1)
#define MAXCHANNELS_SURROUND (MAXCHANNELS-4)
#define MAX2DCHANNELS 1
+#else
+#define MAXCHANNELS 0
+#define MAXCHANNELS_SURROUND 0
+#define MAX2DCHANNELS NUM_CHANNELS
+#endif
#define MAX_STREAMS 3
@@ -158,7 +164,8 @@ public:
cSampleManager(void);
~cSampleManager(void);
-
+
+#ifdef EXTERNAL_3D_SOUND
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
@@ -172,7 +179,8 @@ public:
int8 SetCurrent3DProvider(uint8 which);
int8 AutoDetect3DProviders();
-
+#endif
+
bool8 IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
@@ -212,9 +220,11 @@ public:
void SetChannelReverbFlag (uint32 nChannel, bool8 nReverbFlag);
bool8 InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
+#ifdef EXTERNAL_3D_SOUND
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
+#endif
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
void SetChannelPan (uint32 nChannel, uint32 nPan);
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 95a094ba..7636ceb3 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -69,7 +69,7 @@ bool8 _bIsMp3Active;
bool8 _bSampmanInitialised = FALSE;
-
+#ifdef EXTERNAL_3D_SOUND
//
// Miscellaneous globals / defines
@@ -89,8 +89,10 @@ S32 usingEAX=0;
S32 usingEAX3=0;
HPROVIDER opened_provider=0;
H3DSAMPLE opened_samples[MAXCHANNELS] = {0};
+#endif
HSAMPLE opened_2dsamples[MAX2DCHANNELS] = {0};
HDIGDRIVER DIG;
+#ifdef EXTERNAL_3D_SOUND
S32 speaker_type=0;
U32 _maxSamples;
@@ -259,6 +261,7 @@ set_new_provider(S32 index)
return FALSE;
}
+#endif
U32 RadioHandlers[9];
@@ -324,6 +327,7 @@ cSampleManager::~cSampleManager(void)
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetSpeakerConfig(int32 which)
{
@@ -459,6 +463,7 @@ cSampleManager::AutoDetect3DProviders()
return ds3ds;
return -1;
}
+#endif
static bool8
_ResolveLink(char const *path, char *out)
@@ -873,9 +878,11 @@ cSampleManager::ReleaseDigitalHandle(void)
{
if ( DIG )
{
+#ifdef EXTERNAL_3D_SOUND
prevprovider = curprovider;
release_existing();
curprovider = -1;
+#endif
AIL_digital_handle_release(DIG);
}
}
@@ -886,8 +893,10 @@ cSampleManager::ReacquireDigitalHandle(void)
if ( DIG )
{
AIL_digital_handle_reacquire(DIG);
+#ifdef EXTERNAL_3D_SOUND
if ( prevprovider != -1 )
set_new_provider(prevprovider);
+#endif
}
}
@@ -916,7 +925,8 @@ cSampleManager::Initialise(void)
m_nMonoMode = 0;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
// miles
TRACE("MILES");
{
@@ -937,7 +947,8 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAXCHANNELS; i++ )
opened_samples[i] = NULL;
}
-
+#endif
+
// banks
TRACE("banks");
{
@@ -1058,8 +1069,10 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
add_providers();
+#endif
m_szCDRomRootPath[0] = '\0';
@@ -1278,7 +1291,8 @@ cSampleManager::Initialise(void)
TRACE("providerset");
{
_bSampmanInitialised = TRUE;
-
+
+#ifdef EXTERNAL_3D_SOUND
U32 n = 0;
while ( n < m_nNumberOfProviders )
@@ -1296,6 +1310,7 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
+#endif
}
// mp3
@@ -1386,8 +1401,10 @@ cSampleManager::Terminate(void)
opened_2dsamples[i] = NULL;
}
}
-
+
+#ifdef EXTERNAL_3D_SOUND
release_existing();
+#endif
_DeleteMP3Entries();
@@ -1463,6 +1480,7 @@ cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuff
{
for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
{
+#ifdef EXTERNAL_3D_SOUND
if ( i < MAXCHANNELS )
{
if ( opened_samples[i] && GetChannelUsedFlag(i) )
@@ -1475,6 +1493,7 @@ cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuff
}
}
else
+#endif
{
if ( opened_2dsamples[i - MAXCHANNELS] )
{
@@ -1678,6 +1697,7 @@ cSampleManager::GetSampleLength(uint32 nSample)
bool8
cSampleManager::UpdateReverb(void)
{
+#ifdef EXTERNAL_3D_SOUND
if ( !usingEAX )
return FALSE;
@@ -1726,11 +1746,14 @@ cSampleManager::UpdateReverb(void)
_fPrevEaxRatioDestination = fRatio;
return TRUE;
+#endif
+ return FALSE;
}
void
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1755,11 +1778,13 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
AIL_set_3D_sample_effects_level(opened_samples[nChannel], 0.0f);
}
}
+#endif
}
bool8
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1770,6 +1795,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
break;
}
}
+#endif
int32 addr;
@@ -1789,9 +1815,11 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
addr = nPedSlotSfxAddr[slot];
}
-
+
+#ifdef EXTERNAL_3D_SOUND
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
{
AIL_set_sample_address(opened_2dsamples[nChannel - MAXCHANNELS], (void *)addr, m_aSamples[nSfx].nSize);
@@ -1799,6 +1827,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
else
return FALSE;
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -1819,8 +1848,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
return TRUE;
}
+#endif
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
@@ -1855,17 +1886,20 @@ cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
if ( opened_samples[nChannel] )
AIL_set_3D_sample_distances(opened_samples[nChannel], fMax, fMin);
}
+#endif
void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{
uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
-
+
+#ifdef EXTERNAL_3D_SOUND
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
{
+#endif
nChannelVolume[nChannel] = vol;
// increase the volume for JB.MP3 and S4_BDBD.MP3
@@ -1880,34 +1914,41 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
AIL_set_sample_volume(opened_2dsamples[nChannel - MAXCHANNELS],
m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
}
-
+
+#ifdef EXTERNAL_3D_SOUND
break;
}
}
+#endif
}
void
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{
+#ifdef EXTERNAL_3D_SOUND
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
{
-#ifndef FIX_BUGS
+#endif
+#if !defined(FIX_BUGS) && defined(EXTERNAL_3D_SOUND)
if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
#else
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
#endif
AIL_set_sample_pan(opened_2dsamples[nChannel - MAXCHANNELS], nPan);
+#ifdef EXTERNAL_3D_SOUND
break;
}
}
+#endif
}
void
cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1921,19 +1962,23 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_playback_rate(opened_2dsamples[nChannel - MAXCHANNELS], nFreq);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_playback_rate(opened_samples[nChannel], nFreq);
}
+#endif
}
void
cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1947,19 +1992,23 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_loop_block(opened_2dsamples[nChannel - MAXCHANNELS], nLoopStart, nLoopEnd);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_loop_block(opened_samples[nChannel], nLoopStart, nLoopEnd);
}
+#endif
}
void
cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1973,19 +2022,23 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_set_sample_loop_count(opened_2dsamples[nChannel - MAXCHANNELS], nLoopCount);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_set_3D_sample_loop_count(opened_samples[nChannel], nLoopCount);
}
+#endif
}
bool8
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -1999,10 +2052,12 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
return AIL_sample_status(opened_2dsamples[nChannel - MAXCHANNELS]) == SMP_PLAYING;
else
return FALSE;
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -2011,12 +2066,14 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
else
return FALSE;
}
+#endif
}
void
cSampleManager::StartChannel(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -2030,19 +2087,23 @@ cSampleManager::StartChannel(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_start_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
if ( opened_samples[nChannel] )
AIL_start_3D_sample(opened_samples[nChannel]);
}
+#endif
}
void
cSampleManager::StopChannel(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -2056,8 +2117,10 @@ cSampleManager::StopChannel(uint32 nChannel)
if ( b2d )
{
+#endif
if ( opened_2dsamples[nChannel - MAXCHANNELS] )
AIL_end_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -2067,6 +2130,7 @@ cSampleManager::StopChannel(uint32 nChannel)
AIL_end_3D_sample(opened_samples[nChannel]);
}
}
+#endif
}
void
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 31d6fa8d..276506b6 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -29,9 +29,17 @@
#define RIGHT_ALIGNED_TEXT_RIGHT_MARGIN(xMargin) (xMargin + 30.0f)
#define MENURADIO_ICON_FIRST_X 238.f
+#ifdef EXTERNAL_3D_SOUND
#define MENURADIO_ICON_Y 288.0f
+#else
+#define MENURADIO_ICON_Y 248.0f
+#endif
#define MENURADIO_ICON_SIZE 60.0f
+#ifdef EXTERNAL_3D_SOUND
#define MENURADIO_SELECTOR_START_Y 285.f // other options should leave room on the screen
+#else
+#define MENURADIO_SELECTOR_START_Y 245.0f
+#endif
#define MENURADIO_SELECTOR_HEIGHT 65.f
#define MENUSLIDER_X 500.0f
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 3a8cdb06..77c8965f 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -333,6 +333,7 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.Initialise();
#ifndef GTA_PS2
+#ifdef EXTERNAL_3D_SOUND
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = NO_AUDIO_PROVIDER;
@@ -344,6 +345,7 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
DMAudio.SetSpeakerConfig(FrontEndMenuManager.m_PrefsSpeakers);
+#endif
DMAudio.SetDynamicAcousticModelingStatus(FrontEndMenuManager.m_PrefsDMA);
DMAudio.SetMusicMasterVolume(FrontEndMenuManager.m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp
index 3ffc4e83..295038d9 100644
--- a/src/core/MenuScreens.cpp
+++ b/src/core/MenuScreens.cpp
@@ -30,11 +30,17 @@ CMenuScreen aScreens[] = {
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 40, 76, MENUALIGN_LEFT,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
MENUACTION_MP3VOLUMEBOOST, "FEA_MPB", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
MENUACTION_SPEAKERCONF, "FEA_SPK", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
+#endif
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_LEFT,
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 320, 367, MENUALIGN_CENTER,
+#else
+ MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 320, 327, MENUALIGN_CENTER,
+#endif
MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 0, 0, MENUALIGN_CENTER,
},
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 431fd794..ae20e2e7 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -411,11 +411,17 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_MUSICVOLUME, "FEA_MUS", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 40, 76, MENUALIGN_LEFT,
MENUACTION_SFXVOLUME, "FEA_SFX", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
MENUACTION_MP3VOLUMEBOOST, "FEA_MPB", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_AUDIOHW, "FEA_3DH", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
MENUACTION_SPEAKERCONF, "FEA_SPK", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
+#endif
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
MENUACTION_RADIO, "FEA_RSS", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_LEFT,
+#ifdef EXTERNAL_3D_SOUND
MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 320, 367, MENUALIGN_CENTER,
+#else
+ MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 320, 327, MENUALIGN_CENTER,
+#endif
MENUACTION_GOBACK, "FEDS_TB", {nil, SAVESLOT_NONE, MENUPAGE_NONE}, 0, 0, MENUALIGN_CENTER,
},
diff --git a/src/core/config.h b/src/core/config.h
index 73b77560..a29acc09 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -176,6 +176,7 @@ enum Config {
# define VU_COLLISION
# define PS2_MENU
#elif defined GTA_PC
+# define EXTERNAL_3D_SOUND
# define PC_PLAYER_CONTROLS // mouse player/cam mode
# define GTA_REPLAY
# define GTA_SCENE_EDIT
@@ -428,6 +429,8 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#define FREE_CAM // Rotating cam
// 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 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)
@@ -469,4 +472,11 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef USE_CUTSCENE_SHADOW_FOR_PED
#endif
-#endif // VANILLA_DEFINES \ No newline at end of file
+#endif // VANILLA_DEFINES
+
+#if defined(AUDIO_OAL) && !defined(EXTERNAL_3D_SOUND)
+#error AUDIO_OAL cannot work without EXTERNAL_3D_SOUND
+#endif
+#if defined(GTA_PS2) && defined(EXTERNAL_3D_SOUND)
+#error EXTERNAL_3D_SOUND cannot work on PS2
+#endif