summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioLogic.cpp41
-rw-r--r--src/audio/AudioManager.cpp19
-rw-r--r--src/audio/AudioManager.h7
-rw-r--r--src/audio/DMAudio.cpp16
-rw-r--r--src/audio/DMAudio.h4
5 files changed, 78 insertions, 9 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 83f55d33..56463be0 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -5367,7 +5367,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, uint16 sound)
case MI_SPECIAL18:
case MI_SPECIAL19:
case MI_SPECIAL20:
- case MI_SPECIAL21: return NO_SAMPLE;
+ case MI_SPECIAL21: return GetSpecialCharacterTalkSfx(ped, ped->GetModelIndex(), sound);
default: return GetGenericMaleTalkSfx(ped, sound);
}
}
@@ -7794,6 +7794,28 @@ cAudioManager::GetWMYJGTalkSfx(CPed *ped, uint16 sound)
return sfx;
}
+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)
{
@@ -9786,6 +9808,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 75af289c..ad76b73a 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -264,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
@@ -530,11 +530,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 470909a2..ff42af33 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -264,7 +264,7 @@ public:
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();
@@ -287,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);
@@ -481,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);
@@ -510,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 ad8a12d9..f5b08c71 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -63,9 +63,9 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
}
void
-cDMAudio::SetMonoMode(bool8 mono)
+cDMAudio::SetOutputMode(bool8 surround)
{
- AudioManager.SetMonoMode(mono);
+ return AudioManager.SetOutputMode(surround);
}
void
@@ -322,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);
@@ -333,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 fd2d6c3c..110cb2db 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -30,7 +30,7 @@ public:
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);
@@ -87,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);