From 0910188058e7c2f9c4182b69f9482bfbf8848d43 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 19:59:28 +0300 Subject: [PATCH] Add macros to set sample loop offsets --- src/audio/AudioCollision.cpp | 8 +- src/audio/AudioLogic.cpp | 269 ++++++++++++----------------------- src/audio/AudioManager.cpp | 2 + src/audio/AudioManager.h | 14 ++ src/audio/PolRadio.cpp | 3 +- 5 files changed, 110 insertions(+), 186 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index be1ee48b..decb73e5 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -172,10 +172,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -315,8 +312,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_nReleasingVolumeModificator = 11; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index fd3a3703..128f7615 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -898,8 +898,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -951,8 +950,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_nFrequency = (6000.0f * modificator) + 7000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1015,8 +1013,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_RC_REV); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_RC_REV); + SET_LOOP_OFFSETS(SFX_RC_REV) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1080,8 +1077,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1143,8 +1139,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 70; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_RC_HELI); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_RC_HELI); + SET_LOOP_OFFSETS(SFX_CAR_RC_HELI) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1210,8 +1205,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1270,8 +1264,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq + freq * multiplier; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1495,8 +1488,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_nFrequency /= 2; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1559,8 +1551,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl m_sQueueSample.m_nLoopCount = 1; } m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1586,8 +1577,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1607,8 +1597,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2124,8 +2113,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 8; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2231,8 +2219,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) #else m_sQueueSample.m_nEmittingVolume = 80; #endif - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2313,8 +2300,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 7.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2360,8 +2346,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) #else m_sQueueSample.m_nEmittingVolume = 60; #endif - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2406,8 +2391,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 1.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -2452,8 +2436,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -2509,8 +2492,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2558,8 +2540,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3151,8 +3132,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; } - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bReverbFlag = TRUE; if (isHeli) { @@ -3227,8 +3207,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3373,8 +3352,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = Vol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3398,8 +3376,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3446,8 +3423,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = vol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3550,8 +3526,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3602,8 +3577,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3628,8 +3602,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3645,8 +3618,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3690,8 +3662,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3724,8 +3695,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3760,8 +3730,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = propellerSpeed * 100.0f; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_SEAPLANE_PRO4); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_SEAPLANE_PRO4); + SET_LOOP_OFFSETS(SFX_SEAPLANE_PRO4) m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3792,8 +3761,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volumeModifier * 25.0f; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 27.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3861,8 +3829,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) m_sQueueSample.m_nFrequency = (5500.0f * modifier) + 8000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_TYRE_BURST_L); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_TYRE_BURST_L); + SET_LOOP_OFFSETS(SFX_TYRE_BURST_L) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4029,8 +3996,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4061,8 +4027,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4092,8 +4057,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4122,8 +4086,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4153,8 +4116,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4308,8 +4270,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4336,8 +4297,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4434,9 +4394,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4490,8 +4449,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 20 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4516,8 +4474,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(50); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_IDLE); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_IDLE); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_IDLE) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4540,8 +4497,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4566,8 +4522,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4591,8 +4546,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[0] % 20 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4612,8 +4566,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[1] % 10 + 90; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4633,8 +4586,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4655,8 +4607,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4676,8 +4627,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4696,9 +4646,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4717,9 +4666,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4736,9 +4684,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4756,9 +4703,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4775,9 +4721,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4795,9 +4740,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4819,8 +4763,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[4] % 10 + 110; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4839,8 +4782,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = 90; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4860,8 +4802,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; @@ -4919,8 +4860,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = 75; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4983,8 +4923,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[4] % 10 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -5003,8 +4942,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 70; m_sQueueSample.m_nEmittingVolume = 70; m_sQueueSample.m_bIs2D = FALSE; @@ -5022,9 +4960,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[0] % 20 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5043,9 +4980,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 40.0f; maxDist = SQR(40); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 30 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5081,8 +5017,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[2] % 20 + 70; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5107,8 +5042,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 20.0f; maxDist = SQR(20); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = (m_anRandomTable[2] % 20 + 70) * param1 / 127; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -5127,8 +5061,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = 127; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_LEFT); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_LEFT); + SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_LEFT) m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -5145,8 +5078,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = 127.0f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_RIGHT); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_RIGHT); + SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_RIGHT) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -5162,8 +5094,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 150.0f; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; @@ -5206,8 +5137,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 15.0f; maxDist = SQR(15); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -7925,8 +7855,10 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; AudioManager.m_sQueueSample.m_nLoopCount = 1; +#ifndef GTA_PS2 AudioManager.m_sQueueSample.m_nLoopStart = 0; AudioManager.m_sQueueSample.m_nLoopEnd = -1; +#endif AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; AudioManager.m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -8049,8 +7981,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } @@ -8116,8 +8047,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8140,8 +8070,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8176,8 +8105,7 @@ cAudioManager::ProcessWaterCannon(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = 50; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8255,8 +8183,7 @@ cAudioManager::ProcessEscalators() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_BOAT_V12_LOOP); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_BOAT_V12_LOOP); + SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -8538,8 +8465,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } @@ -8756,8 +8682,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -8800,8 +8725,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8820,8 +8744,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nReleasingVolumeDivider = 30; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -8845,8 +8768,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); CObject::fDistToNearestTree = 999999.9f; @@ -9039,8 +8961,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS if (stereo) { m_sQueueSample.m_nOffset = 0; m_sQueueSample.m_fDistance = 1.0f; @@ -9105,8 +9026,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nFrequency = 6000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9179,8 +9099,7 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -9260,8 +9179,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; @@ -9298,8 +9216,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; @@ -9337,8 +9254,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -9397,8 +9313,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 450.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9424,8 +9339,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nFrequency = 5500; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9459,8 +9373,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index e56d28e1..e2596964 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -1039,8 +1039,10 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_bIsProcessed = FALSE; m_asActiveSamples[i].m_bLoopEnded = FALSE; m_asActiveSamples[i].m_nLoopCount = 1; +#ifndef GTA_PS2 m_asActiveSamples[i].m_nLoopStart = 0; m_asActiveSamples[i].m_nLoopEnd = -1; +#endif m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; m_asActiveSamples[i].m_fSoundIntensity = 200.0f; m_asActiveSamples[i].m_nOffset = 63; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 040b6d4b..a75dca96 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -550,5 +550,19 @@ public: //#ifdef AUDIO_MSS //static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); //#endif + What were they thinking? +*/ +#ifndef GTA_PS2 +#define RESET_LOOP_OFFSETS \ + m_sQueueSample.m_nLoopStart = 0; \ + m_sQueueSample.m_nLoopEnd = -1; +#define SET_LOOP_OFFSETS(sample) \ + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \ + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample); +#else +#define RESET_LOOP_OFFSETS +#define SET_LOOP_OFFSETS(sample) +#endif + extern cAudioManager AudioManager; diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 64693926..b22409a5 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -108,8 +108,7 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE); + SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nOffset = 63;