diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioManager.cpp | 25 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 46 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 6 | ||||
-rw-r--r-- | src/audio/PoliceRadio.cpp | 3 |
4 files changed, 42 insertions, 38 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 2940be85..e40b6cf0 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -53,6 +53,21 @@ uint8 &gJumboVolOffsetPercentage = *(uint8 *)0x6508ED; bool &bPlayerJustEnteredCar = *(bool *)0x6508C4; bool &g_bMissionAudioLoadFailed = *(bool *)0x95CD8E; +const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); +const int policeChannel = channels + 1; +const int allChannels = channels + 2; +const int maxVolume = 127; + +const int scriptObjectIntensityS = 30; +const int scriptObjectIntensityL = 80; +const int bridgeIntensity = 400; +const int rocketLauncherIntensity = 90; +const int molotovIntensity = 30; +const int molotovVolume = 50; + +const int rainOnVehicleIntensity = 22; +const int reverseGearIntensity = 30; + constexpr bool hornPatternsArray[8][44] = { {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, true, @@ -165,8 +180,8 @@ cPedComments::Add(tPedComment *com) { uint8 index; - if(nrOfCommentsInBank[activeBank] >= pedCommentsSlots) { - index = indexMap[activeBank][pedCommentsSlots - 1]; + if(nrOfCommentsInBank[activeBank] >= NUM_PED_COMMENTS_SLOTS) { + index = indexMap[activeBank][NUM_PED_COMMENTS_SLOTS - 1]; if(m_asPedComments[activeBank][index].m_bVolume > com->m_bVolume) return; } else { index = nrOfCommentsInBank[activeBank]++; @@ -187,7 +202,7 @@ cPedComments::Add(tPedComment *com) } } - if(i < index) memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], pedCommentsSlots -1 - i); + if(i < index) memmove(&indexMap[activeBank][i + 1], &indexMap[activeBank][i], NUM_PED_COMMENTS_SLOTS -1 - i); } indexMap[activeBank][i] = index; @@ -221,7 +236,7 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nLoopCount = 1; AudioManager.m_sQueueSample.m_nLoopStart = 0; AudioManager.m_sQueueSample.m_nLoopEnd = -1; - AudioManager.m_sQueueSample.m_bEmittingVolume = AudioManager.maxVolume; + AudioManager.m_sQueueSample.m_bEmittingVolume = maxVolume; AudioManager.m_sQueueSample.field_48 = 3.0f; switch(sampleIndex) { case SFX_POLICE_HELI_1: @@ -268,7 +283,7 @@ cPedComments::Process() } } - for(uint32 i = 0; i < pedCommentsSlots; i++) { indexMap[actualUsedBank][i] = pedCommentsSlots; } + for(uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) { indexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS; } nrOfCommentsInBank[actualUsedBank] = 0; } } diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 81e5c89d..7c0fef4b 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -2,6 +2,7 @@ #include "DMAudio.h" #include "common.h" +#include "core/config.h" #include "AudioCollision.h" #include "PoliceRadio.h" @@ -194,9 +195,9 @@ public: void *m_pEntity; bool m_bIsUsed; uint8 m_bStatus; - int16 m_awAudioEvent[4]; + int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; uint8 gap_18[2]; - float m_afVolume[4]; + float m_afVolume[NUM_AUDIOENTITY_EVENTS]; uint8 m_AudioEvents; uint8 field_25[3]; @@ -224,11 +225,9 @@ static_assert(sizeof(tPedComment) == 28, "tPedComment: error"); class cPedComments { public: - static constexpr int pedCommentsBanks = 2; - static constexpr int pedCommentsSlots = 20; - tPedComment m_asPedComments[pedCommentsBanks][pedCommentsSlots]; - uint8 indexMap[pedCommentsBanks][pedCommentsSlots]; - uint8 nrOfCommentsInBank[pedCommentsBanks]; + tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; + uint8 indexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS]; + uint8 nrOfCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 activeBank; uint8 gap_1163[1]; @@ -306,16 +305,16 @@ public: tSound m_sQueueSample; bool m_bActiveSampleQueue; uint8 gap_109[3]; - tSound m_asSamples[2][27]; - uint8 m_abSampleQueueIndexTable[2][27]; - uint8 m_bSampleRequestQueuesStatus[2]; - tSound m_asActiveSamples[27]; - tAudioEntity m_asAudioEntities[200]; - int32 m_anAudioEntityIndices[200]; + tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS]; + uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS]; + uint8 m_bSampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS]; + tSound m_asActiveSamples[NUM_SOUNDS_SAMPLES_SLOTS]; + tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; + int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; int32 m_nAudioEntitiesTotal; - CVector m_avecReflectionsPos[5]; - float m_afReflectionsDistances[5]; - int32 m_anScriptObjectEntityIndices[40]; + CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS]; + float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS]; + int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES]; int32 m_nScriptObjectEntityTotal; cPedComments m_sPedComments; int32 m_nFireAudioEntity; @@ -608,21 +607,6 @@ public: void AdjustSamplesVolume(); /// ok uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); /// ok -public: - static constexpr int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); - static constexpr int policeChannel = channels + 1; - static constexpr int allChannels = channels + 2; - static constexpr int maxVolume = 127; - - static constexpr int scriptObjectIntensityS = 30; - static constexpr int scriptObjectIntensityL = 80; - static constexpr int bridgeIntensity = 400; - static constexpr int rocketLauncherIntensity = 90; - static constexpr int molotovIntensity = 30; - static constexpr int molotovVolume = 50; - - static constexpr int rainOnVehicleIntensity = 22; - static constexpr int reverseGearIntensity = 30; }; static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 5b94514b..c1da6881 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -21,6 +21,8 @@ uint8 &cDisplay = *(uint8 *)0x650BA1; int32 &gRetuneCounter = *(int32*)0x650B84; bool& bHasStarted = *(bool*)0x650B7C; +constexpr int maxVolume = 127; + cMusicManager::cMusicManager() { m_bIsInitialised = false; @@ -365,7 +367,7 @@ cMusicManager::Service() if (!m_bIsInitialised || m_bDisabled) return; if (m_nMusicMode == MUSICMODE_CUTSCENE) { - SampleManager.SetStreamedVolumeAndPan(AudioManager.maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); return; } @@ -666,7 +668,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); SampleManager.PreloadStreamedFile(track, 0); - SampleManager.SetStreamedVolumeAndPan(AudioManager.maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); m_nCurrentStreamedSound = track; } } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index a1f719ea..60888f71 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -11,6 +11,9 @@ #include "Vehicle.h"
#include "World.h"
+constexpr int maxVolume = 127;
+constexpr int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
+constexpr int policeChannel = channels + 1;
struct tPoliceRadioZone {
char m_aName[8];
|