diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-07-29 00:59:20 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-07-29 00:59:20 +0200 |
commit | b77d93ba4a7a7bc0205d40aa7e716545962fe355 (patch) | |
tree | 9e373280ced5a538e354d56d7b4de9c955342262 /src/audio | |
parent | Merge branch 'miami' into lcs (diff) | |
parent | Reverse unused audio functions (diff) | |
download | re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar.gz re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar.bz2 re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar.lz re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar.xz re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.tar.zst re3-b77d93ba4a7a7bc0205d40aa7e716545962fe355.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioLogic.cpp | 41 | ||||
-rw-r--r-- | src/audio/AudioManager.cpp | 35 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 11 | ||||
-rw-r--r-- | src/audio/DMAudio.cpp | 28 | ||||
-rw-r--r-- | src/audio/DMAudio.h | 8 |
5 files changed, 112 insertions, 11 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 2a83139e..dfce9b71 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -5418,7 +5418,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, uint16 sound) case MI_SPECIAL18: case MI_SPECIAL19: case MI_SPECIAL20: - case MI_SPECIAL21: //GetSpecialCharacterTalkSfx(ped, sound) + case MI_SPECIAL21: //return GetSpecialCharacterTalkSfx(ped, ped->GetModelIndex(), sound); return NO_SAMPLE; default: return GetGenericMaleTalkSfx(ped, sound); } @@ -7811,6 +7811,28 @@ cAudioManager::GetWMYJGTalkSfx(CPed *ped, uint16 sound) } */ +uint32 +cAudioManager::GetSpecialCharacterTalkSfx(CPed *ped, int32 model, uint16 sound) +{ + return NO_SAMPLE; +} + +void +cAudioManager::DebugPlayPedComment(int32 sound) +{ + tPedComment pedComment; + + pedComment.m_nSampleIndex = sound; + pedComment.m_nProcess = 10; + pedComment.m_nEntityIndex = 0; + pedComment.m_fDistance = 0.0f; + pedComment.m_bVolume = 99; + + pedComment.m_vecPos = CWorld::Players[0].m_pPed->GetPosition(); + + m_sPedComments.Add(&pedComment); +} + void cPedComments::Add(tPedComment *com) { @@ -11298,6 +11320,23 @@ FindMissionAudioSfx(const char *name) return NO_SAMPLE; } +const char * +cAudioManager::GetMissionAudioLoadedLabel(uint8 slot) +{ + if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS && m_sMissionAudio.m_nSampleIndex[slot] != NO_SAMPLE) { + for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) { + if (m_sMissionAudio.m_nSampleIndex[slot] == MissionAudioNameSfxAssoc[i].m_nId) + return MissionAudioNameSfxAssoc[i].m_pName; + } + } + +#ifdef THIS_IS_STUPID + return MissionAudioNameSfxAssoc[0].m_pName; // yeah this is dumb +#else + return ""; +#endif +} + bool8 cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission) { diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 398224f0..3397fc29 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -160,6 +160,14 @@ cAudioManager::DestroyEntity(int32 id) } } +bool8 +cAudioManager::GetEntityStatus(int32 id) +{ + if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) + return m_asAudioEntities[id].m_bStatus; + return FALSE; +} + void cAudioManager::SetEntityStatus(int32 id, bool8 status) { @@ -167,6 +175,14 @@ cAudioManager::SetEntityStatus(int32 id, bool8 status) m_asAudioEntities[id].m_bStatus = status; } +void * +cAudioManager::GetEntityPointer(int32 id) +{ + if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) + return m_asAudioEntities[id].m_pEntity; + return NULL; +} + void cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol) { @@ -248,9 +264,9 @@ cAudioManager::SetMusicFadeVol(uint8 volume) } void -cAudioManager::SetMonoMode(bool8 mono) +cAudioManager::SetOutputMode(bool8 surround) { - SampleManager.SetMonoMode(mono); + // on ps2 this calls another method of cAudioManager to set DTS mode on or off } void @@ -524,11 +540,22 @@ cAudioManager::TranslateEntity(Const CVector *in, CVector *out) *out = MultiplyInverse(TheCamera.GetMatrix(), *in); } +static uint8 PanTable[64] = { 0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, + 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63}; + +int32 +cAudioManager::ComputeFrontRearMix(float dist, CVector *vec) +{ + int32 index = Min(63, Abs(int32(vec->y / (dist / 64.f)))); + + if (vec->y > 0.f) + return Max(0, 63 - PanTable[index]); + return Min(127, PanTable[index] + 63); +} + int32 cAudioManager::ComputePan(float dist, CVector *vec) { - const uint8 PanTable[64] = { 0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, - 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63}; int32 index = Min(63, Abs(int32(vec->x / (dist / 64.f)))); if (vec->x > 0.f) diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 932e2ecb..0eb0805c 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -51,7 +51,7 @@ public: eAudioType m_nType; void *m_pEntity; bool8 m_bIsUsed; - uint8 m_bStatus; + bool8 m_bStatus; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS]; uint8 m_AudioEvents; @@ -255,14 +255,16 @@ public: void Service(); int32 CreateEntity(eAudioType type, void *entity); void DestroyEntity(int32 id); // inlined in vc + bool8 GetEntityStatus(int32 id); void SetEntityStatus(int32 id, bool8 status); + void *GetEntityPointer(int32 id); void PlayOneShot(int32 index, uint16 sound, float vol); void SetEffectsMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume); void SetMP3BoostVolume(uint8 volume); void SetEffectsFadeVol(uint8 volume); void SetMusicFadeVol(uint8 volume); - void SetMonoMode(bool8 mono); + void SetOutputMode(bool8 surround); void ResetTimers(uint32 time); void DestroyAllGameCreatedEntities(); @@ -285,6 +287,7 @@ public: void ServiceSoundEffects(); uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance); void TranslateEntity(Const CVector *v1, CVector *v2); + int32 ComputeFrontRearMix(float, CVector *); int32 ComputePan(float, CVector *); uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier); int32 RandomDisplacement(uint32 seed); @@ -479,6 +482,9 @@ public: uint32 GetHMYAPTalkSfx(CPed *ped, uint16 sound); uint32 GetWFYJGTalkSfx(CPed *ped, uint16 sound); uint32 GetWMYJGTalkSfx(CPed *ped, uint16 sound); + uint32 GetSpecialCharacterTalkSfx(CPed *ped, int32 model, uint16 sound); + + void DebugPlayPedComment(int32 sound); // particles void ProcessExplosions(int32 explosion); @@ -508,6 +514,7 @@ public: #endif // mission audio + const char *GetMissionAudioLoadedLabel(uint8 slot); bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission); void PreloadMissionAudio(uint8 slot, Const char *name); uint8 GetMissionAudioLoadingStatus(uint8 slot); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index bc77361f..f5b08c71 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -38,6 +38,12 @@ cDMAudio::DestroyEntity(int32 audioEntity) AudioManager.DestroyEntity(audioEntity); } +bool8 +cDMAudio::GetEntityStatus(int32 audioEntity) +{ + return AudioManager.GetEntityStatus(audioEntity); +} + void cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status) { @@ -57,9 +63,9 @@ cDMAudio::DestroyAllGameCreatedEntities(void) } void -cDMAudio::SetMonoMode(bool8 mono) +cDMAudio::SetOutputMode(bool8 surround) { - AudioManager.SetMonoMode(mono); + return AudioManager.SetOutputMode(surround); } void @@ -185,6 +191,12 @@ cDMAudio::IsAudioInitialised(void) } void +cDMAudio::ResetPoliceRadio() +{ + AudioManager.ResetPoliceRadio(); +} + +void cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) { AudioManager.ReportCrime(crime, pos); @@ -310,6 +322,12 @@ cDMAudio::PlayLoadedMissionAudio(uint8 slot) } bool8 +cDMAudio::IsMissionAudioSamplePlaying(uint8 slot) +{ + return AudioManager.IsMissionAudioSamplePlaying(slot); +} + +bool8 cDMAudio::IsMissionAudioSampleFinished(uint8 slot) { return AudioManager.IsMissionAudioSampleFinished(slot); @@ -321,6 +339,12 @@ cDMAudio::ClearMissionAudio(uint8 slot) AudioManager.ClearMissionAudio(slot); } +const char * +cDMAudio::GetMissionAudioLoadedLabel(uint8 slot) +{ + return AudioManager.GetMissionAudioLoadedLabel(slot); +} + uint8 cDMAudio::GetRadioInCar(void) { diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 5b684fd3..110cb2db 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -25,11 +25,12 @@ public: int32 CreateEntity(eAudioType type, void *UID); void DestroyEntity(int32 audioEntity); + bool8 GetEntityStatus(int32 audioEntity); void SetEntityStatus(int32 audioEntity, bool8 status); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); void DestroyAllGameCreatedEntities(void); - void SetMonoMode(bool8 mono); + void SetOutputMode(bool8 surround); void SetMP3BoostVolume(uint8 volume); void SetEffectsMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume); @@ -57,7 +58,8 @@ public: char GetCDAudioDriveLetter(void); bool8 IsAudioInitialised(void); - + + void ResetPoliceRadio(); void ReportCrime(eCrimeType crime, CVector const &pos); int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject); @@ -85,8 +87,10 @@ public: uint8 GetMissionAudioLoadingStatus(uint8 slot); void SetMissionAudioLocation(uint8 slot, float x, float y, float z); void PlayLoadedMissionAudio(uint8 slot); + bool8 IsMissionAudioSamplePlaying(uint8 slot); bool8 IsMissionAudioSampleFinished(uint8 slot); void ClearMissionAudio(uint8 slot); + const char *GetMissionAudioLoadedLabel(uint8 slot); uint8 GetRadioInCar(void); void SetRadioInCar(uint32 radio); |