From 63e5faef1155af66af12e6bff3a087c0200abc14 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Fri, 2 Oct 2020 03:55:26 +0300 Subject: rewieved some audio functions --- src/audio/AudioCollision.h | 2 +- src/audio/AudioManager.cpp | 10 +++------- src/audio/AudioManager.h | 12 ++++++------ src/audio/PoliceRadio.h | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/audio/AudioCollision.h b/src/audio/AudioCollision.h index 0a058916..a00b16d9 100644 --- a/src/audio/AudioCollision.h +++ b/src/audio/AudioCollision.h @@ -35,4 +35,4 @@ public: void AddCollisionToRequestedQueue(); }; -VALIDATE_SIZE(cAudioCollisionManager, 852); +VALIDATE_SIZE(cAudioCollisionManager, 0x354); diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 1da80352..c0827040 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -510,7 +510,7 @@ cAudioManager::ComputePan(float dist, CVector *vec) return Min(107, PanTable[index] + 63); } -int32 +uint32 cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const { uint32 newFreq = oldFreq; @@ -519,11 +519,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, if (dist != 0.0f) { float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier; if (m_fSpeedOfSound > Abs(speedOfSource)) { - if (speedOfSource < 0.0f) { - speedOfSource = Max(speedOfSource, -1.5f); - } else { - speedOfSource = Min(speedOfSource, 1.5f); - } + speedOfSource = clamp2(speedOfSource, 0.0f, 1.5f); newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound); } } @@ -952,7 +948,7 @@ cAudioManager::ClearRequestedQueue() void cAudioManager::ClearActiveSamples() { - for (int32 i = 0; i < m_nActiveSamples; i++) { + for (uint8 i = 0; i < m_nActiveSamples; i++) { m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; m_asActiveSamples[i].m_nCounter = 0; m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 07e5bc81..5aa507d1 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -250,14 +250,14 @@ public: void CalculateDistance(bool &condition, float dist); //done bool CheckForAnAudioFileOnCD() const; - void ClearActiveSamples(); - void ClearMissionAudio(uint8 slot); + void ClearActiveSamples(); //done + void ClearMissionAudio(uint8 slot); //done void ClearRequestedQueue(); - int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, - float speedMultiplier) const; + uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, + float speedMultiplier) const; //done int32 ComputePan(float, CVector *); uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; - int32 CreateEntity(eAudioType type, void *entity); + int32 CreateEntity(eAudioType type, void *entity); //done void DestroyAllGameCreatedEntities(); void DestroyEntity(int32 id); @@ -311,7 +311,7 @@ public: void PreloadMissionAudio(uint8 slot, Const char *name); void PreTerminateGameSpecificShutdown(); //done /// processX - main logic of adding new sounds - void ProcessActiveQueues(); + void ProcessActiveQueues(); //done bool ProcessAirBrakes(cVehicleParams *params); bool ProcessBoatEngine(cVehicleParams *params); bool ProcessBoatMovingOverWater(cVehicleParams *params); diff --git a/src/audio/PoliceRadio.h b/src/audio/PoliceRadio.h index c01f21ce..e9a0fde0 100644 --- a/src/audio/PoliceRadio.h +++ b/src/audio/PoliceRadio.h @@ -43,4 +43,4 @@ public: } }; -VALIDATE_SIZE(cPoliceRadioQueue, 444); +VALIDATE_SIZE(cPoliceRadioQueue, 0x1BC); -- cgit v1.2.3