Audio: bits of PS2 code

This commit is contained in:
Sergeanur 2021-08-21 08:42:00 +03:00
parent 80b7d52eeb
commit fe51abd534
3 changed files with 33 additions and 4 deletions

View File

@ -2017,7 +2017,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
bool8 isMoped = FALSE;
bool8 processedAccelSampleStopped = FALSE;
static uint32 gearSoundStartTime = CTimer::GetTimeInMilliseconds();
uint8 nChannel = CHANNEL_PLAYER_VEHICLE_ENGINE; // TODO: PS2 channels
#ifdef GTA_PS2
uint8 nChannel = m_bIsSurround ? CHANNEL_DTS_PLAYER_VEHICLE_ENGINE : CHANNEL_PLAYER_VEHICLE_ENGINE;
#else
uint8 nChannel = CHANNEL_PLAYER_VEHICLE_ENGINE;
#endif
if (bPlayerJustEnteredCar) {
bAccelSampleStopped = TRUE;
bPlayerJustEnteredCar = FALSE;

View File

@ -493,9 +493,28 @@ cAudioManager::ServiceSoundEffects()
#endif
m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) {
for (int32 i = 0; i < NUM_CHANNELS; i++)
SampleManager.StopChannel(i);
#ifdef GTA_PS2
if (m_bIsSurround) {
for (uint32 i = 0; i < NUM_CHANNELS_DTS_GENERIC; i++)
SampleManager.StopChannel(i);
SampleManager.SetChannelFrequency(CHANNEL_DTS_POLICE_RADIO, 0);
SampleManager.SetChannelFrequency(CHANNEL_DTS_MISSION_AUDIO_1, 0);
SampleManager.SetChannelFrequency(CHANNEL_DTS_MISSION_AUDIO_2, 0);
SampleManager.SetChannelFrequency(CHANNEL_DTS_PLAYER_VEHICLE_ENGINE, 0);
} else {
for (uint32 i = 0; i < NUM_CHANNELS_GENERIC; i++)
SampleManager.StopChannel(i);
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, 0);
SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO_1, 0);
SampleManager.SetChannelFrequency(CHANNEL_MISSION_AUDIO_2, 0);
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, 0);
}
#else
for (uint32 i = 0; i < NUM_CHANNELS; i++)
SampleManager.StopChannel(i);
#endif
ClearRequestedQueue();
if (m_nActiveSampleQueue) {
m_nActiveSampleQueue = 0;

View File

@ -1304,7 +1304,13 @@ enum
CHANNEL_MISSION_AUDIO_1,
CHANNEL_MISSION_AUDIO_2,
CHANNEL_PLAYER_VEHICLE_ENGINE,
NUM_CHANNELS
NUM_CHANNELS,
NUM_CHANNELS_DTS_GENERIC = 18,
CHANNEL_DTS_POLICE_RADIO = NUM_CHANNELS_DTS_GENERIC,
CHANNEL_DTS_MISSION_AUDIO_1,
CHANNEL_DTS_MISSION_AUDIO_2,
CHANNEL_DTS_PLAYER_VEHICLE_ENGINE,
};
#else
enum