summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-07-27 21:29:40 +0200
committerSergeanur <s.anureev@yandex.ua>2021-07-27 21:29:40 +0200
commit7aa8d7c073106f786d643e51e8e21d1b58806989 (patch)
tree9302e6a7d65046d2363a7a3b470646ed5118af74 /src/audio
parentSort AudioCollision functions into original order (diff)
downloadre3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar.gz
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar.bz2
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar.lz
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar.xz
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.tar.zst
re3-7aa8d7c073106f786d643e51e8e21d1b58806989.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioCollision.cpp2
-rw-r--r--src/audio/AudioManager.cpp66
-rw-r--r--src/audio/AudioManager.h44
3 files changed, 63 insertions, 49 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index 5379ac7a..26bbb290 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -349,8 +349,6 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio
float
cAudioManager::GetCollisionOneShotRatio(int32 a, float b)
{
- float result;
-
switch(a) {
case SURFACE_DEFAULT:
case SURFACE_TARMAC:
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 131704dc..b0b3f49d 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -218,39 +218,39 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
}
void
-cAudioManager::SetMP3BoostVolume(uint8 volume) const
+cAudioManager::SetEffectsMasterVolume(uint8 volume)
{
- SampleManager.SetMP3BoostVolume(volume);
+ SampleManager.SetEffectsMasterVolume(volume);
}
void
-cAudioManager::SetEffectsMasterVolume(uint8 volume) const
+cAudioManager::SetMusicMasterVolume(uint8 volume)
{
- SampleManager.SetEffectsMasterVolume(volume);
+ SampleManager.SetMusicMasterVolume(volume);
}
void
-cAudioManager::SetMusicMasterVolume(uint8 volume) const
+cAudioManager::SetMP3BoostVolume(uint8 volume)
{
- SampleManager.SetMusicMasterVolume(volume);
+ SampleManager.SetMP3BoostVolume(volume);
}
void
-cAudioManager::SetEffectsFadeVol(uint8 volume) const
+cAudioManager::SetEffectsFadeVol(uint8 volume)
{
SampleManager.SetEffectsFadeVolume(volume);
}
void
-cAudioManager::SetMonoMode(bool8 mono)
+cAudioManager::SetMusicFadeVol(uint8 volume)
{
- SampleManager.SetMonoMode(mono);
+ SampleManager.SetMusicFadeVolume(volume);
}
void
-cAudioManager::SetMusicFadeVol(uint8 volume) const
+cAudioManager::SetMonoMode(bool8 mono)
{
- SampleManager.SetMusicFadeVolume(volume);
+ SampleManager.SetMonoMode(mono);
}
void
@@ -317,8 +317,10 @@ cAudioManager::DestroyAllGameCreatedEntities()
}
}
+#ifdef GTA_PC
+
uint8
-cAudioManager::GetNum3DProvidersAvailable() const
+cAudioManager::GetNum3DProvidersAvailable()
{
if (m_bIsInitialised)
return SampleManager.GetNum3DProvidersAvailable();
@@ -326,7 +328,7 @@ cAudioManager::GetNum3DProvidersAvailable() const
}
char *
-cAudioManager::Get3DProviderName(uint8 id) const
+cAudioManager::Get3DProviderName(uint8 id)
{
if (!m_bIsInitialised)
return nil;
@@ -341,7 +343,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
}
int8
-cAudioManager::GetCurrent3DProviderIndex() const
+cAudioManager::GetCurrent3DProviderIndex()
{
if (m_bIsInitialised)
return SampleManager.GetCurrent3DProviderIndex();
@@ -350,7 +352,7 @@ cAudioManager::GetCurrent3DProviderIndex() const
}
int8
-cAudioManager::AutoDetect3DProviders() const
+cAudioManager::AutoDetect3DProviders()
{
if (m_bIsInitialised)
return SampleManager.AutoDetect3DProviders();
@@ -382,13 +384,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
}
void
-cAudioManager::SetSpeakerConfig(int32 conf) const
+cAudioManager::SetSpeakerConfig(int32 conf)
{
SampleManager.SetSpeakerConfig(conf);
}
bool8
-cAudioManager::IsMP3RadioChannelAvailable() const
+cAudioManager::IsMP3RadioChannelAvailable()
{
if (m_bIsInitialised)
return SampleManager.IsMP3RadioChannelAvailable();
@@ -397,7 +399,7 @@ cAudioManager::IsMP3RadioChannelAvailable() const
}
void
-cAudioManager::ReleaseDigitalHandle() const
+cAudioManager::ReleaseDigitalHandle()
{
if (m_bIsInitialised) {
SampleManager.ReleaseDigitalHandle();
@@ -405,7 +407,7 @@ cAudioManager::ReleaseDigitalHandle() const
}
void
-cAudioManager::ReacquireDigitalHandle() const
+cAudioManager::ReacquireDigitalHandle()
{
if (m_bIsInitialised) {
SampleManager.ReacquireDigitalHandle();
@@ -419,24 +421,26 @@ cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
}
bool8
-cAudioManager::CheckForAnAudioFileOnCD() const
+cAudioManager::CheckForAnAudioFileOnCD()
{
return SampleManager.CheckForAnAudioFileOnCD();
}
char
-cAudioManager::GetCDAudioDriveLetter() const
+cAudioManager::GetCDAudioDriveLetter()
{
if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
return '\0';
}
bool8
-cAudioManager::IsAudioInitialised() const
+cAudioManager::IsAudioInitialised()
{
return m_bIsInitialised;
}
+#endif // GTA_PC
+
void
cAudioManager::ServiceSoundEffects()
{
@@ -487,7 +491,7 @@ cAudioManager::ServiceSoundEffects()
}
uint8
-cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const
+cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance)
{
float newSoundIntensity;
float newEmittingVolume;
@@ -505,7 +509,7 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
}
void
-cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const
+cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
{
*out = MultiplyInverse(TheCamera.GetMatrix(), *in);
}
@@ -523,7 +527,7 @@ cAudioManager::ComputePan(float dist, CVector *vec)
}
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;
if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
@@ -540,7 +544,7 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
}
int32
-cAudioManager::RandomDisplacement(uint32 seed) const
+cAudioManager::RandomDisplacement(uint32 seed)
{
int32 value;
@@ -614,6 +618,7 @@ cAudioManager::AddSampleToRequestedQueue()
AddReflectionsToRequestedQueue();
}
}
+
void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
@@ -631,6 +636,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
}
+#ifdef GTA_PC
void
cAudioManager::AddReflectionsToRequestedQueue()
{
@@ -768,6 +774,7 @@ cAudioManager::UpdateReflections()
m_afReflectionsDistances[7] = 100.0f;
}
}
+#endif // GTA_PC
void
cAudioManager::AddReleasingSounds()
@@ -1064,6 +1071,13 @@ cAudioManager::ClearActiveSamples()
}
void
+cAudioManager::LoadBankIfNecessary(uint8 bank)
+{
+ if(!SampleManager.IsSampleBankLoaded(bank))
+ SampleManager.LoadSampleBank(bank);
+}
+
+void
cAudioManager::GenerateIntegerRandomNumberTable()
{
for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index ea5ebf68..2bd1e29e 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -22,8 +22,8 @@ public:
#ifndef GTA_PS2
int32 m_nLoopStart;
int32 m_nLoopEnd;
-#endif
uint8 m_nEmittingVolume;
+#endif
float m_fSpeedMultiplier;
float m_fSoundIntensity;
bool8 m_bReleasingSoundFlag;
@@ -267,13 +267,13 @@ public:
void AgeCrimes(); // inlined in vc
void CalculateDistance(bool8 &condition, float dist);
- bool8 CheckForAnAudioFileOnCD() const;
+ bool8 CheckForAnAudioFileOnCD();
void ClearActiveSamples();
void ClearMissionAudio(uint8 slot); // 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 *);
- uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
+ uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance);
int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities();
@@ -380,10 +380,10 @@ public:
// end of functions returning talk sfx
void GenerateIntegerRandomNumberTable();
- char *Get3DProviderName(uint8 id) const;
- char GetCDAudioDriveLetter() const;
- int8 GetCurrent3DProviderIndex() const;
- int8 AutoDetect3DProviders() const;
+ char *Get3DProviderName(uint8 id);
+ char GetCDAudioDriveLetter();
+ int8 GetCurrent3DProviderIndex();
+ int8 AutoDetect3DProviders();
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used
float GetCollisionOneShotRatio(int32 a, float b);
float GetCollisionRatio(float a, float b, float c, float d); // inlined in vc
@@ -391,7 +391,7 @@ public:
int32 GetJumboTaxiFreq() const; // inlined in vc
uint8 GetMissionAudioLoadingStatus(uint8 slot) const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
- uint8 GetNum3DProvidersAvailable() const;
+ uint8 GetNum3DProvidersAvailable();
uint32 GetPedCommentSfx(CPed *ped, int32 sound);
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, float gasPedalAudio, cTransmission *transmission,
@@ -404,9 +404,11 @@ public:
void InitialisePoliceRadio();
void InitialisePoliceRadioZones();
void InterrogateAudioEntities(); // inlined
- bool8 IsAudioInitialised() const;
+ bool8 IsAudioInitialised();
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;
@@ -486,9 +488,9 @@ public:
void ProcessEscalators();
void ProcessExtraSounds();
- int32 RandomDisplacement(uint32 seed) const;
- void ReacquireDigitalHandle() const;
- void ReleaseDigitalHandle() const;
+ int32 RandomDisplacement(uint32 seed);
+ void ReacquireDigitalHandle();
+ void ReleaseDigitalHandle();
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2);
void ReportCrime(eCrimeType crime, const CVector &pos);
void ResetAudioLogicTimers(uint32 timer);
@@ -502,17 +504,17 @@ public:
void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool8 status);
- void SetEffectsFadeVol(uint8 volume) const;
- void SetEffectsMasterVolume(uint8 volume) const;
- void SetMP3BoostVolume(uint8 volume) const;
+ void SetEffectsFadeVol(uint8 volume);
+ void SetEffectsMasterVolume(uint8 volume);
+ void SetMP3BoostVolume(uint8 volume);
void SetEntityStatus(int32 id, bool8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const; // inlined and optimized
void SetMonoMode(bool8 mono);
- void SetMusicFadeVol(uint8 volume) const;
- void SetMusicMasterVolume(uint8 volume) const;
- void SetSpeakerConfig(int32 conf) const;
+ void SetMusicFadeVol(uint8 volume);
+ void SetMusicMasterVolume(uint8 volume);
+ void SetSpeakerConfig(int32 conf);
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
void SetUpOneShotCollisionSound(const cAudioCollision &col);
bool8 SetupCrimeReport();
@@ -525,7 +527,7 @@ public:
void SetupSuspectLastSeenReport();
void Terminate();
- void TranslateEntity(Const CVector *v1, CVector *v2) const;
+ void TranslateEntity(Const CVector *v1, CVector *v2);
void UpdateGasPedalAudio(CVehicle *veh, int vehType);
void UpdateReflections();