summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioManager.cpp1497
-rw-r--r--src/audio/AudioManager.h206
-rw-r--r--src/audio/AudioManager.h.autosave549
-rw-r--r--src/audio/DMAudio.cpp12
4 files changed, 1366 insertions, 898 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index e1860698..1e4b9c3b 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -31,12 +31,18 @@
#include "sampman.h"
cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
+uint32 *audioLogicTimers = (uint32 *)0x6508A0;
+uint8 &jumboVolOffset = *(uint8 *)0x6508ED;
+uint8 &gJumboVolOffsetPercentage = *(uint8 *)0x6508ED;
+char &g_nMissionAudioPlayingStatus = *(char *)0x60ED88;
+int32 *BankStartOffset = (int32 *)0x6FAB70; //[2]
+int32 &g_nMissionAudioSfx = *(int32 *)0x60ED84;
+bool &bPlayerJustEnteredCar = *(bool *)0x6508C4;
+bool &g_bMissionAudioLoadFailed = *(bool *)0x95CD8E;
constexpr int totalAudioEntitiesSlots = 200;
constexpr int maxVolume = 127;
-uint32 *audioLogicTimers = (uint32 *)0x6508A0;
-
// TODO: where is this used? Is this the right file?
enum eVehicleModel {
LANDSTAL,
@@ -251,8 +257,6 @@ cAudioScriptObject::operator delete(void *p, int handle)
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
}
-char &g_nMissionAudioPlayingStatus = *(char *)0x60ED88;
-
void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
@@ -311,8 +315,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
{
float reflectionDistance;
int32 noise;
- uint8 emittingVolume = emittingVolume =
- (m_sQueueSample.m_bVolume >> 1) + (m_sQueueSample.m_bVolume >> 3);
+ uint8 emittingVolume = (m_sQueueSample.m_bVolume >> 1) + (m_sQueueSample.m_bVolume >> 3);
for(uint32 i = 0; i < 5u; i++) {
reflectionDistance = m_afReflectionsDistances[i];
@@ -452,9 +455,9 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
float speedOfSource = (dist / field_19195) * speedMultiplier;
if(speedOfSound > Abs(speedOfSource)) {
if(speedOfSource < 0.0f) {
- speedOfSource = Max(speedOfSource, -1.5f);
+ speedOfSource = max(speedOfSource, -1.5f);
} else {
- speedOfSource = Min(speedOfSource, 1.5f);
+ speedOfSource = min(speedOfSource, 1.5f);
}
newFreq = (oldFreq * speedOfSound) / (speedOfSource + speedOfSound);
}
@@ -485,7 +488,7 @@ cAudioManager::ComputeVolume(int emittingVolume, float soundIntensity, float dis
}
int32
-cAudioManager::CreateEntity(int32 type, void *entity)
+cAudioManager::CreateEntity(int32 type, CPhysical *entity)
{
if(!m_bIsInitialised) return -4;
if(!entity) return -2;
@@ -495,7 +498,7 @@ cAudioManager::CreateEntity(int32 type, void *entity)
m_asAudioEntities[i].m_bIsUsed = true;
m_asAudioEntities[i].m_bStatus = 0;
m_asAudioEntities[i].m_nType = (eAudioType)type;
- m_asAudioEntities[i].m_pEntity = entity;
+ m_asAudioEntities[i].m_pEntity = (void*)entity;
m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_TOTAL_PED_SOUNDS;
m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_TOTAL_PED_SOUNDS;
m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_TOTAL_PED_SOUNDS;
@@ -558,6 +561,13 @@ cAudioManager::DestroyEntity(int32 id)
}
void
+cAudioManager::DoJumboVolOffset() const
+{
+ if(!(m_FrameCounter % (m_anRandomTable[0] % 6u + 3)))
+ jumboVolOffset = m_anRandomTable[1] % 60u;
+}
+
+void
cAudioManager::DoPoliceRadioCrackle()
{
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
@@ -581,573 +591,6 @@ cAudioManager::DoPoliceRadioCrackle()
AddSampleToRequestedQueue();
}
-void
-cAudioManager::GenerateIntegerRandomNumberTable()
-{
- for(int32 i = 0; i < 5; i++) { m_anRandomTable[i] = rand(); }
-}
-
-void
-cAudioManager::TranslateEntity(CVector *v1, CVector *v2) const
-{
- const RwMatrix &cM = TheCamera.GetMatrix().m_matrix;
- const CVector &cV = TheCamera.GetPosition();
-
- float a = v1->z - cV.z;
- float b = v1->y - cV.y;
- float c = v1->x - cV.x;
-
- v2->x = cM.right.y * b + cM.right.x * c + cM.right.z * a;
- v2->y = cM.up.y * b + cM.up.x * c + cM.up.z * a;
- v2->z = cM.at.y * b + cM.at.x * c + cM.at.z * a;
-}
-
-void
-cAudioManager::ResetAudioLogicTimers(int32 timer)
-{
- audioLogicTimers[0] = timer;
- audioLogicTimers[8] = timer;
- audioLogicTimers[1] = timer;
- audioLogicTimers[7] = timer;
- audioLogicTimers[2] = timer;
- audioLogicTimers[6] = timer;
- audioLogicTimers[3] = timer;
- audioLogicTimers[5] = timer;
- audioLogicTimers[4] = timer;
- for(int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
- if(m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
- CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
- if(ped->IsPed()) {
- ped->m_lastSoundStart = timer;
- ped->m_soundStart = timer + m_anRandomTable[0] % 3000u;
- }
- }
- }
-<<<<<<< HEAD
-}
-
-void
-cAudioManager::PostInitialiseGameSpecificSetup()
-{
- m_nFireAudioEntity =
- CreateEntity(AUDIOTYPE_FIRE,
- (CPhysical *)0x8F31D0); // last is addr of firemanager @todo change
- if(m_nFireAudioEntity >= 0) SetEntityStatus(m_nFireAudioEntity, 1);
-
- m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (CPhysical *)1);
- if(m_nCollisionEntity >= 0) SetEntityStatus(m_nCollisionEntity, 1);
-
- m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (CPhysical *)1);
- if(m_nFrontEndEntity >= 0) SetEntityStatus(m_nFrontEndEntity, 1);
-
- m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (CPhysical *)1);
- if(m_nProjectileEntity >= 0) SetEntityStatus(m_nProjectileEntity, 1);
-
- m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (CPhysical *)1);
- if(m_nWaterCannonEntity >= 0) SetEntityStatus(m_nWaterCannonEntity, 1);
-
- m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (CPhysical *)1);
- if(m_nPoliceChannelEntity >= 0) SetEntityStatus(m_nPoliceChannelEntity, 1);
-
- m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (CPhysical *)1);
- if(m_nBridgeEntity >= 0) SetEntityStatus(m_nBridgeEntity, 1);
-
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- m_sMissionAudio.m_bLoadingStatus = 0;
- m_sMissionAudio.m_bPlayStatus = 0;
- m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.m_bIsPlayed = 0;
- m_sMissionAudio.field_12 = 1;
- m_sMissionAudio.field_24 = 0;
- ResetAudioLogicTimers((int32)CTimer::GetTimeInMilliseconds);
-}
-
-WRAPPER
-void
-cAudioManager::InitialisePoliceRadioZones()
-{
- EAXJMP(0x57EAC0);
-}
-
-WRAPPER
-void
-cAudioManager::ResetAudioLogicTimers(int32 timer)
-{
- EAXJMP(0x569650);
-=======
- ClearMissionAudio();
- SampleManager.StopChannel(28);
->>>>>>> More more more audio
-}
-
-void
-cAudioManager::Terminate()
-{
- if(m_bIsInitialised) {
- MusicManager.Terminate();
-
- for(uint32 i = 0; i < totalAudioEntitiesSlots; i++) {
- m_asAudioEntities[i].m_bIsUsed = 0;
- m_anAudioEntityIndices[i] = 200;
- }
-
- m_nAudioEntitiesTotal = 0;
- m_nScriptObjectEntityTotal = 0;
- PreTerminateGameSpecificShutdown();
-
- for(uint32 i = 0; i < 2; i++) {
- if(SampleManager.IsSampleBankLoaded(i)) SampleManager.UnloadSampleBank(i);
- }
-
- SampleManager.Terminate();
-
- m_bIsInitialised = 0;
- PostTerminateGameSpecificShutdown();
- }
-}
-
-uint8
-cAudioManager::GetNum3DProvidersAvailable() const
-{
- if(m_bIsInitialised) return SampleManager.GetNum3DProvidersAvailable();
- return 0;
-}
-
-bool
-cAudioManager::IsMP3RadioChannelAvailable() const
-{
- if(m_bIsInitialised) return SampleManager.IsMP3RadioChannelAvailable();
-
- return 0;
-}
-
-uint8
-cAudioManager::GetCDAudioDriveLetter() const
-{
- if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
-
- return 0;
-}
-
-void
-cAudioManager::SetEffectsMasterVolume(uint8 volume) const
-{
- SampleManager.SetEffectsMasterVolume(volume);
-}
-
-void
-cAudioManager::SetMusicMasterVolume(uint8 volume) const
-{
- SampleManager.SetMusicMasterVolume(volume);
-}
-
-void
-cAudioManager::SetEffectsFadeVolume(uint8 volume) const
-{
- SampleManager.SetEffectsFadeVolume(volume);
-}
-
-void
-cAudioManager::SetMusicFadeVolume(uint8 volume) const
-{
- SampleManager.SetMusicFadeVolume(volume);
-}
-
-void
-cAudioManager::SetSpeakerConfig(int32 conf) const
-{
- SampleManager.SetSpeakerConfig(conf);
-}
-
-WRAPPER
-bool cAudioManager::SetupJumboEngineSound(uint8, int32) { EAXJMP(0x56F140); }
-
-int32 *BankStartOffset = (int32 *)0x6FAB70; //[2]
-
-void
-cAudioManager::PreInitialiseGameSpecificSetup() const
-{
- BankStartOffset[0] = AUDIO_SAMPLE_VEHICLE_HORN_0;
- BankStartOffset[1] = AUDIO_SAMPLE_POLICE_COP_1_ARREST_1;
-}
-
-int32 &g_nMissionAudioSfx = *(int32 *)0x60ED84;
-
-void
-cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
-{
- if(m_bIsInitialised) {
- if(g_nMissionAudioPlayingStatus != 1) {
- g_nMissionAudioPlayingStatus = 0;
- g_nMissionAudioSfx = sfx;
- }
- }
-}
-
-bool
-cAudioManager::UsesSiren(int32 model) const
-{
- switch(model) {
- case FIRETRUK:
- case AMBULAN:
- case FBICAR:
- case POLICE:
- case ENFORCER:
- case PREDATOR: return true;
- default: return false;
- }
-}
-
-bool
-cAudioManager::UsesSirenSwitching(int32 model) const
-{
- switch(model) {
- case AMBULAN:
- case POLICE:
- case ENFORCER:
- case PREDATOR: return true;
- default: return false;
- }
-}
-
-char *
-cAudioManager::Get3DProviderName(uint8 id) const
-{
- if(!m_bIsInitialised) return 0;
- if(id >= SampleManager.GetNum3DProvidersAvailable()) return 0;
- return SampleManager.Get3DProviderName(id);
-}
-
-bool
-cAudioManager::SetupJumboFlySound(uint8 emittingVol)
-{
- int32 vol;
-
- if(m_sQueueSample.m_fDistance >= 440.0f) return 0;
-
- vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance);
- m_sQueueSample.m_bVolume = vol;
- if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_FLY_SOUND;
- m_sQueueSample.m_counter = 0;
- m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_bIsDistant = 0;
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND);
- m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSoundIntensity = 440.0f;
- m_sQueueSample.field_56 = 0;
- m_sQueueSample.field_48 = 4.0f;
- m_sQueueSample.m_bReverbFlag = 1;
- m_sQueueSample.field_76 = 5;
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- AddSampleToRequestedQueue();
- }
- return 1;
-}
-
-bool
-cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
-{
- if(m_sQueueSample.m_fDistance >= 240.f) return 0;
-
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 240.f, m_sQueueSample.m_fDistance);
-
- if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 5;
- m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND;
- m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_bIsDistant = 1;
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.field_48 = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 240.0f;
- m_sQueueSample.field_56 = 0;
- m_sQueueSample.field_76 = 12;
- m_sQueueSample.m_bOffset = 0;
- m_sQueueSample.m_bReverbFlag = 1;
- m_sQueueSample.m_bRequireReflection = 0;
- AddSampleToRequestedQueue();
- m_sQueueSample.m_counter = 6;
- m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND;
- m_sQueueSample.m_nFrequency += 200;
- m_sQueueSample.m_bOffset = maxVolume;
- AddSampleToRequestedQueue();
- }
- return 1;
-}
-
-uint8 &gJumboVolOffsetPercentage = *(uint8 *)0x6508ED;
-
-bool
-cAudioManager::SetupJumboTaxiSound(uint8 vol)
-{
- uint8 emittingVol;
-
- if(m_sQueueSample.m_fDistance >= 180.f) return 0;
-
- emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance * 0.0055556f);
-
- if(m_sQueueSample.m_fDistance * 0.0055556f < 0.7f)
- emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
-
- if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
- m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_TAXI_SOUND;
- m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_bIsDistant = 0;
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.field_48 = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 180.0f;
- m_sQueueSample.field_56 = 0;
- m_sQueueSample.field_76 = 4;
- m_sQueueSample.m_bReverbFlag = 1;
- m_sQueueSample.m_bRequireReflection = 0;
- AddSampleToRequestedQueue();
- }
- return 1;
-}
-
-bool
-cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
-{
- if(m_sQueueSample.m_fDistance >= 170.f) return 0;
-
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
-
- if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
- m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_WHINE_SOUND;
- m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_bIsDistant = 0;
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.m_nFrequency = freq;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.field_48 = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 170.0f;
- m_sQueueSample.field_56 = 0;
- m_sQueueSample.field_76 = 4;
- m_sQueueSample.m_bReverbFlag = 1;
- m_sQueueSample.m_bRequireReflection = 0;
- AddSampleToRequestedQueue();
- }
- return 1;
-}
-
-void
-cAudioManager::SetMissionAudioLocation(float x, float y, float z)
-{
- if(m_bIsInitialised) {
- m_sMissionAudio.field_12 = 0;
- m_sMissionAudio.m_vecPos.x = x;
- m_sMissionAudio.m_vecPos.y = y;
- m_sMissionAudio.m_vecPos.z = z;
- }
-}
-
-void
-cAudioManager::ResetPoliceRadio()
-{
- if(m_bIsInitialised) {
- if(SampleManager.GetChannelUsedFlag(28)) SampleManager.StopChannel(28);
- InitialisePoliceRadio();
- }
-}
-
-bool
-cAudioManager::UsesReverseWarning(int32 model) const
-{
- return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS ||
- model == COACH;
-}
-
-int32
-cAudioManager::RandomDisplacement(uint32 seed) const
-{
- int32 value;
-
- static bool bIsEven = true;
- static uint32 base = 0;
-
- if(!seed) return 0;
-
- value = m_anRandomTable[(base + seed) % 5] % seed;
- base += value;
-
- if(value % 2) { bIsEven = !bIsEven; }
- if(!bIsEven) value = -value;
- return value;
-}
-
-void
-cAudioManager::ReleaseDigitalHandle() const
-{
- if(m_bIsInitialised) { SampleManager.ReleaseDigitalHandle(); }
-}
-
-void
-cAudioManager::ReacquireDigitalHandle() const
-{
- if(m_bIsInitialised) { SampleManager.ReacquireDigitalHandle(); }
-}
-
-void
-cAudioManager::SetDynamicAcousticModelingStatus(bool status)
-{
- m_bDynamicAcousticModelingStatus = status;
-}
-
-bool
-cAudioManager::IsAudioInitialised() const
-{
- return m_bIsInitialised;
-}
-
-void
-cAudioManager::SetEntityStatus(int32 id, bool status)
-{
- if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) {
- if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; }
- }
-}
-
-void
-cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const
-{
- *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset;
-
- // check if the same sfx like last time, if yes, then try use next one,
- // if exceeded range, then choose first available sample
- if(*phrase == *prevPhrase && ++*phrase >= sample + maxOffset) *phrase = sample;
- *prevPhrase = *phrase;
-}
-
-uint8 &jumboVolOffset = *(uint8 *)0x6508ED;
-
-void
-cAudioManager::DoJumboVolOffset() const
-{
- if(!(m_FrameCounter % (m_anRandomTable[0] % 6u + 3)))
- jumboVolOffset = m_anRandomTable[1] % 60u;
-}
-
-int32
-cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
-{
- if(ped->IsPlayer()) return GetPlayerTalkSfx(sound);
-
- switch(ped->m_modelIndex) {
- case MI_COP: return GetCopTalkSfx(sound);
- case MI_SWAT: return GetSwatTalkSfx(sound);
- case MI_FBI: return GetFBITalkSfx(sound);
- case MI_ARMY: return GetArmyTalkSfx(sound);
- case MI_MEDIC: return GetMedicTalkSfx(sound);
- case MI_FIREMAN: return GetFiremanTalkSfx(sound);
- case MI_MALE01: return GetNormalMaleTalkSfx(sound);
- case MI_TAXI_D: return GetTaxiDriverTalkSfx(sound);
- case MI_PIMP: return GetPimpTalkSfx(sound);
- case MI_GANG01:
- case MI_GANG02: return GetMafiaTalkSfx(sound);
- case MI_GANG03:
- case MI_GANG04: return GetTriadTalkSfx(sound);
- case MI_GANG05:
- case MI_GANG06: return GetDiabloTalkSfx(sound);
- case MI_GANG07:
- case MI_GANG08: return GetYakuzaTalkSfx(sound);
- case MI_GANG09:
- case MI_GANG10: return GetYardieTalkSfx(sound);
- case MI_GANG11:
- case MI_GANG12: return GetColumbianTalkSfx(sound);
- case MI_GANG13:
- case MI_GANG14: return GetHoodTalkSfx(sound);
- case MI_CRIMINAL01: return GetBlackCriminalTalkSfx(sound);
- case MI_CRIMINAL02: return GetWhiteCriminalTalkSfx(sound);
- case MI_SPECIAL01:
- case MI_SPECIAL02:
- case MI_SPECIAL03:
- case MI_SPECIAL04: return GetSpecialCharacterTalkSfx(ped->m_modelIndex, sound);
- case MI_MALE02: return GetMaleNo2TalkSfx(sound);
- case MI_MALE03:
- case MI_P_MAN1:
- case MI_P_MAN2: return GetBlackProjectMaleTalkSfx(sound, ped->m_modelIndex);
- case MI_FATMALE01: return GetWhiteFatMaleTalkSfx(sound);
- case MI_FATMALE02: return GetBlackFatMaleTalkSfx(sound);
- case MI_FEMALE01: return GetBlackCasualFemaleTalkSfx(sound);
- case MI_FEMALE02:
- case MI_CAS_WOM: return GetWhiteCasualFemaleTalkSfx(sound);
- case MI_FEMALE03: return GetFemaleNo3TalkSfx(sound);
- case MI_FATFEMALE01: return GetBlackFatFemaleTalkSfx(sound);
- case MI_FATFEMALE02: return GetWhiteFatFemaleTalkSfx(sound);
- case MI_PROSTITUTE: return GetBlackFemaleProstituteTalkSfx(sound);
- case MI_PROSTITUTE2: return GetWhiteFemaleProstituteTalkSfx(sound);
- case MI_P_WOM1: return GetBlackProjectFemaleOldTalkSfx(sound);
- case MI_P_WOM2: return GetBlackProjectFemaleYoungTalkSfx(sound);
- case MI_CT_MAN1: return GetChinatownMaleOldTalkSfx(sound);
- case MI_CT_MAN2: return GetChinatownMaleYoungTalkSfx(sound);
- case MI_CT_WOM1: return GetChinatownFemaleOldTalkSfx(sound);
- case MI_CT_WOM2: return GetChinatownFemaleYoungTalkSfx(sound);
- case MI_LI_MAN1:
- case MI_LI_MAN2: return GetLittleItalyMaleTalkSfx(sound);
- case MI_LI_WOM1: return GetLittleItalyFemaleOldTalkSfx(sound);
- case MI_LI_WOM2: return GetLittleItalyFemaleYoungTalkSfx(sound);
- case MI_DOCKER1: return GetWhiteDockerMaleTalkSfx(sound);
- case MI_DOCKER2: return GetBlackDockerMaleTalkSfx(sound);
- case MI_SCUM_MAN: return GetScumMaleTalkSfx(sound);
- case MI_SCUM_WOM: return GetScumFemaleTalkSfx(sound);
- case MI_WORKER1: return GetWhiteWorkerMaleTalkSfx(sound);
- case MI_WORKER2: return GetBlackWorkerMaleTalkSfx(sound);
- case MI_B_MAN1:
- case MI_B_MAN3: return GetBusinessMaleYoungTalkSfx(sound, ped->m_modelIndex);
- case MI_B_MAN2: return GetBusinessMaleOldTalkSfx(sound);
- case MI_B_WOM1:
- case MI_B_WOM2: return GetWhiteBusinessFemaleTalkSfx(sound, ped->m_modelIndex);
- case MI_B_WOM3: return GetBlackBusinessFemaleTalkSfx(sound);
- case MI_MOD_MAN: return GetSupermodelMaleTalkSfx(sound);
- case MI_MOD_WOM: return GetSupermodelFemaleTalkSfx(sound);
- case MI_ST_MAN: return GetStewardMaleTalkSfx(sound);
- case MI_ST_WOM: return GetStewardFemaleTalkSfx(sound);
- case MI_FAN_MAN1:
- case MI_FAN_MAN2: return GetFanMaleTalkSfx(sound, ped->m_modelIndex);
- case MI_FAN_WOM: return GetFanFemaleTalkSfx(sound);
- case MI_HOS_MAN: return GetHospitalMaleTalkSfx(sound);
- case MI_HOS_WOM: return GetHospitalFemaleTalkSfx(sound);
- case MI_CONST1: return GetWhiteConstructionWorkerTalkSfx(sound);
- case MI_CONST2: return GetBlackConstructionWorkerTalkSfx(sound);
- case MI_SHOPPER1:
- case MI_SHOPPER2:
- case MI_SHOPPER3: return GetShopperFemaleTalkSfx(sound, ped->m_modelIndex);
- case MI_STUD_MAN: return GetStudentMaleTalkSfx(sound);
- case MI_STUD_WOM: return GetStudentFemaleTalkSfx(sound);
- case MI_CAS_MAN: return GetCasualMaleOldTalkSfx(sound);
- default: return GetGenericMaleTalkSfx(sound);
- }
-}
-
uint32
cAudioManager::GetPlayerTalkSfx(int16 sound)
{
@@ -3256,6 +2699,28 @@ cAudioManager::GetGenericFemaleTalkSfx(int16 sound)
return sfx;
}
+void
+cAudioManager::GenerateIntegerRandomNumberTable()
+{
+ for(int32 i = 0; i < 5; i++) { m_anRandomTable[i] = rand(); }
+}
+
+char *
+cAudioManager::Get3DProviderName(uint8 id) const
+{
+ if(!m_bIsInitialised) return 0;
+ if(id >= SampleManager.GetNum3DProvidersAvailable()) return 0;
+ return SampleManager.Get3DProviderName(id);
+}
+
+uint8
+cAudioManager::GetCDAudioDriveLetter() const
+{
+ if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
+
+ return 0;
+}
+
int8
cAudioManager::GetCurrent3DProviderIndex() const
{
@@ -3351,6 +2816,117 @@ cAudioManager::GetMissionScriptPoliceAudioPlayingStatus() const
return g_nMissionAudioPlayingStatus;
}
+uint8
+cAudioManager::GetNum3DProvidersAvailable() const
+{
+ if(m_bIsInitialised) return SampleManager.GetNum3DProvidersAvailable();
+ return 0;
+}
+
+
+int32
+cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
+{
+ if(ped->IsPlayer()) return GetPlayerTalkSfx(sound);
+
+ switch(ped->m_modelIndex) {
+ case MI_COP: return GetCopTalkSfx(sound);
+ case MI_SWAT: return GetSwatTalkSfx(sound);
+ case MI_FBI: return GetFBITalkSfx(sound);
+ case MI_ARMY: return GetArmyTalkSfx(sound);
+ case MI_MEDIC: return GetMedicTalkSfx(sound);
+ case MI_FIREMAN: return GetFiremanTalkSfx(sound);
+ case MI_MALE01: return GetNormalMaleTalkSfx(sound);
+ case MI_TAXI_D: return GetTaxiDriverTalkSfx(sound);
+ case MI_PIMP: return GetPimpTalkSfx(sound);
+ case MI_GANG01:
+ case MI_GANG02: return GetMafiaTalkSfx(sound);
+ case MI_GANG03:
+ case MI_GANG04: return GetTriadTalkSfx(sound);
+ case MI_GANG05:
+ case MI_GANG06: return GetDiabloTalkSfx(sound);
+ case MI_GANG07:
+ case MI_GANG08: return GetYakuzaTalkSfx(sound);
+ case MI_GANG09:
+ case MI_GANG10: return GetYardieTalkSfx(sound);
+ case MI_GANG11:
+ case MI_GANG12: return GetColumbianTalkSfx(sound);
+ case MI_GANG13:
+ case MI_GANG14: return GetHoodTalkSfx(sound);
+ case MI_CRIMINAL01: return GetBlackCriminalTalkSfx(sound);
+ case MI_CRIMINAL02: return GetWhiteCriminalTalkSfx(sound);
+ case MI_SPECIAL01:
+ case MI_SPECIAL02:
+ case MI_SPECIAL03:
+ case MI_SPECIAL04: return GetSpecialCharacterTalkSfx(ped->m_modelIndex, sound);
+ case MI_MALE02: return GetMaleNo2TalkSfx(sound);
+ case MI_MALE03:
+ case MI_P_MAN1:
+ case MI_P_MAN2: return GetBlackProjectMaleTalkSfx(sound, ped->m_modelIndex);
+ case MI_FATMALE01: return GetWhiteFatMaleTalkSfx(sound);
+ case MI_FATMALE02: return GetBlackFatMaleTalkSfx(sound);
+ case MI_FEMALE01: return GetBlackCasualFemaleTalkSfx(sound);
+ case MI_FEMALE02:
+ case MI_CAS_WOM: return GetWhiteCasualFemaleTalkSfx(sound);
+ case MI_FEMALE03: return GetFemaleNo3TalkSfx(sound);
+ case MI_FATFEMALE01: return GetBlackFatFemaleTalkSfx(sound);
+ case MI_FATFEMALE02: return GetWhiteFatFemaleTalkSfx(sound);
+ case MI_PROSTITUTE: return GetBlackFemaleProstituteTalkSfx(sound);
+ case MI_PROSTITUTE2: return GetWhiteFemaleProstituteTalkSfx(sound);
+ case MI_P_WOM1: return GetBlackProjectFemaleOldTalkSfx(sound);
+ case MI_P_WOM2: return GetBlackProjectFemaleYoungTalkSfx(sound);
+ case MI_CT_MAN1: return GetChinatownMaleOldTalkSfx(sound);
+ case MI_CT_MAN2: return GetChinatownMaleYoungTalkSfx(sound);
+ case MI_CT_WOM1: return GetChinatownFemaleOldTalkSfx(sound);
+ case MI_CT_WOM2: return GetChinatownFemaleYoungTalkSfx(sound);
+ case MI_LI_MAN1:
+ case MI_LI_MAN2: return GetLittleItalyMaleTalkSfx(sound);
+ case MI_LI_WOM1: return GetLittleItalyFemaleOldTalkSfx(sound);
+ case MI_LI_WOM2: return GetLittleItalyFemaleYoungTalkSfx(sound);
+ case MI_DOCKER1: return GetWhiteDockerMaleTalkSfx(sound);
+ case MI_DOCKER2: return GetBlackDockerMaleTalkSfx(sound);
+ case MI_SCUM_MAN: return GetScumMaleTalkSfx(sound);
+ case MI_SCUM_WOM: return GetScumFemaleTalkSfx(sound);
+ case MI_WORKER1: return GetWhiteWorkerMaleTalkSfx(sound);
+ case MI_WORKER2: return GetBlackWorkerMaleTalkSfx(sound);
+ case MI_B_MAN1:
+ case MI_B_MAN3: return GetBusinessMaleYoungTalkSfx(sound, ped->m_modelIndex);
+ case MI_B_MAN2: return GetBusinessMaleOldTalkSfx(sound);
+ case MI_B_WOM1:
+ case MI_B_WOM2: return GetWhiteBusinessFemaleTalkSfx(sound, ped->m_modelIndex);
+ case MI_B_WOM3: return GetBlackBusinessFemaleTalkSfx(sound);
+ case MI_MOD_MAN: return GetSupermodelMaleTalkSfx(sound);
+ case MI_MOD_WOM: return GetSupermodelFemaleTalkSfx(sound);
+ case MI_ST_MAN: return GetStewardMaleTalkSfx(sound);
+ case MI_ST_WOM: return GetStewardFemaleTalkSfx(sound);
+ case MI_FAN_MAN1:
+ case MI_FAN_MAN2: return GetFanMaleTalkSfx(sound, ped->m_modelIndex);
+ case MI_FAN_WOM: return GetFanFemaleTalkSfx(sound);
+ case MI_HOS_MAN: return GetHospitalMaleTalkSfx(sound);
+ case MI_HOS_WOM: return GetHospitalFemaleTalkSfx(sound);
+ case MI_CONST1: return GetWhiteConstructionWorkerTalkSfx(sound);
+ case MI_CONST2: return GetBlackConstructionWorkerTalkSfx(sound);
+ case MI_SHOPPER1:
+ case MI_SHOPPER2:
+ case MI_SHOPPER3: return GetShopperFemaleTalkSfx(sound, ped->m_modelIndex);
+ case MI_STUD_MAN: return GetStudentMaleTalkSfx(sound);
+ case MI_STUD_WOM: return GetStudentFemaleTalkSfx(sound);
+ case MI_CAS_MAN: return GetCasualMaleOldTalkSfx(sound);
+ default: return GetGenericMaleTalkSfx(sound);
+ }
+}
+
+void
+cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const
+{
+ *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset;
+
+ // check if the same sfx like last time, if yes, then try use next one,
+ // if exceeded range, then choose first available sample
+ if(*phrase == *prevPhrase && ++*phrase >= sample + maxOffset) *phrase = sample;
+ *prevPhrase = *phrase;
+}
+
bool
cAudioManager::HasAirBrakes(int32 model) const
{
@@ -3403,6 +2979,12 @@ cAudioManager::InterrogateAudioEntities()
}
bool
+cAudioManager::IsAudioInitialised() const
+{
+ return m_bIsInitialised;
+}
+
+bool
cAudioManager::IsMissionAudioSampleFinished()
{
if(m_bIsInitialised) return m_sMissionAudio.m_bPlayStatus == 2;
@@ -3413,6 +2995,14 @@ cAudioManager::IsMissionAudioSampleFinished()
}
bool
+cAudioManager::IsMP3RadioChannelAvailable() const
+{
+ if(m_bIsInitialised) return SampleManager.IsMP3RadioChannelAvailable();
+
+ return 0;
+}
+
+bool
cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
{
switch(soundMission) {
@@ -3448,8 +3038,6 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
EAXJMP(0x57A500);
}
-bool &bPlayerJustEnteredCar = *(bool *)0x6508C4;
-
void
cAudioManager::PlayerJustGotInCar() const
{
@@ -3479,10 +3067,10 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (CPhysical *)1);
if(m_nProjectileEntity >= 0) SetEntityStatus(m_nProjectileEntity, 1);
- m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATER_CANNON, (CPhysical *)1);
+ m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (CPhysical *)1);
if(m_nWaterCannonEntity >= 0) SetEntityStatus(m_nWaterCannonEntity, 1);
- m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_D, (CPhysical *)1);
+ m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (CPhysical *)1);
if(m_nPoliceChannelEntity >= 0) SetEntityStatus(m_nPoliceChannelEntity, 1);
m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (CPhysical *)1);
@@ -3504,6 +3092,14 @@ cAudioManager::PostTerminateGameSpecificShutdown()
;
}
+
+void
+cAudioManager::PreInitialiseGameSpecificSetup() const
+{
+ BankStartOffset[0] = AUDIO_SAMPLE_VEHICLE_HORN_0;
+ BankStartOffset[1] = AUDIO_SAMPLE_POLICE_COP_1_ARREST_1;
+}
+
void
cAudioManager::PreTerminateGameSpecificShutdown()
{
@@ -3818,7 +3414,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
velocityChange = Abs(params->m_fVelocityChange);
if(velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) return 1;
- velocityChange = Min(0.75f, velocityChange);
+ velocityChange = min(0.75f, velocityChange);
multiplier = (velocityChange - 0.0005f) * 1.3342f;
CalculateDistance((bool *)params, params->m_fDistance);
vol = (30.f * multiplier);
@@ -5556,8 +5152,6 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
}
}
-bool &g_bMissionAudioLoadFailed = *(bool *)0x95CD8E;
-
void
cAudioManager::ProcessMissionAudio()
{
@@ -5571,9 +5165,9 @@ cAudioManager::ProcessMissionAudio()
static uint8 nFramesUntilFailedLoad = 0;
static uint8 nFramesForPretendPlaying = 0;
- if(this->m_bIsInitialised) {
+ if(m_bIsInitialised) {
if(m_sMissionAudio.m_nSampleIndex != 3033) {
- switch(this->m_sMissionAudio.m_bLoadingStatus) {
+ switch(m_sMissionAudio.m_bLoadingStatus) {
case 0:
SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex,
1u);
@@ -5581,9 +5175,9 @@ cAudioManager::ProcessMissionAudio()
nFramesUntilFailedLoad = 0;
return;
case 1:
- if(!this->m_sMissionAudio.m_bIsPlayed) return;
+ if(!m_sMissionAudio.m_bIsPlayed) return;
if(g_bMissionAudioLoadFailed) {
- if(this->m_bTimerJustReset) {
+ if(m_bTimerJustReset) {
ClearMissionAudio();
SampleManager.StopStreamedFile(1u);
nFramesForPretendPlaying = 0;
@@ -5591,16 +5185,16 @@ cAudioManager::ProcessMissionAudio()
nFramesUntilFailedLoad = 0;
} else if(!m_bUserPause) {
if(++nFramesForPretendPlaying < 120u) {
- this->m_sMissionAudio.m_bPlayStatus = 1;
+ m_sMissionAudio.m_bPlayStatus = 1;
} else {
- this->m_sMissionAudio.m_bPlayStatus = 2;
- this->m_sMissionAudio.m_nSampleIndex = 3033;
+ m_sMissionAudio.m_bPlayStatus = 2;
+ m_sMissionAudio.m_nSampleIndex = 3033;
}
}
} else {
if(m_sMissionAudio.m_bPlayStatus) {
if(m_sMissionAudio.m_bPlayStatus != 1) return;
- if(this->m_bTimerJustReset) {
+ if(m_bTimerJustReset) {
ClearMissionAudio();
SampleManager.StopStreamedFile(1u);
return;
@@ -5696,7 +5290,7 @@ cAudioManager::ProcessMissionAudio()
nFramesForPretendPlaying = 0;
g_bMissionAudioLoadFailed = 1;
nFramesUntilFailedLoad = 0;
- this->m_sMissionAudio.m_bLoadingStatus = 1;
+ m_sMissionAudio.m_bLoadingStatus = 1;
}
return;
default: return;
@@ -6072,7 +5666,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
if(params->m_fDistance < 49.f) {
ped = params->m_pPed;
- if(!(ped->m_ped_flagA20) || ped->m_bodyPartBleeding != 2) {
+ if(!ped->bIsAimingGun || ped->m_bodyPartBleeding != 2) {
CalculateDistance((bool *)params, params->m_fDistance);
if(ped->bInVehicle && ped->m_nPedState == PED_DRIVING) {
emittingVol = 10;
@@ -7121,7 +6715,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
CurrentPretendGear = 1;
}
if(CReplay::IsPlayingBack()) {
- accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal));
+ accelerateState = 255.f * max(0.0f, min(1.0f, automobile->m_fGasPedal));
} else {
accelerateState = Pads->GetAccelerate();
}
@@ -7156,9 +6750,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if(0.0f != velocityChange) {
time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
if(time <= 0.0f) {
- freqModifier = Max(-0.2f, time) * -15000.f;
+ freqModifier = max(-0.2f, time) * -15000.f;
} else {
- freqModifier = -(Min(0.2f, time) * 15000.f);
+ freqModifier = -(min(0.2f, time) * 15000.f);
}
if(params->m_fVelocityChange < -0.001f) freqModifier = -freqModifier;
} else {
@@ -7177,10 +6771,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
gasPedalAudio = automobile->m_fGasPedalAudio;
} else {
gasPedalAudio =
- Min(1.0f, params->m_fVelocityChange /
+ min(1.0f, params->m_fVelocityChange /
params->m_pTransmission->fMaxReverseVelocity);
}
- gasPedalAudio = Max(0.0f, gasPedalAudio);
+ gasPedalAudio = max(0.0f, gasPedalAudio);
automobile->m_fGasPedalAudio = gasPedalAudio;
} else if(LastAccel > 0) {
if(channelUsed) {
@@ -7210,7 +6804,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
(engineSoundType + AUDIO_SAMPLE_VEHICLE_ENGINE_IDLE_NONE), 0,
52u, 1);
- CurrentPretendGear = Max(1, currentGear);
+ CurrentPretendGear = max(1, currentGear);
LastAccel = accelerateState;
bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
@@ -7665,11 +7259,11 @@ cAudioManager::ProcessScriptObject(int32 id)
{
cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity;
if(entity) {
- m_sQueueSample.m_vecPos = entity->m_vecPos;
+ m_sQueueSample.m_vecPos = entity->Posn;
if(m_asAudioEntities[id].m_Loops == 1)
ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]);
else
- ProcessLoopingScriptObject(entity->m_wSound);
+ ProcessLoopingScriptObject(entity->AudioId);
}
}
@@ -7778,7 +7372,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
if(params->m_fVelocityChange <= 0.0f) {
CalculateDistance((bool *)params, params->m_fDistance);
train = (CTrain *)params->m_pVehicle;
- speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
+ speedMultipler = min(1.0f, train->m_fSpeed * 250.f / 51.f);
emittingVol = (75.f * speedMultipler);
if(train->m_fWagonPosition == 0.0f) {
m_sQueueSample.m_bVolume =
@@ -7871,7 +7465,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
if(automobile->Damage.GetDoorStatus(i) == 2) {
doorState = automobile->Doors[i].m_nDoorState;
if(doorState == 1 || doorState == 2) {
- velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
+ velocity = min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
if(velocity > 0.0035f) {
emittingVol = (100.f * velocity * 10.f / 3.f);
m_sQueueSample.m_bVolume = ComputeVolume(
@@ -7961,7 +7555,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
CalculateDistance((bool *)params, params->m_fDistance);
emittingVol =
30.f *
- Min(1.f,
+ min(1.f,
velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
@@ -8011,11 +7605,63 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
WRAPPER
void cAudioManager::ProcessWaterCannon(int32) { EAXJMP(0x575F30); }
-WRAPPER
void
cAudioManager::ProcessWeather(int32 id)
{
- EAXJMP(0x578370);
+ uint8 vol;
+ static uint8 counter = 0;
+
+ if(m_asAudioEntities[id].m_Loops &&
+ m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) {
+ if(m_asAudioEntities[id].m_afVolume[0] >= 10.f) {
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_EXPLOSION_CAR;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 4000;
+ vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40;
+ } else {
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WEAPON_GRENADE_EXPLOSION;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500u) + 4000;
+ vol = (m_asAudioEntities[id].m_afVolume[0]) + 35;
+ }
+ m_sQueueSample.m_bVolume = vol;
+ if(TheCamera.SoundDistUp < 20.f) m_sQueueSample.m_bVolume >>= 1;
+ if(counter == 4) counter = 0;
+ m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.field_16 = 0;
+ m_sQueueSample.m_bOffset = (m_anRandomTable[2] & 15) + 55;
+ m_sQueueSample.m_bIsDistant = 1;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = 0;
+ m_sQueueSample.m_bRequireReflection = 0;
+ cAudioManager::AddSampleToRequestedQueue();
+ }
+ if(CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_COLLISION_LOOPING_GRASS;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_COLLISION_LOOPING_GRASS);
+ m_sQueueSample.m_bVolume = (uint8)(25.f * CWeather::Rain);
+ m_sQueueSample.m_counter = 4;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.field_16 = 0;
+ m_sQueueSample.m_bOffset = 63;
+ m_sQueueSample.m_bIsDistant = 1;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.field_56 = 0;
+ m_sQueueSample.field_76 = 30;
+ m_sQueueSample.m_bReverbFlag = 0;
+ m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bRequireReflection = 0;
+ cAudioManager::AddSampleToRequestedQueue();
+ }
}
bool
@@ -8034,7 +7680,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
if(velChange > 0.f) {
CalculateDistance((bool *)params, params->m_fDistance);
relativeVelocity =
- Min(1.0f,
+ min(1.0f,
velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
m_sQueueSample.m_bVolume =
@@ -8114,6 +7760,286 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
}
}
+int32
+cAudioManager::RandomDisplacement(uint32 seed) const
+{
+ int32 value;
+
+ static bool bIsEven = true;
+ static uint32 base = 0;
+
+ if(!seed) return 0;
+
+ value = m_anRandomTable[(base + seed) % 5] % seed;
+ base += value;
+
+ if(value % 2) { bIsEven = !bIsEven; }
+ if(!bIsEven) value = -value;
+ return value;
+}
+
+void
+cAudioManager::ReacquireDigitalHandle() const
+{
+ if(m_bIsInitialised) { SampleManager.ReacquireDigitalHandle(); }
+}
+
+void
+cAudioManager::ReleaseDigitalHandle() const
+{
+ if(m_bIsInitialised) { SampleManager.ReleaseDigitalHandle(); }
+}
+
+void
+cAudioManager::ResetAudioLogicTimers(int32 timer)
+{
+ audioLogicTimers[0] = timer;
+ audioLogicTimers[8] = timer;
+ audioLogicTimers[1] = timer;
+ audioLogicTimers[7] = timer;
+ audioLogicTimers[2] = timer;
+ audioLogicTimers[6] = timer;
+ audioLogicTimers[3] = timer;
+ audioLogicTimers[5] = timer;
+ audioLogicTimers[4] = timer;
+ for(int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
+ if(m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
+ CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
+ if(ped->IsPed()) {
+ ped->m_lastSoundStart = timer;
+ ped->m_soundStart = timer + m_anRandomTable[0] % 3000u;
+ }
+ }
+ }
+ ClearMissionAudio();
+ SampleManager.StopChannel(28);
+}
+
+void
+cAudioManager::ResetPoliceRadio()
+{
+ if(m_bIsInitialised) {
+ if(SampleManager.GetChannelUsedFlag(28)) SampleManager.StopChannel(28);
+ InitialisePoliceRadio();
+ }
+}
+
+WRAPPER void
+cAudioManager::Service()
+{
+ EAXJMP(0x57A2A0);
+}
+
+
+void
+cAudioManager::SetDynamicAcousticModelingStatus(bool status)
+{
+ m_bDynamicAcousticModelingStatus = status;
+}
+
+void
+cAudioManager::SetEffectsFadeVolume(uint8 volume) const
+{
+ SampleManager.SetEffectsFadeVolume(volume);
+}
+
+void
+cAudioManager::SetEffectsMasterVolume(uint8 volume) const
+{
+ SampleManager.SetEffectsMasterVolume(volume);
+}
+
+void
+cAudioManager::SetEntityStatus(int32 id, bool status)
+{
+ if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots) {
+ if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; }
+ }
+}
+
+void
+cAudioManager::SetMissionAudioLocation(float x, float y, float z)
+{
+ if(m_bIsInitialised) {
+ m_sMissionAudio.field_12 = 0;
+ m_sMissionAudio.m_vecPos.x = x;
+ m_sMissionAudio.m_vecPos.y = y;
+ m_sMissionAudio.m_vecPos.z = z;
+ }
+}
+
+void
+cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
+{
+ if(m_bIsInitialised) {
+ if(g_nMissionAudioPlayingStatus != 1) {
+ g_nMissionAudioPlayingStatus = 0;
+ g_nMissionAudioSfx = sfx;
+ }
+ }
+}
+
+void
+cAudioManager::SetMusicFadeVolume(uint8 volume) const
+{
+ SampleManager.SetMusicFadeVolume(volume);
+}
+
+void
+cAudioManager::SetMusicMasterVolume(uint8 volume) const
+{
+ SampleManager.SetMusicMasterVolume(volume);
+}
+
+
+void
+cAudioManager::SetSpeakerConfig(int32 conf) const
+{
+ SampleManager.SetSpeakerConfig(conf);
+}
+
+WRAPPER
+bool cAudioManager::SetupJumboEngineSound(uint8, int32) { EAXJMP(0x56F140); }
+
+bool
+cAudioManager::SetupJumboFlySound(uint8 emittingVol)
+{
+ int32 vol;
+
+ if(m_sQueueSample.m_fDistance >= 440.0f) return 0;
+
+ vol = ComputeVolume(emittingVol, 440.0f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = vol;
+ if(m_sQueueSample.m_bVolume) {
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_FLY_SOUND;
+ m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_bIsDistant = 0;
+ m_sQueueSample.field_16 = 1;
+ m_sQueueSample.m_bEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSoundIntensity = 440.0f;
+ m_sQueueSample.field_56 = 0;
+ m_sQueueSample.field_48 = 4.0f;
+ m_sQueueSample.m_bReverbFlag = 1;
+ m_sQueueSample.field_76 = 5;
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ AddSampleToRequestedQueue();
+ }
+ return 1;
+}
+
+bool
+cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
+{
+ if(m_sQueueSample.m_fDistance >= 240.f) return 0;
+
+ m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 240.f, m_sQueueSample.m_fDistance);
+
+ if(m_sQueueSample.m_bVolume) {
+ m_sQueueSample.m_counter = 5;
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_bIsDistant = 1;
+ m_sQueueSample.field_16 = 1;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.field_48 = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 240.0f;
+ m_sQueueSample.field_56 = 0;
+ m_sQueueSample.field_76 = 12;
+ m_sQueueSample.m_bOffset = 0;
+ m_sQueueSample.m_bReverbFlag = 1;
+ m_sQueueSample.m_bRequireReflection = 0;
+ AddSampleToRequestedQueue();
+ m_sQueueSample.m_counter = 6;
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND;
+ m_sQueueSample.m_nFrequency += 200;
+ m_sQueueSample.m_bOffset = maxVolume;
+ AddSampleToRequestedQueue();
+ }
+ return 1;
+}
+
+bool
+cAudioManager::SetupJumboTaxiSound(uint8 vol)
+{
+ uint8 emittingVol;
+
+ if(m_sQueueSample.m_fDistance >= 180.f) return 0;
+
+ emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance * 0.0055556f);
+
+ if(m_sQueueSample.m_fDistance * 0.0055556f < 0.7f)
+ emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
+ m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
+
+ if(m_sQueueSample.m_bVolume) {
+ m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_TAXI_SOUND;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_bIsDistant = 0;
+ m_sQueueSample.field_16 = 1;
+ m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.field_48 = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 180.0f;
+ m_sQueueSample.field_56 = 0;
+ m_sQueueSample.field_76 = 4;
+ m_sQueueSample.m_bReverbFlag = 1;
+ m_sQueueSample.m_bRequireReflection = 0;
+ AddSampleToRequestedQueue();
+ }
+ return 1;
+}
+
+bool
+cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
+{
+ if(m_sQueueSample.m_fDistance >= 170.f) return 0;
+
+ m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
+
+ if(m_sQueueSample.m_bVolume) {
+ m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_JUMBO_WHINE_SOUND;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_bIsDistant = 0;
+ m_sQueueSample.field_16 = 1;
+ m_sQueueSample.m_nFrequency = freq;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.field_48 = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 170.0f;
+ m_sQueueSample.field_56 = 0;
+ m_sQueueSample.field_76 = 4;
+ m_sQueueSample.m_bReverbFlag = 1;
+ m_sQueueSample.m_bRequireReflection = 0;
+ AddSampleToRequestedQueue();
+ }
+ return 1;
+}
+
void
cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
{
@@ -8240,69 +8166,105 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
}
}
-WRAPPER void
-cAudioManager::Service()
+void
+cAudioManager::Terminate()
{
- EAXJMP(0x57A2A0);
-}
+ if(m_bIsInitialised) {
+ MusicManager.Terminate();
-WRAPPER void cAudioManager::PlayOneShot(int, unsigned short, float)
-{
- EAXJMP(0x57A500);
-}
+ for(uint32 i = 0; i < totalAudioEntitiesSlots; i++) {
+ m_asAudioEntities[i].m_bIsUsed = 0;
+ m_anAudioEntityIndices[i] = 200;
+ }
-WRAPPER void cAudioManager::SetEffectsFadeVol(unsigned char)
-{
- EAXJMP(0x57A770);
-}
+ m_nAudioEntitiesTotal = 0;
+ m_nScriptObjectEntityTotal = 0;
+ PreTerminateGameSpecificShutdown();
-WRAPPER void cAudioManager::SetMusicFadeVol(unsigned char)
-{
- EAXJMP(0x57A790);
-}
+ for(uint32 i = 0; i < 2; i++) {
+ if(SampleManager.IsSampleBankLoaded(i)) SampleManager.UnloadSampleBank(i);
+ }
-WRAPPER int8 cAudioManager::SetCurrent3DProvider(unsigned char)
-{
- EAXJMP(0x57A910);
+ SampleManager.Terminate();
+
+ m_bIsInitialised = 0;
+ PostTerminateGameSpecificShutdown();
+ }
}
-WRAPPER void cAudioManager::ReportCrime(eCrimeType, CVector const &)
+void
+cAudioManager::TranslateEntity(CVector *v1, CVector *v2) const
{
- EAXJMP(0x5803D0);
+ const RwMatrix &cM = TheCamera.GetMatrix().m_matrix;
+ const CVector &cV = TheCamera.GetPosition();
+
+ float a = v1->z - cV.z;
+ float b = v1->y - cV.y;
+ float c = v1->x - cV.x;
+
+ v2->x = cM.right.y * b + cM.right.x * c + cM.right.z * a;
+ v2->y = cM.up.y * b + cM.up.x * c + cM.up.z * a;
+ v2->z = cM.at.y * b + cM.at.x * c + cM.at.z * a;
}
-WRAPPER void cAudioManager::PlaySuspectLastSeen(float, float, float)
+void
+cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile)
{
- EAXJMP(0x580500);
+ float newGasPedalAudio;
+
+ float gasPedal = Abs(automobile->m_fGasPedal);
+ float gasPedalAudio = automobile->m_fGasPedalAudio;
+
+ if(gasPedalAudio < gasPedal) {
+ newGasPedalAudio = gasPedalAudio + 0.09f;
+ if(gasPedal <= newGasPedalAudio) newGasPedalAudio = gasPedal;
+ } else {
+ newGasPedalAudio = gasPedalAudio - 0.07f;
+ if(gasPedal >= newGasPedalAudio) newGasPedalAudio = gasPedal;
+ }
+ automobile->m_fGasPedalAudio = newGasPedalAudio;
}
-WRAPPER void cAudioManager::ReportCollision(CEntity *, CEntity *, unsigned char, unsigned char, float, float)
+bool
+cAudioManager::UsesReverseWarning(int32 model) const
{
- EAXJMP(0x568410);
+ return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS ||
+ model == COACH;
}
-WRAPPER void cAudioManager::ResetTimers(unsigned int)
+bool
+cAudioManager::UsesSiren(int32 model) const
{
- EAXJMP(0x57A7B0);
+ switch(model) {
+ case FIRETRUK:
+ case AMBULAN:
+ case FBICAR:
+ case POLICE:
+ case ENFORCER:
+ case PREDATOR: return true;
+ default: return false;
+ }
}
-WRAPPER void cAudioManager::PreloadMissionAudio(char *)
+bool
+cAudioManager::UsesSirenSwitching(int32 model) const
{
- EAXJMP(0x579550);
+ switch(model) {
+ case AMBULAN:
+ case POLICE:
+ case ENFORCER:
+ case PREDATOR: return true;
+ default: return false;
+ }
}
STARTPATCHES
-InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
-InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
-
InjectHook(0x57B210, &cAudioManager::AddDetailsToRequestedOrderList, PATCH_JUMP);
InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP);
InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP);
// InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP);
InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP);
-InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP);
// InjectHook(0x580AF0, &cAudioManager::AgeCrimes, PATCH_JUMP);
-
InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP);
InjectHook(0x57AA10, &cAudioManager::CheckForAnAudioFileOnCD, PATCH_JUMP);
InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP);
@@ -8310,162 +8272,111 @@ InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP);
InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP);
InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP);
InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP);
-
InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP);
InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP);
InjectHook(0x57F060, &cAudioManager::DoPoliceRadioCrackle, PATCH_JUMP);
-
InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP);
-InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP);
-InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP);
-
-InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP);
-InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP);
-// InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP);
-InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP);
-InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
-
-InjectHook(0x57F050, &cAudioManager::GetMissionScriptPoliceAudioPlayingStatus, PATCH_JUMP);
-InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP);
-
-InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP);
-InjectHook(0x57A9C0, &cAudioManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
-InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP);
-
-InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP);
-InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP);
-InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP);
-InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP);
-
-InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP);
-
-InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP);
-
-InjectHook(0x57F020, &cAudioManager::SetMissionScriptPoliceAudio, PATCH_JUMP);
-
-InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
-InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
-
-InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_JUMP);
-
InjectHook(0x57A8C0, &cAudioManager::Get3DProviderName, PATCH_JUMP);
-InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP);
-InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP);
-InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP);
-InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP);
-
-InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP);
-
-InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP);
-
-InjectHook(0x57EFF0, &cAudioManager::ResetPoliceRadio, PATCH_JUMP);
-
-InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP);
-
-InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
-InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP);
-
-InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP);
-
-InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP);
-InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
-
-InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
-InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP);
-InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
-
-InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
-
-InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP);
-
-InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP);
-InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
-
-InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP);
-InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
-InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
-
-// Get ped sfx stuff
-InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP);
-
-InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
-InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP);
-InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP);
-InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP);
InjectHook(0x571110, &cAudioManager::GetArmyTalkSfx, PATCH_JUMP);
-InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP);
-InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP);
-InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP);
-InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP);
-InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP);
-InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP);
-InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP);
-InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP);
-InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP);
-InjectHook(0x571B00, &cAudioManager::GetColumbianTalkSfx, PATCH_JUMP);
-InjectHook(0x571C30, &cAudioManager::GetHoodTalkSfx, PATCH_JUMP);
-InjectHook(0x571D80, &cAudioManager::GetBlackCriminalTalkSfx, PATCH_JUMP);
-InjectHook(0x571E60, &cAudioManager::GetWhiteCriminalTalkSfx, PATCH_JUMP);
-InjectHook(0x571F40, &cAudioManager::GetMaleNo2TalkSfx, PATCH_JUMP);
-InjectHook(0x572AF0, &cAudioManager::GetBlackProjectMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5725D0, &cAudioManager::GetWhiteFatMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5726C0, &cAudioManager::GetBlackFatMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x573AB0, &cAudioManager::GetBlackBusinessFemaleTalkSfx, PATCH_JUMP);
InjectHook(0x572050, &cAudioManager::GetBlackCasualFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x572170, &cAudioManager::GetWhiteCasualFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x572280, &cAudioManager::GetFemaleNo3TalkSfx, PATCH_JUMP);
+InjectHook(0x574380, &cAudioManager::GetBlackConstructionWorkerTalkSfx, PATCH_JUMP);
+InjectHook(0x571D80, &cAudioManager::GetBlackCriminalTalkSfx, PATCH_JUMP);
+InjectHook(0x5735E0, &cAudioManager::GetBlackDockerMaleTalkSfx, PATCH_JUMP);
InjectHook(0x5724D0, &cAudioManager::GetBlackFatFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5727B0, &cAudioManager::GetWhiteFatFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5726C0, &cAudioManager::GetBlackFatMaleTalkSfx, PATCH_JUMP);
InjectHook(0x5728B0, &cAudioManager::GetBlackFemaleProstituteTalkSfx, PATCH_JUMP);
-InjectHook(0x5729D0, &cAudioManager::GetWhiteFemaleProstituteTalkSfx, PATCH_JUMP);
InjectHook(0x572C20, &cAudioManager::GetBlackProjectFemaleOldTalkSfx, PATCH_JUMP);
InjectHook(0x572D20, &cAudioManager::GetBlackProjectFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x572E10, &cAudioManager::GetChinatownMaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x572F10, &cAudioManager::GetChinatownMaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x573010, &cAudioManager::GetChinatownFemaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x5730F0, &cAudioManager::GetChinatownFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x5731E0, &cAudioManager::GetLittleItalyMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573310, &cAudioManager::GetLittleItalyFemaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x573400, &cAudioManager::GetLittleItalyFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x5734F0, &cAudioManager::GetWhiteDockerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5735E0, &cAudioManager::GetBlackDockerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5736D0, &cAudioManager::GetScumMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5738D0, &cAudioManager::GetWhiteWorkerMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x572AF0, &cAudioManager::GetBlackProjectMaleTalkSfx, PATCH_JUMP);
InjectHook(0x5739C0, &cAudioManager::GetBlackWorkerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5713E0, &cAudioManager::GetBusinessMaleYoungTalkSfx, PATCH_JUMP);
+InjectHook(0x574FF0, &cAudioManager::GetBomberTalkSfx, PATCH_JUMP);
InjectHook(0x5712C0, &cAudioManager::GetBusinessMaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x5723A0, &cAudioManager::GetWhiteBusinessFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573AB0, &cAudioManager::GetBlackBusinessFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573BD0, &cAudioManager::GetSupermodelMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573CD0, &cAudioManager::GetSupermodelFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573DC0, &cAudioManager::GetStewardMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573E90, &cAudioManager::GetStewardFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573F60, &cAudioManager::GetFanMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574040, &cAudioManager::GetFanFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574120, &cAudioManager::GetHospitalMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5741F0, &cAudioManager::GetHospitalFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574290, &cAudioManager::GetWhiteConstructionWorkerTalkSfx, PATCH_JUMP);
-InjectHook(0x574380, &cAudioManager::GetBlackConstructionWorkerTalkSfx, PATCH_JUMP);
-InjectHook(0x574480, &cAudioManager::GetShopperFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574590, &cAudioManager::GetStudentMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574690, &cAudioManager::GetStudentFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5713E0, &cAudioManager::GetBusinessMaleYoungTalkSfx, PATCH_JUMP);
InjectHook(0x572040, &cAudioManager::GetCasualMaleOldTalkSfx, PATCH_JUMP);
-
-InjectHook(0x574790, &cAudioManager::GetSpecialCharacterTalkSfx, PATCH_JUMP);
+InjectHook(0x574FE0, &cAudioManager::GetCatatalinaTalkSfx, PATCH_JUMP);
+InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP);
+InjectHook(0x573010, &cAudioManager::GetChinatownFemaleOldTalkSfx, PATCH_JUMP);
+InjectHook(0x5730F0, &cAudioManager::GetChinatownFemaleYoungTalkSfx, PATCH_JUMP);
+InjectHook(0x572E10, &cAudioManager::GetChinatownMaleOldTalkSfx, PATCH_JUMP);
+InjectHook(0x572F10, &cAudioManager::GetChinatownMaleYoungTalkSfx, PATCH_JUMP);
+InjectHook(0x575120, &cAudioManager::GetChunkyTalkSfx, PATCH_JUMP);
+InjectHook(0x571B00, &cAudioManager::GetColumbianTalkSfx, PATCH_JUMP);
+InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP);
+InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP);
+InjectHook(0x569060, &cAudioManager::GetCollisionOneShotRatio, PATCH_JUMP);
+InjectHook(0x5693B0, &cAudioManager::GetCollisionRatio, PATCH_JUMP);
+InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP);
+InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP);
InjectHook(0x574DA0, &cAudioManager::GetEightTalkSfx, PATCH_JUMP);
+InjectHook(0x574040, &cAudioManager::GetFanFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x573F60, &cAudioManager::GetFanMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP);
+InjectHook(0x572280, &cAudioManager::GetFemaleNo3TalkSfx, PATCH_JUMP);
+InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP);
InjectHook(0x574E50, &cAudioManager::GetFrankieTalkSfx, PATCH_JUMP);
+InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x571C30, &cAudioManager::GetHoodTalkSfx, PATCH_JUMP);
+InjectHook(0x5741F0, &cAudioManager::GetHospitalFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x574120, &cAudioManager::GetHospitalMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP);
+InjectHook(0x573310, &cAudioManager::GetLittleItalyFemaleOldTalkSfx, PATCH_JUMP);
+InjectHook(0x573400, &cAudioManager::GetLittleItalyFemaleYoungTalkSfx, PATCH_JUMP);
+InjectHook(0x5731E0, &cAudioManager::GetLittleItalyMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP);
+InjectHook(0x571F40, &cAudioManager::GetMaleNo2TalkSfx, PATCH_JUMP);
+InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP);
+InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP);
+InjectHook(0x57F050, &cAudioManager::GetMissionScriptPoliceAudioPlayingStatus, PATCH_JUMP);
InjectHook(0x574F00, &cAudioManager::GetMistyTalkSfx, PATCH_JUMP);
+InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP);
InjectHook(0x574FD0, &cAudioManager::GetOJGTalkSfx, PATCH_JUMP);
-InjectHook(0x574FE0, &cAudioManager::GetCatatalinaTalkSfx, PATCH_JUMP);
-InjectHook(0x574FF0, &cAudioManager::GetBomberTalkSfx, PATCH_JUMP);
+InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP);
+InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
+InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP);
+InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
+InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5736D0, &cAudioManager::GetScumMaleTalkSfx, PATCH_JUMP);
InjectHook(0x575060, &cAudioManager::GetSecurityGuardTalkSfx, PATCH_JUMP);
-InjectHook(0x575120, &cAudioManager::GetChunkyTalkSfx, PATCH_JUMP);
-
-InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP);
-
-// Process stuff
+InjectHook(0x574480, &cAudioManager::GetShopperFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x574790, &cAudioManager::GetSpecialCharacterTalkSfx, PATCH_JUMP);
+InjectHook(0x573E90, &cAudioManager::GetStewardFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x573DC0, &cAudioManager::GetStewardMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x574690, &cAudioManager::GetStudentFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x574590, &cAudioManager::GetStudentMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x573CD0, &cAudioManager::GetSupermodelFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x573BD0, &cAudioManager::GetSupermodelMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP);
+InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP);
+InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP);
+InjectHook(0x5723A0, &cAudioManager::GetWhiteBusinessFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x572170, &cAudioManager::GetWhiteCasualFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x574290, &cAudioManager::GetWhiteConstructionWorkerTalkSfx, PATCH_JUMP);
+InjectHook(0x571E60, &cAudioManager::GetWhiteCriminalTalkSfx, PATCH_JUMP);
+InjectHook(0x5734F0, &cAudioManager::GetWhiteDockerMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5727B0, &cAudioManager::GetWhiteFatFemaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5725D0, &cAudioManager::GetWhiteFatMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5729D0, &cAudioManager::GetWhiteFemaleProstituteTalkSfx, PATCH_JUMP);
+InjectHook(0x5738D0, &cAudioManager::GetWhiteWorkerMaleTalkSfx, PATCH_JUMP);
+InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP);
+InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP);
+InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP);
+InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP);
+// InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP);
+InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP);
+InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
+InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP);
+InjectHook(0x57A9C0, &cAudioManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
+InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_JUMP);
+InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP);
+InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
+InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP);
+InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP);
+InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
+InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP);
+InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP);
// InjectHook(0x57BA60, &cAudioManager::ProcessActiveQueues, PATCH_JUMP);
InjectHook(0x56C940, &cAudioManager::ProcessAirBrakes, PATCH_JUMP);
InjectHook(0x577B30, &cAudioManager::ProcessAirportScriptObject, PATCH_JUMP);
@@ -8515,6 +8426,34 @@ InjectHook(0x56DBF0, &cAudioManager::ProcessTrainNoise, PATCH_JUMP);
InjectHook(0x56C770, &cAudioManager::ProcessVehicleDoors, PATCH_JUMP);
InjectHook(0x56C640, &cAudioManager::ProcessVehicleReverseWarning, PATCH_JUMP);
InjectHook(0x56A230, &cAudioManager::ProcessVehicleRoadNoise, PATCH_JUMP);
+InjectHook(0x578370, &cAudioManager::ProcessWeather, PATCH_JUMP);
+InjectHook(0x56A440, &cAudioManager::ProcessWetRoadNoise, PATCH_JUMP);
InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP);
+InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
+InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP);
+InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
+InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP);
+InjectHook(0x57EFF0, &cAudioManager::ResetPoliceRadio, PATCH_JUMP);
+InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
+InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP);
+InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP);
+InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP);
+InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP);
+InjectHook(0x57F020, &cAudioManager::SetMissionScriptPoliceAudio, PATCH_JUMP);
+InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP);
+InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP);
+InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP);
+InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP);
+InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP);
+InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP);
+InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP);
InjectHook(0x570690, &cAudioManager::SetupPedComments, PATCH_JUMP);
+InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
+InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP);
+InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP);
+InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
+InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
+InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
+InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
+InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
ENDPATCHES
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 5ad14050..c765bfd4 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -49,8 +49,8 @@ public:
uint8 field_89;
uint8 field_90;
uint8 field_91;
-
- // no methods
+
+ // no methods
};
static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
@@ -88,8 +88,8 @@ public:
float m_afVolume[4];
uint8 m_Loops;
uint8 field_25[3];
-
- // no methods
+
+ // no methods
};
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
@@ -104,8 +104,8 @@ public:
uint8 m_bVolume;
int8 field_25; // allocated time?
uint8 gap_26[2];
-
- // no methods
+
+ // no methods
};
static_assert(sizeof(tPedComment) == 28, "tPedComment: error");
@@ -119,7 +119,7 @@ public:
uint8 activeBank;
uint8 gap_1163[1];
- // reversed all methods
+ // reversed all methods
void Add(tPedComment *com); /// ok
void Process(); /// ok
};
@@ -142,8 +142,8 @@ public:
CVector m_vecPosition;
float m_fDistance;
int32 m_nBaseVolume;
-
- // no methods
+
+ // no methods
};
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
@@ -157,6 +157,8 @@ public:
uint8 m_bCollisionsInQueue;
uint8 gap_811;
cAudioCollision m_sQueue;
+
+ void AddCollisionToRequestedQueue(); // todo
};
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
@@ -177,6 +179,7 @@ public:
uint8 field_29;
uint8 field_30;
uint8 field_31;
+ // no methods
};
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
@@ -188,7 +191,8 @@ class CPed;
class cPedParams;
class cTransmission;
-class cAudioScriptObject {
+class cAudioScriptObject
+{
public:
int16 AudioId;
char _pad0[2];
@@ -220,22 +224,14 @@ enum {
MAX_REFLECTIONS,
};
-<<<<<<< HEAD
-enum AudioEntityHandle
-{
- AEHANDLE_NONE = -5,
- AEHANDLE_ERROR_NOAUDIOSYS = -4,
- AEHANDLE_ERROR_NOFREESLOT = -3,
- AEHANDLE_ERROR_NOENTITY = -2,
+enum AudioEntityHandle {
+ AEHANDLE_NONE = -5,
+ AEHANDLE_ERROR_NOAUDIOSYS = -4,
+ AEHANDLE_ERROR_NOFREESLOT = -3,
+ AEHANDLE_ERROR_NOENTITY = -2,
AEHANDLE_ERROR_BADAUDIOTYPE = -1,
};
-#define AEHANDLE_IS_FAILED(h) ((h)<0)
-#define AEHANDLE_IS_OK(h) ((h)>=0)
-
-
-=======
->>>>>>> Cleanup
class cAudioManager
{
public:
@@ -285,22 +281,10 @@ public:
uint8 field_19195; // time?
uint32 m_FrameCounter;
-<<<<<<< HEAD
- inline uint32 GetFrameCounter(void) { return m_FrameCounter; }
- float GetReflectionsDistance(int32 idx) { return m_afReflectionsDistances[idx]; }
-<<<<<<< HEAD
- int32 GetRandomNumber(int32 idx) { return m_anRandomTable[idx]; }
-=======
- int32 GetRandomTabe(int32 idx) { return m_anRandomTable[idx]; }
-
->>>>>>> Cleanup
- //
-=======
// getters
uint32 GetFrameCounter() const { return m_FrameCounter; }
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
- int32 GetRandomTabe(int32 idx) const { return m_anRandomTable[idx]; }
->>>>>>> More more more audio
+ int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
@@ -312,80 +296,22 @@ public:
void AgeCrimes(); // todo
void CalculateDistance(bool *ptr, float dist); /// ok
- bool CheckForAnAudioFileOnCD() const; /// ok
+ bool CheckForAnAudioFileOnCD() const; /// ok
void ClearMissionAudio(); /// ok
void ClearRequestedQueue(); /// ok
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
- float speedMultiplier) const; /// ok
- int32 ComputePan(float, CVector *); // todo
-<<<<<<< HEAD
- uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); /// ok
- int32 CreateEntity(int32 type, void *entity); /// ok
-=======
+ float speedMultiplier) const; /// ok
+ int32 ComputePan(float, CVector *); // todo
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance) const; /// ok
- int32 CreateEntity(int32 type, CPhysical *entity); /// ok
->>>>>>> More more more audio
+ int32 CreateEntity(int32 type, CPhysical *entity); /// ok
void DestroyAllGameCreatedEntities(); /// ok
void DestroyEntity(int32 id); /// ok
+ void DoJumboVolOffset() const; /// ok
void DoPoliceRadioCrackle(); /// ok
- void GenerateIntegerRandomNumberTable(); /// ok
-
- void TranslateEntity(CVector *v1, CVector *v2) const ; /// ok
-
- void ResetAudioLogicTimers(int32 timer); /// ok
-
- void Terminate();
- uint8 GetNum3DProvidersAvailable() const;
- bool IsMP3RadioChannelAvailable() const;
- uint8 GetCDAudioDriveLetter() const;
-
- void SetEffectsMasterVolume(uint8 volume) const;
- void SetMusicMasterVolume(uint8 volume) const;
- void SetEffectsFadeVolume(uint8 volume) const;
- void SetMusicFadeVolume(uint8 volume) const;
-
- void SetSpeakerConfig(int32 conf) const;
-
- bool SetupJumboEngineSound(uint8, int32); // todo
- void PreInitialiseGameSpecificSetup() const;
- void SetMissionScriptPoliceAudio(int32 sfx) const;
-
- bool UsesSiren(int32 model) const;
- bool UsesSirenSwitching(int32 model) const;
-
- char *Get3DProviderName(uint8 id) const;
-
- bool SetupJumboFlySound(uint8 emittingVol); /// ok
- bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
- bool SetupJumboTaxiSound(uint8 vol); /// ok
- bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
-
- void SetMissionAudioLocation(float x, float y, float z);
-
- void ResetPoliceRadio();
-
- bool UsesReverseWarning(int32 model) const;
-
- int32 RandomDisplacement(uint32 seed) const;
-
- void ReleaseDigitalHandle() const;
- void ReacquireDigitalHandle() const;
- void SetDynamicAcousticModelingStatus(bool status);
-
- bool IsAudioInitialised() const;
-
- void SetEntityStatus(int32 id, bool status);
-
- void Service();
- void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
-
- void DoJumboVolOffset() const;
-
- int32 GetPedCommentSfx(CPed *ped, int32 sound);
-
- // order from GetPedCommentSfx
+ // functions returning talk sfx,
+ // order from GetPedCommentSfx
uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound);
uint32 GetSwatTalkSfx(int16 sound);
@@ -462,15 +388,22 @@ public:
uint32 GetGenericMaleTalkSfx(int16 sound);
uint32 GetGenericFemaleTalkSfx(int16 sound);
+ // end of functions returning talk sfx
+ void GenerateIntegerRandomNumberTable(); /// ok
+ char *Get3DProviderName(uint8 id) const;
+ uint8 GetCDAudioDriveLetter() const;
int8 GetCurrent3DProviderIndex() const; /// ok
- float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // todo hook
- float GetCollisionOneShotRatio(uint32 a, float b) const; // todo hook
- float GetCollisionRatio(float a, float b, float c, float d) const; // todo hook
+ float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
+ float GetCollisionOneShotRatio(uint32 a, float b) const; /// ok
+ float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
float GetDistanceSquared(CVector *v) const; /// ok
int32 GetJumboTaxiFreq() const; /// ok
bool GetMissionAudioLoadingStatus() const; /// ok
char GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
+ uint8 GetNum3DProvidersAvailable() const;
+ int32 GetPedCommentSfx(CPed *ped, int32 sound);
+ void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(uint8 a1, CAutomobile *a2, cTransmission *a3,
float a4); // todo
int32 GetVehicleNonDriveWheelSkidValue(float a1, int a2, int a3, int a4, float a5); // todo
@@ -481,19 +414,22 @@ public:
void InitialisePoliceRadio(); // todo
void InitialisePoliceRadioZones(); // todo
void InterrogateAudioEntities(); /// ok
+ bool IsAudioInitialised() const; /// ok
bool IsMissionAudioSampleFinished(); /// ok
+ bool IsMP3RadioChannelAvailable() const;
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
void PlayLoadedMissionAudio(); /// ok
void PlayOneShot(int32 index, int16 sound, float vol); // todo
- uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
- void PlayerJustGotInCar() const; /// ok
- void PlayerJustLeftCar() const; /// ok
+ uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
+ void PlayerJustGotInCar() const; /// ok
+ void PlayerJustLeftCar() const; /// ok
void PostInitialiseGameSpecificSetup(); /// ok
void PostTerminateGameSpecificShutdown(); /// ok
- void PreTerminateGameSpecificShutdown(); /// ok
- void PreloadMissionAudio(char *); // todo
+ void PreInitialiseGameSpecificSetup() const;
+ void PreloadMissionAudio(char *); // todo
+ void PreTerminateGameSpecificShutdown(); /// ok
/// processX - main logic of adding new sounds
void ProcessActiveQueues(); // todo
bool ProcessAirBrakes(cVehicleParams *params); /// ok
@@ -541,7 +477,7 @@ public:
void ProcessPornCinema(uint8 sound); /// ok
void ProcessProjectiles(); // todo requires CProjectileInfo
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
- void ProcessReverb() const; /// ok
+ void ProcessReverb() const; /// ok
bool ProcessReverseGear(cVehicleParams *a2); /// ok
void ProcessSawMillScriptObject(uint8 sound); /// ok
void ProcessScriptObject(int32 id); /// ok
@@ -558,11 +494,55 @@ public:
// void ProcessVehicleSirenOrAlarm(void *);
// void ProcessVehicleSkidding(void *);
void ProcessWaterCannon(int32); // todo
- void ProcessWeather(int32 id); // todo
- bool ProcessWetRoadNoise(cVehicleParams *params); // todo hook
+ void ProcessWeather(int32 id); /// ok
+ bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
void ProcessWorkShopScriptObject(uint8 sound); /// ok
- void SetupPedComments(cPedParams *params, uint32 sound); /// ok
+ int32 RandomDisplacement(uint32 seed) const;
+ void ReacquireDigitalHandle() const;
+ void ReleaseDigitalHandle() const;
+ int32 ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6,
+ float a7); // todo
+ int32 ReportCrime(int a2, int *a3); // todo
+ void ResetAudioLogicTimers(int32 timer); /// ok
+ void ResetPoliceRadio();
+ void ResetTimers(unsigned int a2); // todo
+
+ void Service(); // todo
+ void ServiceCollisions(); // todo
+ void ServicePoliceRadio(); // todo
+ void ServicePoliceRadioChannel(int a2); // todo
+ void ServiceSoundEffects(); // todo
+ void SetCurrent3DProvider(uint8);
+ void SetDynamicAcousticModelingStatus(bool status);
+ void SetEffectsFadeVolume(uint8 volume) const;
+ void SetEffectsMasterVolume(uint8 volume) const;
+ void SetEntityStatus(int32 id, bool status);
+ uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(int32); // todo
+ void SetMissionAudioLocation(float x, float y, float z);
+ void SetMissionScriptPoliceAudio(int32 sfx) const;
+ void SetMonoMode(uint8); // todo
+ void SetMusicFadeVolume(uint8 volume) const;
+ void SetMusicMasterVolume(uint8 volume) const;
+ void SetSpeakerConfig(int32 conf) const;
+ void SetUpLoopingCollisionSound(int a2, int a3); // todo
+ void SetUpOneShotCollisionSound(int a2); // todo
+ void SetupCrimeReport(); // todo
+ bool SetupJumboEngineSound(uint8, int32); // todo
+ bool SetupJumboFlySound(uint8 emittingVol); /// ok
+ bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
+ bool SetupJumboTaxiSound(uint8 vol); /// ok
+ bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
+ void SetupPedComments(cPedParams *params, uint32 sound); /// ok
+ void SetupSuspectLastSeenReport(); // todo
+
+ void Terminate();
+ void TranslateEntity(CVector *v1, CVector *v2) const; /// ok
+
+ void UpdateGasPedalAudio(CAutomobile *automobile); // todo hook
+ bool UsesReverseWarning(int32 model) const;
+ bool UsesSiren(int32 model) const;
+ bool UsesSirenSwitching(int32 model) const;
};
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
diff --git a/src/audio/AudioManager.h.autosave b/src/audio/AudioManager.h.autosave
new file mode 100644
index 00000000..2ea78476
--- /dev/null
+++ b/src/audio/AudioManager.h.autosave
@@ -0,0 +1,549 @@
+#pragma once
+
+#include "AudioSamples.h"
+#include "DMAudio.h"
+#include "common.h"
+
+class tActiveSample
+{
+public:
+ int32 m_nEntityIndex;
+ int32 m_counter;
+ int32 m_nSampleIndex;
+ uint8 m_bBankIndex;
+ uint8 m_bIsDistant;
+ uint8 field_14;
+ uint8 field_15;
+ int32 field_16;
+ int32 m_nFrequency;
+ uint8 m_bVolume;
+ uint8 field_25;
+ uint8 field_26;
+ uint8 field_27;
+ float m_fDistance;
+ int32 m_nLoopCount;
+ int32 m_nLoopStart;
+ int32 m_nLoopEnd;
+ uint8 m_bEmittingVolume;
+ uint8 field_45;
+ uint8 field_46;
+ uint8 field_47;
+ float field_48;
+ float m_fSoundIntensity;
+ uint8 field_56;
+ uint8 field_57;
+ uint8 field_58;
+ uint8 field_59;
+ CVector m_vecPos;
+ uint8 m_bReverbFlag;
+ uint8 m_bLoopsRemaining;
+ uint8 m_bRequireReflection;
+ uint8 m_bOffset;
+ int32 field_76;
+ uint8 m_bIsProcessed;
+ uint8 m_bLoopEnded;
+ uint8 field_82;
+ uint8 field_83;
+ int32 calculatedVolume;
+ uint8 field_88;
+ uint8 field_89;
+ uint8 field_90;
+ uint8 field_91;
+
+ // no methods
+};
+
+static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
+
+enum eAudioType : int32 {
+ AUDIOTYPE_PHYSICAL = 0,
+ AUDIOTYPE_EXPLOSION = 1,
+ AUDIOTYPE_FIRE = 2,
+ AUDIOTYPE_WEATHER = 3,
+ AUDIOTYPE_CRANE = 4,
+ AUDIOTYPE_SCRIPTOBJECT = 5,
+ AUDIOTYPE_BRIDGE = 6,
+ AUDIOTYPE_COLLISION = 7,
+ AUDIOTYPE_FRONTEND = 8,
+ AUDIOTYPE_PROJECTILE = 9,
+ AUDIOTYPE_GARAGE = 10,
+ AUDIOTYPE_FIREHYDRANT = 11,
+ AUDIOTYPE_WATERCANNON = 12,
+ AUDIOTYPE_POLICERADIO = 13,
+ TOTAL_AUDIO_TYPES = 14,
+};
+
+class CPhysical;
+class CAutomobile;
+
+class tAudioEntity
+{
+public:
+ eAudioType m_nType;
+ void *m_pEntity;
+ bool m_bIsUsed;
+ uint8 m_bStatus;
+ int16 m_awAudioEvent[4];
+ uint8 gap_18[2];
+ float m_afVolume[4];
+ uint8 m_Loops;
+ uint8 field_25[3];
+
+ // no methods
+};
+
+static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
+
+class tPedComment
+{
+public:
+ int32 m_nSampleIndex;
+ int32 m_entityIndex;
+ CVector m_vecPos;
+ float m_fDistance;
+ uint8 m_bVolume;
+ int8 field_25; // allocated time?
+ uint8 gap_26[2];
+
+ // no methods
+};
+
+static_assert(sizeof(tPedComment) == 28, "tPedComment: error");
+
+class cPedComments
+{
+public:
+ tPedComment m_asPedComments[2][20];
+ uint8 indexMap[2][20];
+ uint8 nrOfCommentsInBank[2];
+ uint8 activeBank;
+ uint8 gap_1163[1];
+
+ // reversed all methods
+ void Add(tPedComment *com); /// ok
+ void Process(); /// ok
+};
+
+static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
+
+class CEntity;
+
+class cAudioCollision
+{
+public:
+ CEntity *m_pEntity1;
+ CEntity *m_pEntity2;
+ uint8 m_bSurface1;
+ uint8 m_bSurface2;
+ uint8 field_10;
+ uint8 field_11;
+ float m_fIntensity1;
+ float m_fIntensity2;
+ CVector m_vecPosition;
+ float m_fDistance;
+ int32 m_nBaseVolume;
+
+ // no methods
+};
+
+static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
+
+class cAudioCollisionManager
+{
+public:
+ cAudioCollision m_asCollisions1[10];
+ cAudioCollision m_asCollisions2[10];
+ uint8 m_bIndicesTable[10];
+ uint8 m_bCollisionsInQueue;
+ uint8 gap_811;
+ cAudioCollision m_sQueue;
+
+ void AddCollisionToRequestedQueue(); // todo
+};
+
+static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
+
+class cMissionAudio
+{
+public:
+ CVector m_vecPos;
+ uint8 field_12;
+ uint8 gap_13[3];
+ int m_nSampleIndex;
+ uint8 m_bLoadingStatus;
+ uint8 m_bPlayStatus;
+ uint8 field_22;
+ uint8 field_23;
+ int field_24;
+ bool m_bIsPlayed;
+ uint8 field_29;
+ uint8 field_30;
+ uint8 field_31;
+ // no methods
+};
+
+static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
+
+class cVehicleParams;
+class CPlane;
+class CVehicle;
+class CPed;
+class cPedParams;
+class cTransmission;
+
+class cAudioScriptObject {
+public:
+ int16 AudioId;
+ char _pad0[2];
+ CVector Posn;
+ int32 AudioEntity;
+
+ static void *operator new(size_t);
+ static void *operator new(size_t, int);
+ static void operator delete(void *, size_t);
+ static void operator delete(void *, int);
+};
+
+static_assert(sizeof(cAudioScriptObject) == 20, "cAudioScriptObject: error");
+
+enum {
+ /*
+ REFLECTION_YMAX = 0, top
+ REFLECTION_YMIN = 1, bottom
+ REFLECTION_XMIN = 2, left
+ REFLECTION_XMAX = 3, right
+ REFLECTION_ZMAX = 4,
+ */
+
+ REFLECTION_TOP = 0,
+ REFLECTION_BOTTOM,
+ REFLECTION_LEFT,
+ REFLECTION_RIGHT,
+ REFLECTION_UP,
+ MAX_REFLECTIONS,
+};
+
+enum AudioEntityHandle
+{
+ AEHANDLE_NONE = -5,
+ AEHANDLE_ERROR_NOAUDIOSYS = -4,
+ AEHANDLE_ERROR_NOFREESLOT = -3,
+ AEHANDLE_ERROR_NOENTITY = -2,
+ AEHANDLE_ERROR_BADAUDIOTYPE = -1,
+};
+
+class cAudioManager
+{
+public:
+ bool m_bIsInitialised;
+ uint8 field_1;
+ uint8 field_2;
+ uint8 m_bActiveSamples;
+ uint8 field_4;
+ bool m_bDynamicAcousticModelingStatus;
+ uint8 field_6;
+ uint8 field_7;
+ float speedOfSound;
+ bool m_bTimerJustReset;
+ uint8 field_13;
+ uint8 field_14;
+ uint8 field_15;
+ int32 m_nTimer;
+ tActiveSample m_sQueueSample;
+ uint8 m_bActiveSampleQueue;
+ uint8 gap_109[3];
+ tActiveSample m_asSamples[2][27];
+ uint8 m_abSampleQueueIndexTable[2][27];
+ uint8 m_bSampleRequestQueuesStatus[2];
+ tActiveSample m_asActiveSamples[27];
+ tAudioEntity m_asAudioEntities[200];
+ int32 m_anAudioEntityIndices[200];
+ int32 m_nAudioEntitiesTotal;
+ CVector m_avecReflectionsPos[5];
+ float m_afReflectionsDistances[5];
+ int32 m_anScriptObjectEntityIndices[40];
+ int32 m_nScriptObjectEntityTotal;
+ cPedComments m_sPedComments;
+ int32 m_nFireAudioEntity;
+ int32 m_nWaterCannonEntity;
+ int32 m_nPoliceChannelEntity;
+ uint8 gap45B8[444];
+ int32 m_nFrontEndEntity;
+ int32 m_nCollisionEntity;
+ cAudioCollisionManager m_sCollisionManager;
+ int32 m_nProjectileEntity;
+ int32 m_nBridgeEntity;
+ cMissionAudio m_sMissionAudio;
+ int32 m_anRandomTable[5];
+ uint8 field_19192;
+ uint8 m_bUserPause;
+ uint8 m_bPreviousUserPause;
+ uint8 field_19195; // time?
+ uint32 m_FrameCounter;
+
+ // getters
+ uint32 GetFrameCounter() const { return m_FrameCounter; }
+ float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
+ int32 GetRandomTabe(int32 idx) const { return m_anRandomTable[idx]; }
+
+ // "Should" be in alphabetic order, except "getXTalkSfx"
+ void AddDetailsToRequestedOrderList(uint8 sample); /// ok
+ void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
+ uint8 counter, bool notLooping); /// ok
+ void AddReflectionsToRequestedQueue(); /// ok (check value)
+ void AddReleasingSounds(); // todo (difficult)
+ void AddSampleToRequestedQueue(); /// ok
+ void AgeCrimes(); // todo
+
+ void CalculateDistance(bool *ptr, float dist); /// ok
+ bool CheckForAnAudioFileOnCD() const; /// ok
+ void ClearMissionAudio(); /// ok
+ void ClearRequestedQueue(); /// ok
+ int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
+ float speedMultiplier) const; /// ok
+ int32 ComputePan(float, CVector *); // todo
+ uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance) const; /// ok
+ int32 CreateEntity(int32 type, CPhysical *entity); /// ok
+
+ void DestroyAllGameCreatedEntities(); /// ok
+ void DestroyEntity(int32 id); /// ok
+ void DoJumboVolOffset() const; /// ok
+ void DoPoliceRadioCrackle(); /// ok
+
+ // functions returning talk sfx,
+ // order from GetPedCommentSfx
+ uint32 GetPlayerTalkSfx(int16 sound);
+ uint32 GetCopTalkSfx(int16 sound);
+ uint32 GetSwatTalkSfx(int16 sound);
+ uint32 GetFBITalkSfx(int16 sound);
+ uint32 GetArmyTalkSfx(int16 sound);
+ uint32 GetMedicTalkSfx(int16 sound);
+ uint32 GetFiremanTalkSfx(int16 sound);
+ uint32 GetNormalMaleTalkSfx(int16 sound);
+ uint32 GetTaxiDriverTalkSfx(int16 sound);
+ uint32 GetPimpTalkSfx(int16 sound);
+ uint32 GetMafiaTalkSfx(int16 sound);
+ uint32 GetTriadTalkSfx(int16 sound);
+ uint32 GetDiabloTalkSfx(int16 sound);
+ uint32 GetYakuzaTalkSfx(int16 sound);
+ uint32 GetYardieTalkSfx(int16 sound);
+ uint32 GetColumbianTalkSfx(int16 sound);
+ uint32 GetHoodTalkSfx(int16 sound);
+ uint32 GetBlackCriminalTalkSfx(int16 sound);
+ uint32 GetWhiteCriminalTalkSfx(int16 sound);
+ uint32 GetMaleNo2TalkSfx(int16 sound);
+ uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
+ uint32 GetWhiteFatMaleTalkSfx(int16 sound);
+ uint32 GetBlackFatMaleTalkSfx(int16 sound);
+ uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
+ uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
+ uint32 GetFemaleNo3TalkSfx(int16 sound);
+ uint32 GetBlackFatFemaleTalkSfx(int16 sound);
+ uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
+ uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
+ uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
+ uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
+ uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
+ uint32 GetChinatownMaleOldTalkSfx(int16 sound);
+ uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
+ uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
+ uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
+ uint32 GetLittleItalyMaleTalkSfx(int16 sound);
+ uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
+ uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
+ uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
+ uint32 GetBlackDockerMaleTalkSfx(int16 sound);
+ uint32 GetScumMaleTalkSfx(int16 sound);
+ uint32 GetScumFemaleTalkSfx(int16 sound);
+ uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
+ uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
+ uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
+ uint32 GetBusinessMaleOldTalkSfx(int16 sound);
+ uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
+ uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
+ uint32 GetSupermodelMaleTalkSfx(int16 sound);
+ uint32 GetSupermodelFemaleTalkSfx(int16 sound);
+ uint32 GetStewardMaleTalkSfx(int16 sound);
+ uint32 GetStewardFemaleTalkSfx(int16 sound);
+ uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
+ uint32 GetFanFemaleTalkSfx(int16 sound);
+ uint32 GetHospitalMaleTalkSfx(int16 sound);
+ uint32 GetHospitalFemaleTalkSfx(int16 sound);
+ uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
+ uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
+ uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
+ uint32 GetStudentMaleTalkSfx(int16 sound);
+ uint32 GetStudentFemaleTalkSfx(int16 sound);
+ uint32 GetCasualMaleOldTalkSfx(int16 sound);
+
+ uint32 GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound);
+ uint32 GetEightTalkSfx(int16 sound);
+ uint32 GetFrankieTalkSfx(int16 sound);
+ uint32 GetMistyTalkSfx(int16 sound);
+ uint32 GetOJGTalkSfx(int16 sound);
+ uint32 GetCatatalinaTalkSfx(int16 sound);
+ uint32 GetBomberTalkSfx(int16 sound);
+ uint32 GetSecurityGuardTalkSfx(int16 sound);
+ uint32 GetChunkyTalkSfx(int16 sound);
+
+ uint32 GetGenericMaleTalkSfx(int16 sound);
+ uint32 GetGenericFemaleTalkSfx(int16 sound);
+ // end of functions returning talk sfx
+
+ void GenerateIntegerRandomNumberTable(); /// ok
+ char *Get3DProviderName(uint8 id) const;
+ uint8 GetCDAudioDriveLetter() const;
+ int8 GetCurrent3DProviderIndex() const; /// ok
+ float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
+ float GetCollisionOneShotRatio(uint32 a, float b) const; /// ok
+ float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
+ float GetDistanceSquared(CVector *v) const; /// ok
+ int32 GetJumboTaxiFreq() const; /// ok
+ bool GetMissionAudioLoadingStatus() const; /// ok
+ char GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
+ uint8 GetNum3DProvidersAvailable() const;
+ int32 GetPedCommentSfx(CPed *ped, int32 sound);
+ void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
+ float GetVehicleDriveWheelSkidValue(uint8 a1, CAutomobile *a2, cTransmission *a3,
+ float a4); // todo
+ int32 GetVehicleNonDriveWheelSkidValue(float a1, int a2, int a3, int a4, float a5); // todo
+
+ bool HasAirBrakes(int32 model) const; /// ok
+
+ void Initialise(); /// ok
+ void InitialisePoliceRadio(); // todo
+ void InitialisePoliceRadioZones(); // todo
+ void InterrogateAudioEntities(); /// ok
+ bool IsAudioInitialised() const; /// ok
+ bool IsMissionAudioSampleFinished(); /// ok
+ bool IsMP3RadioChannelAvailable() const;
+
+ bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
+
+ void PlayLoadedMissionAudio(); /// ok
+ void PlayOneShot(int32 index, int16 sound, float vol); // todo
+ uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
+ void PlayerJustGotInCar() const; /// ok
+ void PlayerJustLeftCar() const; /// ok
+ void PostInitialiseGameSpecificSetup(); /// ok
+ void PostTerminateGameSpecificShutdown(); /// ok
+ void PreInitialiseGameSpecificSetup() const;
+ void PreloadMissionAudio(char *); // todo
+ void PreTerminateGameSpecificShutdown(); /// ok
+ /// processX - main logic of adding new sounds
+ void ProcessActiveQueues(); // todo
+ bool ProcessAirBrakes(cVehicleParams *params); /// ok
+ void ProcessAirportScriptObject(uint8 sound); /// ok
+ bool ProcessBoatEngine(cVehicleParams *params); /// ok
+ bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
+ void ProcessBridge(); /// ok
+ void ProcessBridgeMotor(); /// ok
+ void ProcessBridgeOneShots(); /// ok
+ void ProcessBridgeWarning(); /// ok
+ bool ProcessCarBombTick(cVehicleParams *params); /// ok
+ void ProcessCesna(void *); // todo requires CPlane
+ void ProcessCinemaScriptObject(uint8 sound); /// ok
+ void ProcessCrane(); // todo requires CCrane
+ void ProcessDocksScriptObject(uint8 sound); /// ok
+ bool ProcessEngineDamage(cVehicleParams *params); /// ok
+ void ProcessEntity(int32 sound); /// ok
+ void ProcessExplosions(int32 explosion); /// ok
+ void ProcessFireHydrant(); /// ok
+ void ProcessFires(int32 entity); // todo requires gFireManager
+ void ProcessFrontEnd(); /// ok
+ void ProcessGarages(); // todo requires CGarages::aGarages
+ bool ProcessHelicopter(cVehicleParams *params); /// ok
+ void ProcessHomeScriptObject(uint8 sound); /// ok
+ void ProcessJumbo(cVehicleParams *); /// ok
+ void ProcessJumboAccel(CPlane *plane); /// ok
+ void ProcessJumboDecel(CPlane *plane); /// ok
+ void ProcessJumboFlying(); /// ok
+ void ProcessJumboLanding(CPlane *plane); /// ok
+ void ProcessJumboTakeOff(CPlane *plane); /// ok
+ void ProcessJumboTaxi(); /// ok
+ void ProcessLaunderetteScriptObject(uint8 sound); /// ok
+ void ProcessLoopingScriptObject(uint8 sound); /// ok
+ void ProcessMissionAudio(); /// ok
+ void ProcessModelCarEngine(cVehicleParams *params); /// ok (check float comparisons)
+ void ProcessOneShotScriptObject(uint8 sound); /// ok
+ void ProcessPed(CPhysical *ped); /// ok
+ void ProcessPedHeadphones(cPedParams *params); /// ok
+ void ProcessPedOneShots(cPedParams *params); // todo later (weird)
+ void ProcessPhysical(int32 id); /// ok
+ void ProcessPlane(cVehicleParams *params); /// ok
+ void ProcessPlayersVehicleEngine(cVehicleParams *params,
+ CAutomobile *automobile); /// ok (check float comparisons)
+ void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo
+ void ProcessPornCinema(uint8 sound); /// ok
+ void ProcessProjectiles(); // todo requires CProjectileInfo
+ void ProcessRainOnVehicle(cVehicleParams *params); /// ok
+ void ProcessReverb() const; /// ok
+ bool ProcessReverseGear(cVehicleParams *a2); /// ok
+ void ProcessSawMillScriptObject(uint8 sound); /// ok
+ void ProcessScriptObject(int32 id); /// ok
+ void ProcessShopScriptObject(uint8 sound); /// ok
+ void ProcessSpecial(); /// ok
+ bool ProcessTrainNoise(cVehicleParams *params); /// ok
+ void ProcessVehicle(CVehicle *); // todo
+ bool ProcessVehicleDoors(cVehicleParams *params); /// ok
+ // bool ProcessVehicleEngine(void *);
+ // void ProcessVehicleHorn(cVehicleParams *params);
+ // void ProcessVehicleOneShots(void *);
+ bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok
+ bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok
+ // void ProcessVehicleSirenOrAlarm(void *);
+ // void ProcessVehicleSkidding(void *);
+ void ProcessWaterCannon(int32); // todo
+ void ProcessWeather(int32 id); /// ok
+ bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
+ void ProcessWorkShopScriptObject(uint8 sound); /// ok
+
+ int32 RandomDisplacement(uint32 seed) const;
+ void ReacquireDigitalHandle() const;
+ void ReleaseDigitalHandle() const;
+ int32 ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6,
+ float a7); // todo
+ int32 ReportCrime(int a2, int *a3); // todo
+ void ResetAudioLogicTimers(int32 timer); /// ok
+ void ResetPoliceRadio();
+ void ResetTimers(unsigned int a2); // todo
+
+ void Service(); // todo
+ void ServiceCollisions(); // todo
+ void ServicePoliceRadio(); // todo
+ void ServicePoliceRadioChannel(int a2); // todo
+ void ServiceSoundEffects(); // todo
+ void SetDynamicAcousticModelingStatus(bool status);
+ void SetEffectsFadeVolume(uint8 volume) const;
+ void SetEffectsMasterVolume(uint8 volume) const;
+ void SetEntityStatus(int32 id, bool status);
+ uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(int32); // todo
+ void SetMissionAudioLocation(float x, float y, float z);
+ void SetMissionScriptPoliceAudio(int32 sfx) const;
+ void SetMonoMode(uint8); // todo
+ void SetMusicFadeVolume(uint8 volume) const;
+ void SetMusicMasterVolume(uint8 volume) const;
+ void SetSpeakerConfig(int32 conf) const;
+ void SetUpLoopingCollisionSound(int a2, int a3); // todo
+ void SetUpOneShotCollisionSound(int a2); // todo
+ void SetupCrimeReport(); // todo
+ bool SetupJumboEngineSound(uint8, int32); // todo
+ bool SetupJumboFlySound(uint8 emittingVol); /// ok
+ bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
+ bool SetupJumboTaxiSound(uint8 vol); /// ok
+ bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
+ void SetupPedComments(cPedParams *params, uint32 sound); /// ok
+ void SetupSuspectLastSeenReport(); // todo
+
+ void Terminate();
+ void TranslateEntity(CVector *v1, CVector *v2) const; /// ok
+
+ void UpdateGasPedalAudio(CAutomobile *automobile); // todo hook
+ bool UsesReverseWarning(int32 model) const;
+ bool UsesSiren(int32 model) const;
+ bool UsesSirenSwitching(int32 model) const;
+};
+
+static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
+
+extern cAudioManager &AudioManager;
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 076c1178..08ec3bc5 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -31,7 +31,7 @@ cDMAudio::Service(void)
int32
cDMAudio::CreateEntity(eAudioType type, void *UID)
{
- return AudioManager.CreateEntity(type, UID);
+ return AudioManager.CreateEntity(type, (CPhysical *)UID);
}
void
@@ -82,7 +82,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
- AudioManager.SetEffectsFadeVol(vol);
+ AudioManager.SetEffectsFadeVolume(vol);
}
void
@@ -91,7 +91,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
- AudioManager.SetMusicFadeVol(vol);
+ AudioManager.SetMusicFadeVolume(vol);
}
uint8
@@ -169,13 +169,13 @@ cDMAudio::IsAudioInitialised(void)
void
cDMAudio::ReportCrime(eCrimeType crime, CVector const &pos)
{
- AudioManager.ReportCrime(crime, pos);
+ AudioManager.ReportCrime(crime, &pos);
}
int32
cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
{
- int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
+ int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
if ( AEHANDLE_IS_OK(audioEntity) )
AudioManager.SetEntityStatus(audioEntity, true);
@@ -192,7 +192,7 @@ cDMAudio::DestroyLoopingScriptObject(int32 audioEntity)
void
cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
{
- int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
+ int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
if ( AEHANDLE_IS_OK(audioEntity) )
{