summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/audio/AudioCollision.cpp4
-rw-r--r--src/audio/AudioLogic.cpp214
-rw-r--r--src/audio/AudioManager.cpp208
-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/audio/sampman_null.cpp4
-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.h10
13 files changed, 383 insertions, 190 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 8880110a..e2cd4e75 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -921,7 +921,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;
@@ -972,7 +972,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;
@@ -997,7 +997,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;
@@ -1013,7 +1013,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;
@@ -1057,7 +1057,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;
@@ -1090,7 +1090,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;
@@ -1125,7 +1125,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;
@@ -1156,7 +1156,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;
@@ -1202,7 +1202,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;
@@ -1254,7 +1254,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;
@@ -1311,7 +1311,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;
@@ -1374,7 +1374,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;
@@ -1438,7 +1438,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;
@@ -1507,7 +1507,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;
@@ -1572,7 +1572,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;
@@ -1631,7 +1631,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;
@@ -1855,7 +1855,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_TRUCK || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_TRUCK)
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;
@@ -1918,7 +1918,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;
@@ -1944,7 +1944,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;
@@ -1964,7 +1964,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;
@@ -2287,6 +2287,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][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);
@@ -2294,10 +2297,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);
@@ -2313,9 +2321,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;
@@ -2333,9 +2346,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;
@@ -2481,7 +2499,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;
@@ -2584,9 +2602,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;
@@ -2668,7 +2686,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;
@@ -2711,9 +2729,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;
@@ -2759,7 +2777,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;
@@ -2804,7 +2822,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;
@@ -2860,7 +2878,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;
@@ -2908,7 +2926,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;
@@ -3502,7 +3520,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) {
@@ -3575,7 +3593,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN);
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;
@@ -3597,7 +3615,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;
@@ -3719,7 +3737,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;
@@ -3743,7 +3761,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;
@@ -3790,7 +3808,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;
@@ -3957,7 +3975,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;
@@ -3988,7 +4006,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;
@@ -4018,7 +4036,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;
@@ -4047,7 +4065,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;
@@ -4077,7 +4095,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;
@@ -4233,7 +4251,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;
@@ -4260,7 +4278,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;
@@ -4359,7 +4377,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;
@@ -4414,7 +4432,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;
@@ -4438,7 +4456,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;
@@ -4461,7 +4479,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;
@@ -4486,7 +4504,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;
@@ -4511,7 +4529,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;
@@ -4531,7 +4549,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;
@@ -4551,7 +4569,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;
@@ -4572,7 +4590,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;
@@ -4592,7 +4610,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;
@@ -4611,7 +4629,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;
@@ -4631,7 +4649,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;
@@ -4649,7 +4667,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;
@@ -4668,7 +4686,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;
@@ -4686,7 +4704,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;
@@ -4705,7 +4723,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;
@@ -4728,7 +4746,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;
@@ -4746,7 +4764,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;
@@ -4767,7 +4785,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;
@@ -4824,7 +4842,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;
@@ -4888,7 +4906,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;
@@ -4907,7 +4925,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;
@@ -4925,7 +4943,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;
@@ -4945,7 +4963,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;
@@ -4981,7 +4999,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;
@@ -5007,7 +5025,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;
@@ -5025,7 +5043,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;
@@ -5042,7 +5060,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;
@@ -5059,7 +5077,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;
@@ -5101,7 +5119,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;
@@ -8116,7 +8134,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;
@@ -8237,7 +8257,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();
@@ -8303,7 +8323,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;
@@ -8326,7 +8346,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;
@@ -8361,7 +8381,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;
@@ -8643,7 +8663,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();
@@ -8860,7 +8880,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();
@@ -8903,7 +8923,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;
@@ -8922,7 +8942,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();
@@ -8946,7 +8966,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();
@@ -9139,7 +9159,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;
@@ -9204,7 +9224,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;
@@ -9277,7 +9297,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;
@@ -9316,7 +9336,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;
@@ -9354,7 +9374,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;
@@ -9434,7 +9454,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;
@@ -9465,7 +9485,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;
@@ -9506,7 +9526,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;
@@ -9568,7 +9588,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;
@@ -9594,7 +9614,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;
@@ -9628,7 +9648,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 3397fc29..d1a4f439 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();
@@ -340,14 +345,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
@@ -358,13 +368,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;
}
@@ -372,8 +385,10 @@ cAudioManager::GetCurrent3DProviderIndex()
int8
cAudioManager::AutoDetect3DProviders()
{
+#ifdef EXTERNAL_3D_SOUND
if (m_bIsInitialised)
return SampleManager.AutoDetect3DProviders();
+#endif
return -1;
}
@@ -381,6 +396,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)
@@ -399,12 +417,15 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
--m_nActiveSamples;
}
return current;
+#endif
}
void
cAudioManager::SetSpeakerConfig(int32 conf)
{
+#ifdef EXTERNAL_3D_SOUND
SampleManager.SetSpeakerConfig(conf);
+#endif
}
bool8
@@ -447,7 +468,8 @@ cAudioManager::CheckForAnAudioFileOnCD()
char
cAudioManager::GetCDAudioDriveLetter()
{
- if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
+ if (m_bIsInitialised)
+ return SampleManager.GetCDAudioDriveLetter();
return '\0';
}
@@ -500,7 +522,7 @@ cAudioManager::ServiceSoundEffects()
ServiceCollisions();
AddReleasingSounds();
ProcessMissionAudio();
-#ifdef GTA_PC
+#ifdef EXTERNAL_3D_SOUND
AdjustSamplesVolume();
#endif
ProcessActiveQueues();
@@ -531,7 +553,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
@@ -540,26 +562,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);
}
@@ -708,7 +732,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) {
@@ -873,40 +897,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]];
+ 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;
@@ -915,7 +941,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;
@@ -923,36 +949,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;
@@ -965,12 +994,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
@@ -990,10 +1029,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 {
@@ -1001,24 +1039,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;
@@ -1031,24 +1073,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;
@@ -1084,7 +1138,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;
@@ -1122,7 +1178,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 d58cc3fc..59a8abe8 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
@@ -587,6 +589,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 d30b4826..b1e4ce4c 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 cc73e5c2..cd686d57 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 3
+#else
+#define MAXCHANNELS 0
+#define MAXCHANNELS_SURROUND 0
+#define MAX2DCHANNELS NUM_CHANNELS
+#endif
#define MAX_STREAMS 1
@@ -160,7 +166,8 @@ public:
cSampleManager(void);
~cSampleManager(void);
-
+
+#ifdef EXTERNAL_3D_SOUND
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
@@ -174,7 +181,8 @@ public:
int8 SetCurrent3DProvider(uint8 which);
int8 AutoDetect3DProviders();
-
+#endif
+
bool8 IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
@@ -214,9 +222,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 06aac379..1943539f 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];
@@ -398,6 +401,7 @@ SetUpDebugBanksInfo()
gBankStartOffset[66] = SFX_FOOTSTEP_SAND_1;
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetSpeakerConfig(int32 which)
{
@@ -533,6 +537,7 @@ cSampleManager::AutoDetect3DProviders()
return ds3ds;
return -1;
}
+#endif
static bool8
_ResolveLink(char const *path, char *out)
@@ -947,9 +952,11 @@ cSampleManager::ReleaseDigitalHandle(void)
{
if ( DIG )
{
+#ifdef EXTERNAL_3D_SOUND
prevprovider = curprovider;
release_existing();
curprovider = -1;
+#endif
AIL_digital_handle_release(DIG);
}
}
@@ -960,8 +967,10 @@ cSampleManager::ReacquireDigitalHandle(void)
if ( DIG )
{
AIL_digital_handle_reacquire(DIG);
+#ifdef EXTERNAL_3D_SOUND
if ( prevprovider != -1 )
set_new_provider(prevprovider);
+#endif
}
}
@@ -990,7 +999,8 @@ cSampleManager::Initialise(void)
m_nMonoMode = 0;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
// miles
TRACE("MILES");
{
@@ -1011,7 +1021,8 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAXCHANNELS; i++ )
opened_samples[i] = NULL;
}
-
+#endif
+
// banks
TRACE("banks");
{
@@ -1132,8 +1143,10 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
-
+
+#ifdef EXTERNAL_3D_SOUND
add_providers();
+#endif
m_szCDRomRootPath[0] = '\0';
@@ -1330,7 +1343,8 @@ cSampleManager::Initialise(void)
TRACE("providerset");
{
_bSampmanInitialised = TRUE;
-
+
+#ifdef EXTERNAL_3D_SOUND
U32 n = 0;
while ( n < m_nNumberOfProviders )
@@ -1348,6 +1362,7 @@ cSampleManager::Initialise(void)
Terminate();
return FALSE;
}
+#endif
}
// mp3
@@ -1438,8 +1453,10 @@ cSampleManager::Terminate(void)
opened_2dsamples[i] = NULL;
}
}
-
+
+#ifdef EXTERNAL_3D_SOUND
release_existing();
+#endif
_DeleteMP3Entries();
@@ -1514,6 +1531,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) )
@@ -1526,6 +1544,7 @@ cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuff
}
}
else
+#endif
{
if ( opened_2dsamples[i - MAXCHANNELS] )
{
@@ -1729,6 +1748,7 @@ cSampleManager::GetSampleLength(uint32 nSample)
bool8
cSampleManager::UpdateReverb(void)
{
+#ifdef EXTERNAL_3D_SOUND
if ( !usingEAX )
return FALSE;
@@ -1777,11 +1797,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 )
@@ -1808,11 +1831,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 )
@@ -1825,6 +1850,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
break;
}
}
+#endif
int32 addr;
@@ -1844,9 +1870,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);
@@ -1854,6 +1882,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
else
return FALSE;
+#ifdef EXTERNAL_3D_SOUND
}
else
{
@@ -1874,8 +1903,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
return TRUE;
}
+#endif
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
@@ -1910,19 +1941,22 @@ 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:
case CHANNEL_MISSION_AUDIO_1:
case CHANNEL_MISSION_AUDIO_2:
{
+#endif
nChannelVolume[nChannel] = vol;
// increase the volume for JB.MP3 and S4_BDBD.MP3
@@ -1937,36 +1971,43 @@ 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:
case CHANNEL_MISSION_AUDIO_1:
case CHANNEL_MISSION_AUDIO_2:
{
-#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 )
@@ -1982,19 +2023,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 )
@@ -2010,19 +2055,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 )
@@ -2038,19 +2087,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 )
@@ -2066,10 +2119,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
{
@@ -2078,12 +2133,14 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
else
return FALSE;
}
+#endif
}
void
cSampleManager::StartChannel(uint32 nChannel)
{
+#ifdef EXTERNAL_3D_SOUND
bool8 b2d = FALSE;
switch ( nChannel )
@@ -2099,19 +2156,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 )
@@ -2127,8 +2188,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
{
@@ -2138,6 +2201,7 @@ cSampleManager::StopChannel(uint32 nChannel)
AIL_end_3D_sample(opened_samples[nChannel]);
}
}
+#endif
}
void
diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp
index af4c54ad..627d122b 100644
--- a/src/audio/sampman_null.cpp
+++ b/src/audio/sampman_null.cpp
@@ -19,6 +19,7 @@ cSampleManager::~cSampleManager(void)
}
+#ifdef EXTERNAL_3D_SOUND
void cSampleManager::SetSpeakerConfig(int32 nConfig)
{
@@ -59,6 +60,7 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
return 0;
}
+#endif
bool8
cSampleManager::IsMP3RadioChannelAvailable(void)
@@ -228,6 +230,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
return FALSE;
}
+#ifdef EXTERNAL_3D_SOUND
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
@@ -248,6 +251,7 @@ cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
ASSERT( nChannel < MAXCHANNELS );
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
+#endif
void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
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 5e7135c4..a1ae4625 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -334,6 +334,7 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.Initialise();
#ifndef GTA_PS2
+#ifdef EXTERNAL_3D_SOUND
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = NO_AUDIO_PROVIDER;
@@ -345,6 +346,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 4e30902e..7e1e65d5 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -181,6 +181,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
@@ -439,6 +440,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 41 (PSP and mobile have 21 originally)
@@ -481,3 +484,10 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#endif
#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