From 49ee711c7555ad4685829178e6fb6b4199a87d37 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 28 Jul 2021 00:52:46 +0300 Subject: AudioLogic type fixes and reordering (after peds) --- src/audio/AudioLogic.cpp | 162 +++++++++++++++++++++++------------------------ src/audio/AudioManager.h | 8 +-- 2 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 4423b826..a180b8b0 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8118,83 +8118,6 @@ cAudioManager::ProcessWaterCannon(int32) } } -//positon of arcade machines -CVector aVecExtraSoundPosition[] = { CVector(-1042.546f, 88.794f, 11.324f), CVector(-1004.476f, 181.697f, 11.324f) }; - -void -cAudioManager::ProcessExtraSounds() -{ - const float SOUND_INTENSITY = 18.0f; - const uint8 EMITTING_VOLUME = 50; - - float distance; - - for (int i = 0; i < ARRAY_SIZE(aVecExtraSoundPosition); i++) { - m_sQueueSample.m_vecPos = aVecExtraSoundPosition[i]; - distance = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distance < SQR(SOUND_INTENSITY)) { - m_sQueueSample.m_fDistance = Sqrt(distance); - m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_nSampleIndex = SFX_ARCADE; - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); - m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_nReleasingVolumeModificator = 4; - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - SET_LOOP_OFFSETS(SFX_ARCADE) - m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = FALSE; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - AddSampleToRequestedQueue(); - } - } - } -} - -void -cAudioManager::ProcessEscalators() -{ - const float SOUND_INTENSITY = 30.0f; - const uint8 EMITTING_VOLUME = 26; - - float distance; - - for (int i = 0; i < CEscalators::NumEscalators; i++) { - if (!CEscalators::GetEscalator(i).IsActive()) - continue; - m_sQueueSample.m_vecPos = CEscalators::GetEscalator(i).GetPosition(); - distance = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distance < SQR(SOUND_INTENSITY)) { - m_sQueueSample.m_fDistance = Sqrt(distance); - m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP; - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) - m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_bRequireReflection = FALSE; - AddSampleToRequestedQueue(); - } - } - } -} - #pragma region SCRIPT_OBJECTS const int SCRIPT_OBJECT_INTENSITY_S = 30; const int SCRIPT_OBJECT_INTENSITY_L = 80; @@ -9112,6 +9035,83 @@ cAudioManager::ProcessProjectiles() } } +void +cAudioManager::ProcessEscalators() +{ + const float SOUND_INTENSITY = 30.0f; + const uint8 EMITTING_VOLUME = 26; + + float distance; + + for (int i = 0; i < CEscalators::NumEscalators; i++) { + if (!CEscalators::GetEscalator(i).IsActive()) + continue; + m_sQueueSample.m_vecPos = CEscalators::GetEscalator(i).GetPosition(); + distance = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distance < SQR(SOUND_INTENSITY)) { + m_sQueueSample.m_fDistance = Sqrt(distance); + m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 5; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; + SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; + AddSampleToRequestedQueue(); + } + } + } +} + +//positon of arcade machines +CVector aVecExtraSoundPosition[] = { CVector(-1042.546f, 88.794f, 11.324f), CVector(-1004.476f, 181.697f, 11.324f) }; + +void +cAudioManager::ProcessExtraSounds() +{ + const float SOUND_INTENSITY = 18.0f; + const uint8 EMITTING_VOLUME = 50; + + float distance; + + for (int i = 0; i < ARRAY_SIZE(aVecExtraSoundPosition); i++) { + m_sQueueSample.m_vecPos = aVecExtraSoundPosition[i]; + distance = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distance < SQR(SOUND_INTENSITY)) { + m_sQueueSample.m_fDistance = Sqrt(distance); + m_sQueueSample.m_nVolume = ComputeVolume(EMITTING_VOLUME, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_nSampleIndex = SFX_ARCADE; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_nReleasingVolumeModificator = 4; + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; + SET_LOOP_OFFSETS(SFX_ARCADE) + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bRequireReflection = FALSE; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + AddSampleToRequestedQueue(); + } + } + } +} + void cAudioManager::ProcessGarages() { @@ -9784,7 +9784,7 @@ FindMissionAudioSfx(const char *name) } bool8 -cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const +cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission) { return FALSE; } @@ -9809,7 +9809,7 @@ cAudioManager::PreloadMissionAudio(uint8 slot, Const char *name) } uint8 -cAudioManager::GetMissionAudioLoadingStatus(uint8 slot) const +cAudioManager::GetMissionAudioLoadingStatus(uint8 slot) { if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS) return m_sMissionAudio.m_nLoadingStatus[slot]; @@ -9835,7 +9835,7 @@ cAudioManager::PlayLoadedMissionAudio(uint8 slot) } bool8 -cAudioManager::ShouldDuckMissionAudio(uint8 slot) const +cAudioManager::ShouldDuckMissionAudio(uint8 slot) { if (IsMissionAudioSamplePlaying(slot)) return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01; @@ -9843,7 +9843,7 @@ cAudioManager::ShouldDuckMissionAudio(uint8 slot) const } bool8 -cAudioManager::IsMissionAudioSamplePlaying(uint8 slot) const +cAudioManager::IsMissionAudioSamplePlaying(uint8 slot) { if (m_bIsInitialised) { if (slot < MISSION_AUDIO_SLOTS) diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index a3216e07..450a8818 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -255,8 +255,8 @@ public: float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } - bool8 IsMissionAudioSamplePlaying(uint8 slot) const; // { return m_sMissionAudio.m_nPlayStatus == 1; } - bool8 ShouldDuckMissionAudio(uint8 slot) const; + bool8 IsMissionAudioSamplePlaying(uint8 slot); // { return m_sMissionAudio.m_nPlayStatus == 1; } + bool8 ShouldDuckMissionAudio(uint8 slot); // "Should" be in alphabetic order, except "getXTalkSfx" void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc @@ -389,7 +389,7 @@ public: float GetCollisionRatio(float a, float b, float c, float d); // inlined in vc float GetDistanceSquared(const CVector &v); // inlined in vc int32 GetJumboTaxiFreq(); // inlined in vc - uint8 GetMissionAudioLoadingStatus(uint8 slot) const; + uint8 GetMissionAudioLoadingStatus(uint8 slot); int8 GetMissionScriptPoliceAudioPlayingStatus(); uint8 GetNum3DProvidersAvailable(); uint32 GetPedCommentSfx(CPed *ped, int32 sound); @@ -410,7 +410,7 @@ public: void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code - bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; + bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission); void PlayLoadedMissionAudio(uint8 slot); void PlayOneShot(int32 index, uint16 sound, float vol); -- cgit v1.2.3