summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioLogic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/AudioLogic.cpp')
-rw-r--r--src/audio/AudioLogic.cpp192
1 files changed, 141 insertions, 51 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 2ec0d73f..3932f85c 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -279,9 +279,15 @@ cAudioManager::ProcessSpecial()
if (m_bIsPaused) {
if (!m_bWasPaused) {
MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND);
+#ifndef GTA_PS2
SampleManager.SetEffectsFadeVolume(MAX_VOLUME);
SampleManager.SetMusicFadeVolume(MAX_VOLUME);
+#endif
}
+#ifdef GTA_PS2
+ if (!SampleManager.IsSampleBankLoaded(SFX_BANK_FRONT_END_MENU))
+ SampleManager.LoadSampleBank(SFX_BANK_FRONT_END_MENU);
+#endif
} else {
if (m_bWasPaused) {
MusicManager.StopFrontEndTrack();
@@ -669,7 +675,11 @@ enum
BRIDGE_WARNING_VOLUME = 100,
MISSION_AUDIO_MAX_DIST = 50,
+#ifdef GTA_PS2
+ MISSION_AUDIO_VOLUME = MAX_VOLUME,
+#else
MISSION_AUDIO_VOLUME = 80,
+#endif
};
#pragma region VEHICLE AUDIO
@@ -8644,40 +8654,45 @@ struct MissionAudioData {
};
Const MissionAudioData MissionAudioNameSfxAssoc[] = {
- {"lib_a1", STREAMED_SOUND_MISSION_LIB_A1}, {"lib_a2", STREAMED_SOUND_MISSION_LIB_A2}, {"lib_a", STREAMED_SOUND_MISSION_LIB_A},
- {"lib_b", STREAMED_SOUND_MISSION_LIB_B}, {"lib_c", STREAMED_SOUND_MISSION_LIB_C}, {"lib_d", STREAMED_SOUND_MISSION_LIB_D},
- {"l2_a", STREAMED_SOUND_MISSION_L2_A}, {"j4t_1", STREAMED_SOUND_MISSION_J4T_1}, {"j4t_2", STREAMED_SOUND_MISSION_J4T_2},
- {"j4t_3", STREAMED_SOUND_MISSION_J4T_3}, {"j4t_4", STREAMED_SOUND_MISSION_J4T_4}, {"j4_a", STREAMED_SOUND_MISSION_J4_A},
- {"j4_b", STREAMED_SOUND_MISSION_J4_B}, {"j4_c", STREAMED_SOUND_MISSION_J4_C}, {"j4_d", STREAMED_SOUND_MISSION_J4_D},
- {"j4_e", STREAMED_SOUND_MISSION_J4_E}, {"j4_f", STREAMED_SOUND_MISSION_J4_F}, {"j6_1", STREAMED_SOUND_MISSION_J6_1},
- {"j6_a", STREAMED_SOUND_MISSION_J6_A}, {"j6_b", STREAMED_SOUND_MISSION_J6_B}, {"j6_c", STREAMED_SOUND_MISSION_J6_C},
- {"j6_d", STREAMED_SOUND_MISSION_J6_D}, {"t4_a", STREAMED_SOUND_MISSION_T4_A}, {"s1_a", STREAMED_SOUND_MISSION_S1_A},
- {"s1_a1", STREAMED_SOUND_MISSION_S1_A1}, {"s1_b", STREAMED_SOUND_MISSION_S1_B}, {"s1_c", STREAMED_SOUND_MISSION_S1_C},
- {"s1_c1", STREAMED_SOUND_MISSION_S1_C1}, {"s1_d", STREAMED_SOUND_MISSION_S1_D}, {"s1_e", STREAMED_SOUND_MISSION_S1_E},
- {"s1_f", STREAMED_SOUND_MISSION_S1_F}, {"s1_g", STREAMED_SOUND_MISSION_S1_G}, {"s1_h", STREAMED_SOUND_MISSION_S1_H},
- {"s1_i", STREAMED_SOUND_MISSION_S1_I}, {"s1_j", STREAMED_SOUND_MISSION_S1_J}, {"s1_k", STREAMED_SOUND_MISSION_S1_K},
- {"s1_l", STREAMED_SOUND_MISSION_S1_L}, {"s3_a", STREAMED_SOUND_MISSION_S3_A}, {"s3_b", STREAMED_SOUND_MISSION_S3_B},
- {"el3_a", STREAMED_SOUND_MISSION_EL3_A}, {"mf1_a", STREAMED_SOUND_MISSION_MF1_A}, {"mf2_a", STREAMED_SOUND_MISSION_MF2_A},
- {"mf3_a", STREAMED_SOUND_MISSION_MF3_A}, {"mf3_b", STREAMED_SOUND_MISSION_MF3_B}, {"mf3_b1", STREAMED_SOUND_MISSION_MF3_B1},
- {"mf3_c", STREAMED_SOUND_MISSION_MF3_C}, {"mf4_a", STREAMED_SOUND_MISSION_MF4_A}, {"mf4_b", STREAMED_SOUND_MISSION_MF4_B},
- {"mf4_c", STREAMED_SOUND_MISSION_MF4_C}, {"a1_a", STREAMED_SOUND_MISSION_A1_A}, {"a3_a", STREAMED_SOUND_MISSION_A3_A},
- {"a5_a", STREAMED_SOUND_MISSION_A5_A}, {"a4_a", STREAMED_SOUND_MISSION_A4_A}, {"a4_b", STREAMED_SOUND_MISSION_A4_B},
- {"a4_c", STREAMED_SOUND_MISSION_A4_C}, {"a4_d", STREAMED_SOUND_MISSION_A4_D}, {"k1_a", STREAMED_SOUND_MISSION_K1_A},
- {"k3_a", STREAMED_SOUND_MISSION_K3_A}, {"r1_a", STREAMED_SOUND_MISSION_R1_A}, {"r2_a", STREAMED_SOUND_MISSION_R2_A},
- {"r2_b", STREAMED_SOUND_MISSION_R2_B}, {"r2_c", STREAMED_SOUND_MISSION_R2_C}, {"r2_d", STREAMED_SOUND_MISSION_R2_D},
- {"r2_e", STREAMED_SOUND_MISSION_R2_E}, {"r2_f", STREAMED_SOUND_MISSION_R2_F}, {"r2_g", STREAMED_SOUND_MISSION_R2_G},
- {"r2_h", STREAMED_SOUND_MISSION_R2_H}, {"r5_a", STREAMED_SOUND_MISSION_R5_A}, {"r6_a", STREAMED_SOUND_MISSION_R6_A},
- {"r6_a1", STREAMED_SOUND_MISSION_R6_A1}, {"r6_b", STREAMED_SOUND_MISSION_R6_B}, {"lo2_a", STREAMED_SOUND_MISSION_LO2_A},
- {"lo6_a", STREAMED_SOUND_MISSION_LO6_A}, {"yd2_a", STREAMED_SOUND_MISSION_YD2_A}, {"yd2_b", STREAMED_SOUND_MISSION_YD2_B},
- {"yd2_c", STREAMED_SOUND_MISSION_YD2_C}, {"yd2_c1", STREAMED_SOUND_MISSION_YD2_C1}, {"yd2_d", STREAMED_SOUND_MISSION_YD2_D},
- {"yd2_e", STREAMED_SOUND_MISSION_YD2_E}, {"yd2_f", STREAMED_SOUND_MISSION_YD2_F}, {"yd2_g", STREAMED_SOUND_MISSION_YD2_G},
- {"yd2_h", STREAMED_SOUND_MISSION_YD2_H}, {"yd2_ass", STREAMED_SOUND_MISSION_YD2_ASS}, {"yd2_ok", STREAMED_SOUND_MISSION_YD2_OK},
- {"h5_a", STREAMED_SOUND_MISSION_H5_A}, {"h5_b", STREAMED_SOUND_MISSION_H5_B}, {"h5_c", STREAMED_SOUND_MISSION_H5_C},
- {"ammu_a", STREAMED_SOUND_MISSION_AMMU_A}, {"ammu_b", STREAMED_SOUND_MISSION_AMMU_B}, {"ammu_c", STREAMED_SOUND_MISSION_AMMU_C},
- {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3},
- {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6},
- {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C},
- {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}, {nil, 0}};
+ {"lib_a1", SFX_MISSION_LIB_A1}, {"lib_a2", SFX_MISSION_LIB_A2}, {"lib_a", SFX_MISSION_LIB_A},
+ {"lib_b", SFX_MISSION_LIB_B}, {"lib_c", SFX_MISSION_LIB_C}, {"lib_d", SFX_MISSION_LIB_D},
+ {"l2_a", SFX_MISSION_L2_A}, {"j4t_1", SFX_MISSION_J4T_1}, {"j4t_2", SFX_MISSION_J4T_2},
+ {"j4t_3", SFX_MISSION_J4T_3}, {"j4t_4", SFX_MISSION_J4T_4}, {"j4_a", SFX_MISSION_J4_A},
+ {"j4_b", SFX_MISSION_J4_B}, {"j4_c", SFX_MISSION_J4_C}, {"j4_d", SFX_MISSION_J4_D},
+ {"j4_e", SFX_MISSION_J4_E}, {"j4_f", SFX_MISSION_J4_F}, {"j6_1", SFX_MISSION_J6_1},
+ {"j6_a", SFX_MISSION_J6_A}, {"j6_b", SFX_MISSION_J6_B}, {"j6_c", SFX_MISSION_J6_C},
+ {"j6_d", SFX_MISSION_J6_D}, {"t4_a", SFX_MISSION_T4_A}, {"s1_a", SFX_MISSION_S1_A},
+ {"s1_a1", SFX_MISSION_S1_A1}, {"s1_b", SFX_MISSION_S1_B}, {"s1_c", SFX_MISSION_S1_C},
+ {"s1_c1", SFX_MISSION_S1_C1}, {"s1_d", SFX_MISSION_S1_D}, {"s1_e", SFX_MISSION_S1_E},
+ {"s1_f", SFX_MISSION_S1_F}, {"s1_g", SFX_MISSION_S1_G}, {"s1_h", SFX_MISSION_S1_H},
+ {"s1_i", SFX_MISSION_S1_I}, {"s1_j", SFX_MISSION_S1_J}, {"s1_k", SFX_MISSION_S1_K},
+ {"s1_l", SFX_MISSION_S1_L}, {"s3_a", SFX_MISSION_S3_A}, {"s3_b", SFX_MISSION_S3_B},
+ {"el3_a", SFX_MISSION_EL3_A}, {"mf1_a", SFX_MISSION_MF1_A}, {"mf2_a", SFX_MISSION_MF2_A},
+ {"mf3_a", SFX_MISSION_MF3_A}, {"mf3_b", SFX_MISSION_MF3_B}, {"mf3_b1", SFX_MISSION_MF3_B1},
+ {"mf3_c", SFX_MISSION_MF3_C}, {"mf4_a", SFX_MISSION_MF4_A}, {"mf4_b", SFX_MISSION_MF4_B},
+ {"mf4_c", SFX_MISSION_MF4_C}, {"a1_a", SFX_MISSION_A1_A}, {"a3_a", SFX_MISSION_A3_A},
+ {"a5_a", SFX_MISSION_A5_A}, {"a4_a", SFX_MISSION_A4_A}, {"a4_b", SFX_MISSION_A4_B},
+ {"a4_c", SFX_MISSION_A4_C}, {"a4_d", SFX_MISSION_A4_D}, {"k1_a", SFX_MISSION_K1_A},
+ {"k3_a", SFX_MISSION_K3_A}, {"r1_a", SFX_MISSION_R1_A}, {"r2_a", SFX_MISSION_R2_A},
+ {"r2_b", SFX_MISSION_R2_B}, {"r2_c", SFX_MISSION_R2_C}, {"r2_d", SFX_MISSION_R2_D},
+ {"r2_e", SFX_MISSION_R2_E}, {"r2_f", SFX_MISSION_R2_F}, {"r2_g", SFX_MISSION_R2_G},
+ {"r2_h", SFX_MISSION_R2_H}, {"r5_a", SFX_MISSION_R5_A}, {"r6_a", SFX_MISSION_R6_A},
+ {"r6_a1", SFX_MISSION_R6_A1}, {"r6_b", SFX_MISSION_R6_B}, {"lo2_a", SFX_MISSION_LO2_A},
+ {"lo6_a", SFX_MISSION_LO6_A}, {"yd2_a", SFX_MISSION_YD2_A}, {"yd2_b", SFX_MISSION_YD2_B},
+ {"yd2_c", SFX_MISSION_YD2_C}, {"yd2_c1", SFX_MISSION_YD2_C1}, {"yd2_d", SFX_MISSION_YD2_D},
+ {"yd2_e", SFX_MISSION_YD2_E}, {"yd2_f", SFX_MISSION_YD2_F}, {"yd2_g", SFX_MISSION_YD2_G},
+ {"yd2_h", SFX_MISSION_YD2_H}, {"yd2_ass", SFX_MISSION_YD2_ASS}, {"yd2_ok", SFX_MISSION_YD2_OK},
+ {"h5_a", SFX_MISSION_H5_A}, {"h5_b", SFX_MISSION_H5_B}, {"h5_c", SFX_MISSION_H5_C},
+ {"ammu_a", SFX_MISSION_AMMU_A}, {"ammu_b", SFX_MISSION_AMMU_B}, {"ammu_c", SFX_MISSION_AMMU_C},
+#if GTA_VERSION < GTA3_PC_10
+ {"ammu_d", SFX_AMMU_D }, {"ammu_e", SFX_AMMU_E}, {"ammu_f", SFX_AMMU_F},
+ {"ammu_g", SFX_MISSION_AMMU_A}, {"ammu_h", SFX_MISSION_AMMU_A}, {"ammu_i", SFX_MISSION_AMMU_A},
+ {"ammu_j", SFX_MISSION_AMMU_A}, {"ammu_k", SFX_MISSION_AMMU_A},
+#endif
+ {"door_1", SFX_MISSION_DOOR_1}, {"door_2", SFX_MISSION_DOOR_2}, {"door_3", SFX_MISSION_DOOR_3},
+ {"door_4", SFX_MISSION_DOOR_4}, {"door_5", SFX_MISSION_DOOR_5}, {"door_6", SFX_MISSION_DOOR_6},
+ {"t3_a", SFX_MISSION_T3_A}, {"t3_b", SFX_MISSION_T3_B}, {"t3_c", SFX_MISSION_T3_C},
+ {"k1_b", SFX_MISSION_K1_B}, {"c_1", SFX_MISSION_CAT1}, {nil, 0}};
uint32
FindMissionAudioSfx(const char *name)
@@ -8694,18 +8709,18 @@ bool8
cAudioManager::MissionScriptAudioUsesPoliceChannel(uint32 soundMission)
{
switch (soundMission) {
- case STREAMED_SOUND_MISSION_J6_D:
- case STREAMED_SOUND_MISSION_T4_A:
- case STREAMED_SOUND_MISSION_S1_H:
- case STREAMED_SOUND_MISSION_S3_B:
- case STREAMED_SOUND_MISSION_EL3_A:
- case STREAMED_SOUND_MISSION_A3_A:
- case STREAMED_SOUND_MISSION_A5_A:
- case STREAMED_SOUND_MISSION_K1_A:
- case STREAMED_SOUND_MISSION_R1_A:
- case STREAMED_SOUND_MISSION_R5_A:
- case STREAMED_SOUND_MISSION_LO2_A:
- case STREAMED_SOUND_MISSION_LO6_A:
+ case SFX_MISSION_J6_D:
+ case SFX_MISSION_T4_A:
+ case SFX_MISSION_S1_H:
+ case SFX_MISSION_S3_B:
+ case SFX_MISSION_EL3_A:
+ case SFX_MISSION_A3_A:
+ case SFX_MISSION_A5_A:
+ case SFX_MISSION_K1_A:
+ case SFX_MISSION_R1_A:
+ case SFX_MISSION_R5_A:
+ case SFX_MISSION_LO2_A:
+ case SFX_MISSION_LO6_A:
return TRUE;
default:
return FALSE;
@@ -8798,27 +8813,48 @@ cAudioManager::ProcessMissionAudio()
if (m_bIsInitialised && m_nMissionAudioSampleIndex != NO_SAMPLE) {
switch (m_nMissionAudioLoadingStatus) {
case LOADING_STATUS_NOT_LOADED:
+#ifdef GTA_PS2
+ SampleManager.LoadPedComment(m_nMissionAudioSampleIndex);
+ m_nMissionAudioLoadingStatus = LOADING_STATUS_LOADING;
+#else
SampleManager.PreloadStreamedFile(m_nMissionAudioSampleIndex, 1);
m_nMissionAudioLoadingStatus = LOADING_STATUS_LOADED;
+#endif
nFramesUntilFailedLoad = 0;
break;
- case LOADING_STATUS_FAILED:
+ case LOADING_STATUS_LOADING:
+#ifdef GTA_PS2
+ if (SampleManager.IsPedCommentLoaded(m_nMissionAudioSampleIndex) == TRUE)
+ m_nMissionAudioLoadingStatus = LOADING_STATUS_LOADED;
+ // fallthrough
+ else
+#endif
if (++nFramesUntilFailedLoad >= 90) {
nFramesForPretendPlaying = 0;
g_bMissionAudioLoadFailed = TRUE;
nFramesUntilFailedLoad = 0;
m_nMissionAudioLoadingStatus = LOADING_STATUS_LOADED;
+ return;
}
- return;
- default:
- return;
+#ifdef GTA_PS2
+ else {
+ // try loading again
+ SampleManager.LoadPedComment(m_nMissionAudioSampleIndex);
+ return;
+ }
+#endif
case LOADING_STATUS_LOADED:
if (!m_bIsMissionAudioAllowedToPlay)
break;
if (g_bMissionAudioLoadFailed) {
if (m_bTimerJustReset) {
ClearMissionAudio();
+#ifdef GTA_PS2
+ SampleManager.StopChannel(CHANNEL_POLICE_RADIO); // why?
+ SampleManager.StopChannel(CHANNEL_MISSION_AUDIO);
+#else
SampleManager.StopStreamedFile(1);
+#endif
nFramesForPretendPlaying = 0;
nCheckPlayingDelay = 0;
nFramesUntilFailedLoad = 0;
@@ -8836,10 +8872,24 @@ cAudioManager::ProcessMissionAudio()
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex))
SetMissionScriptPoliceAudio(m_nMissionAudioSampleIndex);
else {
+#ifdef GTA_PS2
+ SampleManager.InitialiseChannel(CHANNEL_MISSION_AUDIO, m_nMissionAudioSampleIndex, SFX_BANK_PED_COMMENTS);
+ if (m_bIsPaused)
+ SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO, 0);
+ else
+ SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO, SampleManager.GetSampleBaseFrequency(m_nMissionAudioSampleIndex));
+#else
if (m_bIsPaused)
SampleManager.PauseStream(TRUE, 1);
+#endif
if (m_bIsMissionAudio2D) {
+#ifdef GTA_PS2
+ SampleManager.SetChannelVolume(CHANNEL_MISSION_AUDIO, MISSION_AUDIO_VOLUME);
+ SampleManager.SetChannelPan(CHANNEL_MISSION_AUDIO, 63);
+ SampleManager.SetChannelReverbFlag(CHANNEL_MISSION_AUDIO, FALSE);
+#else
SampleManager.SetStreamedVolumeAndPan(MISSION_AUDIO_VOLUME, 63, TRUE, 1);
+#endif
} else {
distSquared = GetDistanceSquared(m_vecMissionAudioPosition);
if (distSquared < SQR(MISSION_AUDIO_MAX_DIST)) {
@@ -8850,10 +8900,20 @@ cAudioManager::ProcessMissionAudio()
} else {
Vol = 0;
pan = 63;
- }
+ }
+#ifdef GTA_PS2
+ SampleManager.SetChannelVolume(CHANNEL_MISSION_AUDIO, Vol);
+ SampleManager.SetChannelPan(CHANNEL_MISSION_AUDIO, pan);
+ SampleManager.SetChannelReverbFlag(CHANNEL_MISSION_AUDIO, TRUE);
+#else
SampleManager.SetStreamedVolumeAndPan(Vol, pan, TRUE, 1);
+#endif
}
+#ifdef GTA_PS2
+ SampleManager.StartChannel(CHANNEL_MISSION_AUDIO);
+#else
SampleManager.StartPreloadedStreamedFile(1);
+#endif
}
m_nMissionAudioPlayStatus = PLAY_STATUS_PLAYING;
nCheckPlayingDelay = 30;
@@ -8861,7 +8921,12 @@ cAudioManager::ProcessMissionAudio()
case PLAY_STATUS_PLAYING:
if (m_bTimerJustReset) {
ClearMissionAudio();
+#ifdef GTA_PS2
+ SampleManager.StopChannel(CHANNEL_POLICE_RADIO); // why?
+ SampleManager.StopChannel(CHANNEL_MISSION_AUDIO);
+#else
SampleManager.StopStreamedFile(1);
+#endif
return;
}
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex)) {
@@ -8871,27 +8936,50 @@ cAudioManager::ProcessMissionAudio()
} else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_nMissionAudioFramesToPlay-- == 0) {
m_nMissionAudioPlayStatus = PLAY_STATUS_FINISHED;
m_nMissionAudioSampleIndex = NO_SAMPLE;
+#ifdef GTA_PS2
+ SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
+#else
SampleManager.StopStreamedFile(1);
+#endif
m_nMissionAudioFramesToPlay = 0;
}
}
} else if (m_bIsMissionAudioPlaying) {
+#ifdef GTA_PS2
+ if (!SampleManager.GetChannelUsedFlag(CHANNEL_MISSION_AUDIO) && !m_bIsPaused && !m_bWasPaused) {
+#else
if (!SampleManager.IsStreamPlaying(1) && !m_bIsPaused && !m_bWasPaused) {
+#endif
m_nMissionAudioPlayStatus = PLAY_STATUS_FINISHED;
m_nMissionAudioSampleIndex = NO_SAMPLE;
+#ifdef GTA_PS2
+ SampleManager.StopChannel(CHANNEL_MISSION_AUDIO);
+#else
SampleManager.StopStreamedFile(1);
+#endif
m_nMissionAudioFramesToPlay = 0;
} else {
+#ifdef GTA_PS2
+ if (m_bIsPaused)
+ SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO, 0);
+ else
+ SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO, SampleManager.GetSampleBaseFrequency(m_nMissionAudioSampleIndex));
+#else
if (m_bIsPaused)
SampleManager.PauseStream(TRUE, 1);
else
SampleManager.PauseStream(FALSE, 1);
+#endif
}
} else {
if (m_bIsPaused)
break;
if (nCheckPlayingDelay-- > 0) {
+#ifdef GTA_PS2
+ if (!SampleManager.GetChannelUsedFlag(CHANNEL_MISSION_AUDIO))
+#else
if (!SampleManager.IsStreamPlaying(1))
+#endif
break;
nCheckPlayingDelay = 0;
}
@@ -8902,6 +8990,8 @@ cAudioManager::ProcessMissionAudio()
break;
}
break;
+ default:
+ return;
}
}
}