From 74867af2e73b8cbbef97ff9395c3b0b157ec79ee Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 21:50:09 +0300 Subject: [PATCH] Fixes --- src/audio/AudioLogic.cpp | 123 ++++++++++++++++++------------------ src/audio/AudioManager.cpp | 2 + src/audio/AudioManager.h | 21 +++++- src/audio/MusicManager.cpp | 2 +- src/audio/audio_enums.h | 8 ++- src/audio/sampman_miles.cpp | 40 ++++++------ src/audio/sampman_oal.cpp | 16 ++--- src/control/Script.cpp | 2 +- src/control/Script4.cpp | 2 +- src/core/config.h | 2 +- 10 files changed, 118 insertions(+), 100 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 19294103..6685a47d 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -727,22 +727,22 @@ const eSfxSample aEngineSounds[][2] = { bool8 bPlayerJustEnteredCar; const bool8 hornPatternsArray[8][44] = { - {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false}, - {false, false, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, true, true, true, true, false, - false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, - false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, true, true, true, - true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, - true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, true, true, - false, false, false, false, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, true, true, - true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, false, false} + {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, + FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, + TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, + TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, + FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, + TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE} }; void cAudioManager::ProcessVehicle(CVehicle* veh) @@ -1762,6 +1762,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank; soundOffset = gBankStartOffset[engineSoundType] - gBankStartOffset[CAR_SFX_BANKS_OFFSET]; //soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET); + noGearBox = FALSE; switch (engineSoundType) { case SFX_BANK_PONTIAC: gearSoundLength = 2526; @@ -1880,7 +1881,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; if (params.m_pVehicle->bIsDrowning) vol /= 4; - AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][0], SFX_BANK_0, 52, true); + AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][0], SFX_BANK_0, 52, TRUE); CurrentPretendGear = Max(1, currentGear); } @@ -1915,7 +1916,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } if (params.m_pVehicle->bIsDrowning) vol /= 4; - AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][1], SFX_BANK_0, 2, true); + AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][1], SFX_BANK_0, 2, TRUE); } else { TranslateEntity(&m_sQueueSample.m_vecPos, &pos); if (bAccelSampleStopped) { @@ -3224,19 +3225,18 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) // m_sQueueSample.m_nCounter = 33; // m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; // m_sQueueSample.m_nBankIndex = SFX_BANK_0; - // m_sQueueSample.m_bIs2D = false; + // m_sQueueSample.m_bIs2D = FALSE; // m_sQueueSample.m_nReleasingVolumeModificator = 5; // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; // m_sQueueSample.m_nLoopCount = 0; // m_sQueueSample.m_nEmittingVolume = emittingVol; - // m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - // m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + // SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) // m_sQueueSample.m_fSpeedMultiplier = 6.0f; // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - // m_sQueueSample.m_bReleasingSoundFlag = false; + // m_sQueueSample.m_bReleasingSoundFlag = FALSE; // m_sQueueSample.m_nReleasingVolumeDivider = 3; - // m_sQueueSample.m_bReverbFlag = true; - // m_sQueueSample.m_bRequireReflection = false; + // m_sQueueSample.m_bReverbFlag = TRUE; + // m_sQueueSample.m_bRequireReflection = FALSE; // AddSampleToRequestedQueue(); // } //} @@ -7776,7 +7776,7 @@ cAudioManager::GetGenericFemaleTalkSfx(CPed *ped, int16 sound) { return NO_SAMPLE; //uint32 sfx; - //m_bGenericSfx = true; + //m_bGenericSfx = TRUE; //switch(sound) { //case SOUND_PED_DEATH: GetPhrase(sfx, ped->m_lastComment, SFX_GENERIC_FEMALE_DEATH_1, 22); break; //case SOUND_PED_BULLET_HIT: @@ -8137,17 +8137,16 @@ cAudioManager::ProcessExtraSounds() // m_sQueueSample.m_nSampleIndex = SFX_ARCADE; // m_sQueueSample.m_nBankIndex = SFX_BANK_0; // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); - // m_sQueueSample.m_bIs2D = false; + // m_sQueueSample.m_bIs2D = FALSE; // m_sQueueSample.m_nLoopCount = 0; - // m_sQueueSample.m_bReleasingSoundFlag = false; + // m_sQueueSample.m_bReleasingSoundFlag = FALSE; // m_sQueueSample.m_nReleasingVolumeModificator = 4; // m_sQueueSample.m_fSpeedMultiplier = 3.0f; // m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - // m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE); - // m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE); - // m_sQueueSample.m_bReverbFlag = true; + // SET_LOOP_OFFSETS(SFX_ARCADE) + // m_sQueueSample.m_bReverbFlag = TRUE; // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - // m_sQueueSample.m_bRequireReflection = false; + // m_sQueueSample.m_bRequireReflection = FALSE; // m_sQueueSample.m_nReleasingVolumeDivider = 3; // AddSampleToRequestedQueue(); // } @@ -8304,8 +8303,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING); // m_sQueueSample.m_nReleasingVolumeModificator = 1; // m_sQueueSample.m_fSpeedMultiplier = 2.0f; - // m_sQueueSample.m_bIs2D = false; - // m_sQueueSample.m_bRequireReflection = false; + // m_sQueueSample.m_bIs2D = FALSE; + // m_sQueueSample.m_bRequireReflection = FALSE; // break; case SCRIPT_SOUND_GLASS_BREAK_L: m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -8905,15 +8904,15 @@ cAudioManager::ProcessFrontEnd() radioDial = m_sQueueSample.m_nSampleIndex; break; case SOUND_FRONTEND_HIGHLIGHT_OPTION: - //stereo = true; + //stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT; break; case SOUND_FRONTEND_ENTER_OR_ADJUST: - //stereo = true; + //stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT; break; case SOUND_FRONTEND_BACK: - //stereo = true; + //stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_BACK; break; case SOUND_FRONTEND_FAIL: @@ -11381,7 +11380,7 @@ cAudioManager::ClearMissionAudio(uint8 slot) m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_bIsMobile[slot] = FALSE; //SampleManager.StopStreamedFile(slot + 1); - SampleManager.StopChannel(slot + 29); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); } } @@ -11404,8 +11403,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) case LOADING_STATUS_NOT_LOADED: //SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex[slot], slot + 1); SampleManager.LoadPedComment(m_sMissionAudio.m_nSampleIndex[slot]); - SampleManager.InitialiseChannel(slot + 29, m_sMissionAudio.m_nSampleIndex[slot], SFX_BANK_PED_COMMENTS); - SampleManager.SetChannelFrequency(slot + 29, SampleManager.GetSampleBaseFrequency(m_sMissionAudio.m_nSampleIndex[slot])); + SampleManager.InitialiseChannel(slot + CHANNEL_MISSION_AUDIO_1, m_sMissionAudio.m_nSampleIndex[slot], SFX_BANK_PED_COMMENTS); + SampleManager.SetChannelFrequency(slot + CHANNEL_MISSION_AUDIO_1, SampleManager.GetSampleBaseFrequency(m_sMissionAudio.m_nSampleIndex[slot])); m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED; nFramesUntilFailedLoad[slot] = 0; break; @@ -11415,7 +11414,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) if (g_bMissionAudioLoadFailed[slot]) { if (m_bTimerJustReset) { ClearMissionAudio(slot); - SampleManager.StopChannel(slot + 29); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); //SampleManager.StopStreamedFile(slot + 1); nFramesForPretendPlaying[slot] = 0; nCheckPlayingDelay[slot] = 0; @@ -11436,16 +11435,16 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex[slot]); } else { if(m_nUserPause) - // SampleManager.PauseStream(1, slot + 1); - SampleManager.StopChannel(slot + 29); + // SampleManager.PauseStream(TRUE, slot + 1); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); if (m_sMissionAudio.m_bPredefinedProperties[slot]) { //if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL) - // SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1); + // SampleManager.SetStreamedVolumeAndPan(80, 0, TRUE, slot + 1); //else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR) - // SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1); + // SampleManager.SetStreamedVolumeAndPan(80, 127, TRUE, slot + 1); //else - SampleManager.SetChannelPan(slot + 29, 63); - SampleManager.SetChannelVolume(slot + 29, 127); + SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, 63); + SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, 127); //SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1); } else { distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); @@ -11461,23 +11460,23 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); pan = ComputePan(80.f, &vec); } - SampleManager.SetChannelPan(slot + 29, pan); - SampleManager.SetChannelVolume(slot + 29, emittingVol); + SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, pan); + SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, emittingVol); //SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); } //SampleManager.StartPreloadedStreamedFile(slot + 1); - SampleManager.StartChannel(slot + 29); + SampleManager.StartChannel(slot + CHANNEL_MISSION_AUDIO_1); } m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING; nCheckPlayingDelay[slot] = 30; //if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) - // m_sMissionAudio.m_bIsMobile[slot] = true; + // m_sMissionAudio.m_bIsMobile[slot] = TRUE; break; case PLAY_STATUS_PLAYING: if (m_bTimerJustReset) { ClearMissionAudio(slot); //SampleManager.StopStreamedFile(slot + 1); - SampleManager.StopChannel(slot + 29); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); break; } if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex[slot])) { @@ -11488,20 +11487,20 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; //SampleManager.StopStreamedFile(slot + 1); - SampleManager.StopChannel(slot + 29); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; } } } else if (m_sMissionAudio.m_bIsPlaying[slot]) { //if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) { - if(SampleManager.GetChannelUsedFlag(slot + 29) || m_nUserPause || m_nPreviousUserPause) { + if(SampleManager.GetChannelUsedFlag(slot + CHANNEL_MISSION_AUDIO_1) || m_nUserPause || m_nPreviousUserPause) { if(m_nUserPause) - //SampleManager.PauseStream(1, slot + 1); - SampleManager.StopChannel(slot + 29); + //SampleManager.PauseStream(TRUE, slot + 1); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); else { - //SampleManager.PauseStream(0, slot + 1); - //SampleManager.StartChannel(slot + 29); + //SampleManager.PauseStream(FALSE, slot + 1); + //SampleManager.StartChannel(slot + CHANNEL_MISSION_AUDIO_1); if (!m_sMissionAudio.m_bPredefinedProperties[slot]) { distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); if (distSquared >= SQR(80.0f)) { @@ -11516,8 +11515,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); pan = ComputePan(80.f, &vec); } - SampleManager.SetChannelPan(slot + 29, pan); - SampleManager.SetChannelVolume(slot + 29, emittingVol); + SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, pan); + SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, emittingVol); //SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); } } @@ -11526,10 +11525,10 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) } else { m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; //if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) - // m_sMissionAudio.m_bIsMobile[slot] = false; + // m_sMissionAudio.m_bIsMobile[slot] = FALSE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; //SampleManager.StopStreamedFile(slot + 1); - SampleManager.StopChannel(slot + 29); + SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1); m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; } } else { @@ -11537,7 +11536,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) break; if (nCheckPlayingDelay[slot]--) { //if (!SampleManager.IsStreamPlaying(slot + 1)) - if (!SampleManager.GetChannelUsedFlag(slot + 29)) + if (!SampleManager.GetChannelUsedFlag(slot + CHANNEL_MISSION_AUDIO_1)) break; nCheckPlayingDelay[slot] = 0; } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index e2596964..abbce8bb 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -273,6 +273,8 @@ cAudioManager::ResetTimers(uint32 time) ClearMissionAudio(0); ClearMissionAudio(1); SampleManager.StopChannel(CHANNEL_POLICE_RADIO); + SampleManager.StopChannel(CHANNEL_MISSION_AUDIO_1); + SampleManager.StopChannel(CHANNEL_MISSION_AUDIO_2); SampleManager.SetEffectsFadeVolume(0); SampleManager.SetMusicFadeVolume(0); MusicManager.ResetMusicAfterReload(); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 7f497e85..5c142f5d 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -471,7 +471,7 @@ public: void ProcessScriptObject(int32 id); // done void ProcessSpecial(); // done #ifdef GTA_TRAIN - bool ProcessTrainNoise(cVehicleParams ¶ms); //done(bcs not exists in VC) + bool8 ProcessTrainNoise(cVehicleParams ¶ms); //done(bcs not exists in VC) #endif void ProcessVehicle(CVehicle *vehicle); // done bool8 ProcessVehicleDoors(cVehicleParams ¶ms); // done @@ -549,7 +549,24 @@ public: #endif }; -//#ifdef AUDIO_MSS +/* + Manual loop points are not on PS2 so let's have these macros to avoid massive ifndefs. + Setting these manually was pointless anyway since they never change from sdt values. + What were they thinking? +*/ +#ifndef GTA_PS2 +#define RESET_LOOP_OFFSETS \ + m_sQueueSample.m_nLoopStart = 0; \ + m_sQueueSample.m_nLoopEnd = -1; +#define SET_LOOP_OFFSETS(sample) \ + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \ + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample); +#else +#define RESET_LOOP_OFFSETS +#define SET_LOOP_OFFSETS(sample) +#endif + +//#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS) //static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); //#endif What were they thinking? diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 61b663d7..b8501339 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -1368,7 +1368,7 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh) bool8 cMusicManager::UsesTaxiRadio(CVehicle *veh) { - if (veh->GetModelIndex() != MI_CABBIE) return false; + if (veh->GetModelIndex() != MI_CABBIE) return FALSE; return CTheScripts::bPlayerHasMetDebbieHarry; } diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index e9e6afb7..192eafac 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -141,7 +141,7 @@ enum eAudioType #ifdef GTA_PS2 enum { - NUM_CHANNELS_GENERIC = 42, + NUM_CHANNELS_GENERIC = 40, CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC, CHANNEL_MISSION_AUDIO_1, CHANNEL_MISSION_AUDIO_2, @@ -152,11 +152,13 @@ enum enum { #ifdef PS2_AUDIO_CHANNELS - NUM_CHANNELS_GENERIC = 42, + NUM_CHANNELS_GENERIC = 40, #else - NUM_CHANNELS_GENERIC = 27, + NUM_CHANNELS_GENERIC = 20, #endif CHANNEL_POLICE_RADIO, + CHANNEL_MISSION_AUDIO_1, + CHANNEL_MISSION_AUDIO_2, NUM_CHANNELS }; #endif diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 4a43aaec..5e2b348b 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1786,8 +1786,8 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -1817,8 +1817,8 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -1919,8 +1919,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { nChannelVolume[nChannel] = vol; @@ -1948,8 +1948,8 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { #ifndef FIX_BUGS if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG @@ -1971,8 +1971,8 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -1999,8 +1999,8 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -2027,8 +2027,8 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -2055,8 +2055,8 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -2088,8 +2088,8 @@ cSampleManager::StartChannel(uint32 nChannel) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; @@ -2116,8 +2116,8 @@ cSampleManager::StopChannel(uint32 nChannel) switch ( nChannel ) { case CHANNEL_POLICE_RADIO: - case CHANNEL2D+1: - case CHANNEL2D+2: + case CHANNEL_MISSION_AUDIO_1: + case CHANNEL_MISSION_AUDIO_2: { b2d = TRUE; break; diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index a4ff5941..186990a4 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -215,7 +215,6 @@ add_providers() static void release_existing() { - for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ ) if ( IsFXSupported() ) { if ( alIsEffect(ALEffect) ) @@ -280,7 +279,6 @@ set_new_provider(int index) //SampleManager.SetSpeakerConfig(speaker_type); - aChannel[CHANNEL2D+i].Init(CHANNEL2D+i, true); if ( IsFXSupported() ) { for ( int32 i = 0; i < MAXCHANNELS; i++ ) @@ -1653,7 +1651,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) void cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) { - ASSERT( nChannel < CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); uint32 vol = nVolume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; @@ -1674,7 +1672,7 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) void cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ) { - ASSERT( nChannel < CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); aChannel[nChannel].SetPosition(-fX, fY, fZ); } @@ -1682,17 +1680,17 @@ cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float void cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin) { - ASSERT( nChannel < CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); aChannel[nChannel].SetDistances(fMax, fMin); } void cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) { - ASSERT(nChannel >= CHANNEL2D ); + ASSERT( nChannel >= MAXCHANNELS ); ASSERT( nChannel < NUM_CHANNELS ); - if(nChannel >= CHANNEL2D) + if( nChannel >= CHANNEL_POLICE_RADIO ) { uint32 vol = nVolume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; @@ -1714,10 +1712,10 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) void cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) { - ASSERT(nChannel >= CHANNEL2D); + ASSERT( nChannel >= MAXCHANNELS ); ASSERT( nChannel < NUM_CHANNELS ); - if ( nChannel >= CHANNEL2D ) + if ( nChannel >= CHANNEL_POLICE_RADIO ) { aChannel[nChannel].SetPan(nPan); } diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1bf94156..536055fa 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2104,7 +2104,7 @@ void CMissionCleanup::Process() CWorld::Players[0].m_bDriveByAllowed = true; CPad::GetPad(0)->unk_B4 = 1.0f; CPad::GetPad(0)->unk_B8 = 0.5f; - DMAudio.ShutUpPlayerTalking(0); + DMAudio.ShutUpPlayerTalking(FALSE); CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; CTheScripts::RiotIntensity = 0; diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index eb2254b9..33042bac 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1396,7 +1396,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); - DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, 0); + DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE); //DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO! return 0; } diff --git a/src/core/config.h b/src/core/config.h index cdc91dc0..7b8a15d4 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -399,7 +399,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually // Audio #define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS //#define AUDIO_CACHE // cache sound lengths to speed up the cold boot -#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally) +#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally) //#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files