Merge branch 'miami' into lcs

# Conflicts:
#	src/audio/AudioLogic.cpp
This commit is contained in:
Sergeanur 2021-07-29 01:59:20 +03:00
commit b77d93ba4a
5 changed files with 112 additions and 11 deletions

View file

@ -5418,7 +5418,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, uint16 sound)
case MI_SPECIAL18: case MI_SPECIAL18:
case MI_SPECIAL19: case MI_SPECIAL19:
case MI_SPECIAL20: case MI_SPECIAL20:
case MI_SPECIAL21: //GetSpecialCharacterTalkSfx(ped, sound) case MI_SPECIAL21: //return GetSpecialCharacterTalkSfx(ped, ped->GetModelIndex(), sound);
return NO_SAMPLE; return NO_SAMPLE;
default: return GetGenericMaleTalkSfx(ped, sound); 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 void
cPedComments::Add(tPedComment *com) cPedComments::Add(tPedComment *com)
{ {
@ -11298,6 +11320,23 @@ FindMissionAudioSfx(const char *name)
return NO_SAMPLE; 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 bool8
cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission) cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission)
{ {

View file

@ -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 void
cAudioManager::SetEntityStatus(int32 id, bool8 status) cAudioManager::SetEntityStatus(int32 id, bool8 status)
{ {
@ -167,6 +175,14 @@ cAudioManager::SetEntityStatus(int32 id, bool8 status)
m_asAudioEntities[id].m_bStatus = 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 void
cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol) cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
{ {
@ -248,9 +264,9 @@ cAudioManager::SetMusicFadeVol(uint8 volume)
} }
void 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 void
@ -524,11 +540,22 @@ cAudioManager::TranslateEntity(Const CVector *in, CVector *out)
*out = MultiplyInverse(TheCamera.GetMatrix(), *in); *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 int32
cAudioManager::ComputePan(float dist, CVector *vec) 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)))); int32 index = Min(63, Abs(int32(vec->x / (dist / 64.f))));
if (vec->x > 0.f) if (vec->x > 0.f)

View file

@ -51,7 +51,7 @@ public:
eAudioType m_nType; eAudioType m_nType;
void *m_pEntity; void *m_pEntity;
bool8 m_bIsUsed; bool8 m_bIsUsed;
uint8 m_bStatus; bool8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
float m_afVolume[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents; uint8 m_AudioEvents;
@ -255,14 +255,16 @@ public:
void Service(); void Service();
int32 CreateEntity(eAudioType type, void *entity); int32 CreateEntity(eAudioType type, void *entity);
void DestroyEntity(int32 id); // inlined in vc void DestroyEntity(int32 id); // inlined in vc
bool8 GetEntityStatus(int32 id);
void SetEntityStatus(int32 id, bool8 status); void SetEntityStatus(int32 id, bool8 status);
void *GetEntityPointer(int32 id);
void PlayOneShot(int32 index, uint16 sound, float vol); void PlayOneShot(int32 index, uint16 sound, float vol);
void SetEffectsMasterVolume(uint8 volume); void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume);
void SetMP3BoostVolume(uint8 volume); void SetMP3BoostVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume); void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume); void SetMusicFadeVol(uint8 volume);
void SetMonoMode(bool8 mono); void SetOutputMode(bool8 surround);
void ResetTimers(uint32 time); void ResetTimers(uint32 time);
void DestroyAllGameCreatedEntities(); void DestroyAllGameCreatedEntities();
@ -285,6 +287,7 @@ public:
void ServiceSoundEffects(); void ServiceSoundEffects();
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance); uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance);
void TranslateEntity(Const CVector *v1, CVector *v2); void TranslateEntity(Const CVector *v1, CVector *v2);
int32 ComputeFrontRearMix(float, CVector *);
int32 ComputePan(float, CVector *); int32 ComputePan(float, CVector *);
uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier); uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier);
int32 RandomDisplacement(uint32 seed); int32 RandomDisplacement(uint32 seed);
@ -479,6 +482,9 @@ public:
uint32 GetHMYAPTalkSfx(CPed *ped, uint16 sound); uint32 GetHMYAPTalkSfx(CPed *ped, uint16 sound);
uint32 GetWFYJGTalkSfx(CPed *ped, uint16 sound); uint32 GetWFYJGTalkSfx(CPed *ped, uint16 sound);
uint32 GetWMYJGTalkSfx(CPed *ped, uint16 sound); uint32 GetWMYJGTalkSfx(CPed *ped, uint16 sound);
uint32 GetSpecialCharacterTalkSfx(CPed *ped, int32 model, uint16 sound);
void DebugPlayPedComment(int32 sound);
// particles // particles
void ProcessExplosions(int32 explosion); void ProcessExplosions(int32 explosion);
@ -508,6 +514,7 @@ public:
#endif #endif
// mission audio // mission audio
const char *GetMissionAudioLoadedLabel(uint8 slot);
bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission); bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission);
void PreloadMissionAudio(uint8 slot, Const char *name); void PreloadMissionAudio(uint8 slot, Const char *name);
uint8 GetMissionAudioLoadingStatus(uint8 slot); uint8 GetMissionAudioLoadingStatus(uint8 slot);

View file

@ -38,6 +38,12 @@ cDMAudio::DestroyEntity(int32 audioEntity)
AudioManager.DestroyEntity(audioEntity); AudioManager.DestroyEntity(audioEntity);
} }
bool8
cDMAudio::GetEntityStatus(int32 audioEntity)
{
return AudioManager.GetEntityStatus(audioEntity);
}
void void
cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status) cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status)
{ {
@ -57,9 +63,9 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
} }
void void
cDMAudio::SetMonoMode(bool8 mono) cDMAudio::SetOutputMode(bool8 surround)
{ {
AudioManager.SetMonoMode(mono); return AudioManager.SetOutputMode(surround);
} }
void void
@ -184,6 +190,12 @@ cDMAudio::IsAudioInitialised(void)
return AudioManager.IsAudioInitialised(); return AudioManager.IsAudioInitialised();
} }
void
cDMAudio::ResetPoliceRadio()
{
AudioManager.ResetPoliceRadio();
}
void void
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
{ {
@ -309,6 +321,12 @@ cDMAudio::PlayLoadedMissionAudio(uint8 slot)
AudioManager.PlayLoadedMissionAudio(slot); AudioManager.PlayLoadedMissionAudio(slot);
} }
bool8
cDMAudio::IsMissionAudioSamplePlaying(uint8 slot)
{
return AudioManager.IsMissionAudioSamplePlaying(slot);
}
bool8 bool8
cDMAudio::IsMissionAudioSampleFinished(uint8 slot) cDMAudio::IsMissionAudioSampleFinished(uint8 slot)
{ {
@ -321,6 +339,12 @@ cDMAudio::ClearMissionAudio(uint8 slot)
AudioManager.ClearMissionAudio(slot); AudioManager.ClearMissionAudio(slot);
} }
const char *
cDMAudio::GetMissionAudioLoadedLabel(uint8 slot)
{
return AudioManager.GetMissionAudioLoadedLabel(slot);
}
uint8 uint8
cDMAudio::GetRadioInCar(void) cDMAudio::GetRadioInCar(void)
{ {

View file

@ -25,11 +25,12 @@ public:
int32 CreateEntity(eAudioType type, void *UID); int32 CreateEntity(eAudioType type, void *UID);
void DestroyEntity(int32 audioEntity); void DestroyEntity(int32 audioEntity);
bool8 GetEntityStatus(int32 audioEntity);
void SetEntityStatus(int32 audioEntity, bool8 status); void SetEntityStatus(int32 audioEntity, bool8 status);
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
void DestroyAllGameCreatedEntities(void); void DestroyAllGameCreatedEntities(void);
void SetMonoMode(bool8 mono); void SetOutputMode(bool8 surround);
void SetMP3BoostVolume(uint8 volume); void SetMP3BoostVolume(uint8 volume);
void SetEffectsMasterVolume(uint8 volume); void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume);
@ -57,7 +58,8 @@ public:
char GetCDAudioDriveLetter(void); char GetCDAudioDriveLetter(void);
bool8 IsAudioInitialised(void); bool8 IsAudioInitialised(void);
void ResetPoliceRadio();
void ReportCrime(eCrimeType crime, CVector const &pos); void ReportCrime(eCrimeType crime, CVector const &pos);
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject); int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
@ -85,8 +87,10 @@ public:
uint8 GetMissionAudioLoadingStatus(uint8 slot); uint8 GetMissionAudioLoadingStatus(uint8 slot);
void SetMissionAudioLocation(uint8 slot, float x, float y, float z); void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
void PlayLoadedMissionAudio(uint8 slot); void PlayLoadedMissionAudio(uint8 slot);
bool8 IsMissionAudioSamplePlaying(uint8 slot);
bool8 IsMissionAudioSampleFinished(uint8 slot); bool8 IsMissionAudioSampleFinished(uint8 slot);
void ClearMissionAudio(uint8 slot); void ClearMissionAudio(uint8 slot);
const char *GetMissionAudioLoadedLabel(uint8 slot);
uint8 GetRadioInCar(void); uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio); void SetRadioInCar(uint32 radio);