AudioManager.cpp reordering

This commit is contained in:
Sergeanur 2021-07-27 22:29:40 +03:00
parent 782d38c6b7
commit 7aa8d7c073
3 changed files with 67 additions and 53 deletions

View File

@ -349,8 +349,6 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio
float float
cAudioManager::GetCollisionOneShotRatio(int32 a, float b) cAudioManager::GetCollisionOneShotRatio(int32 a, float b)
{ {
float result;
switch(a) { switch(a) {
case SURFACE_DEFAULT: case SURFACE_DEFAULT:
case SURFACE_TARMAC: case SURFACE_TARMAC:

View File

@ -218,41 +218,41 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
} }
void void
cAudioManager::SetMP3BoostVolume(uint8 volume) const cAudioManager::SetEffectsMasterVolume(uint8 volume)
{
SampleManager.SetMP3BoostVolume(volume);
}
void
cAudioManager::SetEffectsMasterVolume(uint8 volume) const
{ {
SampleManager.SetEffectsMasterVolume(volume); SampleManager.SetEffectsMasterVolume(volume);
} }
void void
cAudioManager::SetMusicMasterVolume(uint8 volume) const cAudioManager::SetMusicMasterVolume(uint8 volume)
{ {
SampleManager.SetMusicMasterVolume(volume); SampleManager.SetMusicMasterVolume(volume);
} }
void void
cAudioManager::SetEffectsFadeVol(uint8 volume) const cAudioManager::SetMP3BoostVolume(uint8 volume)
{
SampleManager.SetMP3BoostVolume(volume);
}
void
cAudioManager::SetEffectsFadeVol(uint8 volume)
{ {
SampleManager.SetEffectsFadeVolume(volume); SampleManager.SetEffectsFadeVolume(volume);
} }
void
cAudioManager::SetMusicFadeVol(uint8 volume)
{
SampleManager.SetMusicFadeVolume(volume);
}
void void
cAudioManager::SetMonoMode(bool8 mono) cAudioManager::SetMonoMode(bool8 mono)
{ {
SampleManager.SetMonoMode(mono); SampleManager.SetMonoMode(mono);
} }
void
cAudioManager::SetMusicFadeVol(uint8 volume) const
{
SampleManager.SetMusicFadeVolume(volume);
}
void void
cAudioManager::ResetTimers(uint32 time) cAudioManager::ResetTimers(uint32 time)
{ {
@ -317,8 +317,10 @@ cAudioManager::DestroyAllGameCreatedEntities()
} }
} }
#ifdef GTA_PC
uint8 uint8
cAudioManager::GetNum3DProvidersAvailable() const cAudioManager::GetNum3DProvidersAvailable()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.GetNum3DProvidersAvailable(); return SampleManager.GetNum3DProvidersAvailable();
@ -326,7 +328,7 @@ cAudioManager::GetNum3DProvidersAvailable() const
} }
char * char *
cAudioManager::Get3DProviderName(uint8 id) const cAudioManager::Get3DProviderName(uint8 id)
{ {
if (!m_bIsInitialised) if (!m_bIsInitialised)
return nil; return nil;
@ -341,7 +343,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
} }
int8 int8
cAudioManager::GetCurrent3DProviderIndex() const cAudioManager::GetCurrent3DProviderIndex()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.GetCurrent3DProviderIndex(); return SampleManager.GetCurrent3DProviderIndex();
@ -350,7 +352,7 @@ cAudioManager::GetCurrent3DProviderIndex() const
} }
int8 int8
cAudioManager::AutoDetect3DProviders() const cAudioManager::AutoDetect3DProviders()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.AutoDetect3DProviders(); return SampleManager.AutoDetect3DProviders();
@ -382,13 +384,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
} }
void void
cAudioManager::SetSpeakerConfig(int32 conf) const cAudioManager::SetSpeakerConfig(int32 conf)
{ {
SampleManager.SetSpeakerConfig(conf); SampleManager.SetSpeakerConfig(conf);
} }
bool8 bool8
cAudioManager::IsMP3RadioChannelAvailable() const cAudioManager::IsMP3RadioChannelAvailable()
{ {
if (m_bIsInitialised) if (m_bIsInitialised)
return SampleManager.IsMP3RadioChannelAvailable(); return SampleManager.IsMP3RadioChannelAvailable();
@ -397,7 +399,7 @@ cAudioManager::IsMP3RadioChannelAvailable() const
} }
void void
cAudioManager::ReleaseDigitalHandle() const cAudioManager::ReleaseDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised) {
SampleManager.ReleaseDigitalHandle(); SampleManager.ReleaseDigitalHandle();
@ -405,7 +407,7 @@ cAudioManager::ReleaseDigitalHandle() const
} }
void void
cAudioManager::ReacquireDigitalHandle() const cAudioManager::ReacquireDigitalHandle()
{ {
if (m_bIsInitialised) { if (m_bIsInitialised) {
SampleManager.ReacquireDigitalHandle(); SampleManager.ReacquireDigitalHandle();
@ -419,24 +421,26 @@ cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
} }
bool8 bool8
cAudioManager::CheckForAnAudioFileOnCD() const cAudioManager::CheckForAnAudioFileOnCD()
{ {
return SampleManager.CheckForAnAudioFileOnCD(); return SampleManager.CheckForAnAudioFileOnCD();
} }
char char
cAudioManager::GetCDAudioDriveLetter() const cAudioManager::GetCDAudioDriveLetter()
{ {
if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter(); if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
return '\0'; return '\0';
} }
bool8 bool8
cAudioManager::IsAudioInitialised() const cAudioManager::IsAudioInitialised()
{ {
return m_bIsInitialised; return m_bIsInitialised;
} }
#endif // GTA_PC
void void
cAudioManager::ServiceSoundEffects() cAudioManager::ServiceSoundEffects()
{ {
@ -487,7 +491,7 @@ cAudioManager::ServiceSoundEffects()
} }
uint8 uint8
cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance)
{ {
float newSoundIntensity; float newSoundIntensity;
float newEmittingVolume; float newEmittingVolume;
@ -505,7 +509,7 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
} }
void void
cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
{ {
*out = MultiplyInverse(TheCamera.GetMatrix(), *in); *out = MultiplyInverse(TheCamera.GetMatrix(), *in);
} }
@ -523,7 +527,7 @@ cAudioManager::ComputePan(float dist, CVector *vec)
} }
uint32 uint32
cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier)
{ {
uint32 newFreq = oldFreq; uint32 newFreq = oldFreq;
if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) { if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
@ -540,7 +544,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
} }
int32 int32
cAudioManager::RandomDisplacement(uint32 seed) const cAudioManager::RandomDisplacement(uint32 seed)
{ {
int32 value; int32 value;
@ -614,6 +618,7 @@ cAudioManager::AddSampleToRequestedQueue()
AddReflectionsToRequestedQueue(); AddReflectionsToRequestedQueue();
} }
} }
void void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{ {
@ -631,6 +636,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample; m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
} }
#ifdef GTA_PC
void void
cAudioManager::AddReflectionsToRequestedQueue() cAudioManager::AddReflectionsToRequestedQueue()
{ {
@ -768,6 +774,7 @@ cAudioManager::UpdateReflections()
m_afReflectionsDistances[7] = 100.0f; m_afReflectionsDistances[7] = 100.0f;
} }
} }
#endif // GTA_PC
void void
cAudioManager::AddReleasingSounds() cAudioManager::AddReleasingSounds()
@ -1063,6 +1070,13 @@ cAudioManager::ClearActiveSamples()
} }
} }
void
cAudioManager::LoadBankIfNecessary(uint8 bank)
{
if(!SampleManager.IsSampleBankLoaded(bank))
SampleManager.LoadSampleBank(bank);
}
void void
cAudioManager::GenerateIntegerRandomNumberTable() cAudioManager::GenerateIntegerRandomNumberTable()
{ {

View File

@ -22,8 +22,8 @@ public:
#ifndef GTA_PS2 #ifndef GTA_PS2
int32 m_nLoopStart; int32 m_nLoopStart;
int32 m_nLoopEnd; int32 m_nLoopEnd;
#endif
uint8 m_nEmittingVolume; uint8 m_nEmittingVolume;
#endif
float m_fSpeedMultiplier; float m_fSpeedMultiplier;
float m_fSoundIntensity; float m_fSoundIntensity;
bool8 m_bReleasingSoundFlag; bool8 m_bReleasingSoundFlag;
@ -267,13 +267,13 @@ public:
void AgeCrimes(); // inlined in vc void AgeCrimes(); // inlined in vc
void CalculateDistance(bool8 &condition, float dist); void CalculateDistance(bool8 &condition, float dist);
bool8 CheckForAnAudioFileOnCD() const; bool8 CheckForAnAudioFileOnCD();
void ClearActiveSamples(); void ClearActiveSamples();
void ClearMissionAudio(uint8 slot); // inlined in vc void ClearMissionAudio(uint8 slot); // inlined in vc
void ClearRequestedQueue(); // inlined in vc void ClearRequestedQueue(); // inlined in vc
uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const; uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier);
int32 ComputePan(float, CVector *); int32 ComputePan(float, CVector *);
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance);
int32 CreateEntity(eAudioType type, void *entity); int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities(); void DestroyAllGameCreatedEntities();
@ -380,10 +380,10 @@ public:
// end of functions returning talk sfx // end of functions returning talk sfx
void GenerateIntegerRandomNumberTable(); void GenerateIntegerRandomNumberTable();
char *Get3DProviderName(uint8 id) const; char *Get3DProviderName(uint8 id);
char GetCDAudioDriveLetter() const; char GetCDAudioDriveLetter();
int8 GetCurrent3DProviderIndex() const; int8 GetCurrent3DProviderIndex();
int8 AutoDetect3DProviders() const; int8 AutoDetect3DProviders();
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used
float GetCollisionOneShotRatio(int32 a, float b); float GetCollisionOneShotRatio(int32 a, float b);
float GetCollisionRatio(float a, float b, float c, float d); // inlined in vc float GetCollisionRatio(float a, float b, float c, float d); // inlined in vc
@ -391,7 +391,7 @@ public:
int32 GetJumboTaxiFreq() const; // inlined in vc int32 GetJumboTaxiFreq() const; // inlined in vc
uint8 GetMissionAudioLoadingStatus(uint8 slot) const; uint8 GetMissionAudioLoadingStatus(uint8 slot) const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const; uint8 GetNum3DProvidersAvailable();
uint32 GetPedCommentSfx(CPed *ped, int32 sound); uint32 GetPedCommentSfx(CPed *ped, int32 sound);
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const; void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, float gasPedalAudio, cTransmission *transmission, float GetVehicleDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, float gasPedalAudio, cTransmission *transmission,
@ -404,9 +404,11 @@ public:
void InitialisePoliceRadio(); void InitialisePoliceRadio();
void InitialisePoliceRadioZones(); void InitialisePoliceRadioZones();
void InterrogateAudioEntities(); // inlined void InterrogateAudioEntities(); // inlined
bool8 IsAudioInitialised() const; bool8 IsAudioInitialised();
bool8 IsMissionAudioSampleFinished(uint8 slot); bool8 IsMissionAudioSampleFinished(uint8 slot);
bool8 IsMP3RadioChannelAvailable() const; bool8 IsMP3RadioChannelAvailable();
void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
@ -486,9 +488,9 @@ public:
void ProcessEscalators(); void ProcessEscalators();
void ProcessExtraSounds(); void ProcessExtraSounds();
int32 RandomDisplacement(uint32 seed) const; int32 RandomDisplacement(uint32 seed);
void ReacquireDigitalHandle() const; void ReacquireDigitalHandle();
void ReleaseDigitalHandle() const; void ReleaseDigitalHandle();
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2); void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2);
void ReportCrime(eCrimeType crime, const CVector &pos); void ReportCrime(eCrimeType crime, const CVector &pos);
void ResetAudioLogicTimers(uint32 timer); void ResetAudioLogicTimers(uint32 timer);
@ -502,17 +504,17 @@ public:
void ServiceSoundEffects(); void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which); int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool8 status); void SetDynamicAcousticModelingStatus(bool8 status);
void SetEffectsFadeVol(uint8 volume) const; void SetEffectsFadeVol(uint8 volume);
void SetEffectsMasterVolume(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume);
void SetMP3BoostVolume(uint8 volume) const; void SetMP3BoostVolume(uint8 volume);
void SetEntityStatus(int32 id, bool8 status); void SetEntityStatus(int32 id, bool8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision); uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(uint8 slot, float x, float y, float z); void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const; // inlined and optimized void SetMissionScriptPoliceAudio(int32 sfx) const; // inlined and optimized
void SetMonoMode(bool8 mono); void SetMonoMode(bool8 mono);
void SetMusicFadeVol(uint8 volume) const; void SetMusicFadeVol(uint8 volume);
void SetMusicMasterVolume(uint8 volume) const; void SetMusicMasterVolume(uint8 volume);
void SetSpeakerConfig(int32 conf) const; void SetSpeakerConfig(int32 conf);
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter); void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
void SetUpOneShotCollisionSound(const cAudioCollision &col); void SetUpOneShotCollisionSound(const cAudioCollision &col);
bool8 SetupCrimeReport(); bool8 SetupCrimeReport();
@ -525,7 +527,7 @@ public:
void SetupSuspectLastSeenReport(); void SetupSuspectLastSeenReport();
void Terminate(); void Terminate();
void TranslateEntity(Const CVector *v1, CVector *v2) const; void TranslateEntity(Const CVector *v1, CVector *v2);
void UpdateGasPedalAudio(CVehicle *veh, int vehType); void UpdateGasPedalAudio(CVehicle *veh, int vehType);
void UpdateReflections(); void UpdateReflections();