mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 14:33:44 +00:00
Increase the number of audio channels to PS2 count and some small audio fixes
This commit is contained in:
parent
b5bc3a9000
commit
60bb16d26c
10 changed files with 134 additions and 107 deletions
|
@ -43,9 +43,9 @@
|
|||
#include "Script.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||
const int policeChannel = channels + 1;
|
||||
const int allChannels = channels + 2;
|
||||
#ifndef GTA_PS2
|
||||
#define CHANNEL_PLAYER_VEHICLE_ENGINE m_nActiveSamples
|
||||
#endif
|
||||
|
||||
enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED };
|
||||
enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED };
|
||||
|
@ -246,23 +246,25 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
|
|||
}
|
||||
ClearMissionAudio(0);
|
||||
ClearMissionAudio(1);
|
||||
SampleManager.StopChannel(policeChannel);
|
||||
SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ProcessReverb() const
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
const uint32 numChannels = channels;
|
||||
const uint32 numChannels = NUM_CHANNELS_GENERIC;
|
||||
#else
|
||||
const uint32 numChannels = 28;
|
||||
const uint32 numChannels = NUM_CHANNELS_GENERIC+1;
|
||||
#endif
|
||||
|
||||
if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
|
||||
#ifndef GTA_PS2
|
||||
for (uint32 i = 0; i < numChannels; i++) {
|
||||
if (m_asActiveSamples[i].m_bReverbFlag)
|
||||
SampleManager.SetChannelReverbFlag(i, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +349,7 @@ cAudioManager::ProcessSpecial()
|
|||
if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) {
|
||||
if (playerPed->EnteringCar()) {
|
||||
if(!playerPed->bInVehicle && CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil)
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1316,7 +1318,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
|
|||
playerVeh = FindPlayerVehicle();
|
||||
veh = params.m_pVehicle;
|
||||
if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
return;
|
||||
}
|
||||
if (!veh->bEngineOn)
|
||||
|
@ -1682,7 +1684,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
accelerateState = Pads[0].GetAccelerate();
|
||||
brakeState = Pads[0].GetBrake();
|
||||
}
|
||||
channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
|
||||
channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
if (isMoped) {
|
||||
CurrentPretendGear = params.m_pTransmission->nNumberOfGears;
|
||||
currentGear = CurrentPretendGear;
|
||||
|
@ -1846,7 +1848,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
if (accelerateState <= 0) {
|
||||
if (params.m_fVelocityChange < -0.001f) {
|
||||
if (channelUsed) {
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
bAccelSampleStopped = TRUE;
|
||||
}
|
||||
if (wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction)
|
||||
|
@ -1858,7 +1860,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
*gasPedalAudioPtr = Max(0.0f, gasPedalAudio);
|
||||
} else if (LastAccel > 0) {
|
||||
if (channelUsed) {
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
bAccelSampleStopped = TRUE;
|
||||
}
|
||||
nCruising = 0;
|
||||
|
@ -1919,7 +1921,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
if (channelUsed) {
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
bAccelSampleStopped = TRUE;
|
||||
}
|
||||
if (params.m_pVehicle->bIsDrowning)
|
||||
|
@ -1934,55 +1936,55 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
bAccelSampleStopped = FALSE;
|
||||
}
|
||||
if (channelUsed) {
|
||||
SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120);
|
||||
SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f);
|
||||
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
|
||||
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
|
||||
freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) ;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
|
||||
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
|
||||
if (!channelUsed) {
|
||||
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(m_nActiveSamples);
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
}
|
||||
} else if (processedAccelSampleStopped) {
|
||||
gearSoundStartTime = CTimer::GetTimeInMilliseconds();
|
||||
params.m_pVehicle->bAudioChangingGear = TRUE;
|
||||
if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0))
|
||||
if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0))
|
||||
return;
|
||||
SampleManager.SetChannelLoopCount(m_nActiveSamples, 1);
|
||||
SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1);
|
||||
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
|
||||
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
|
||||
|
||||
SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120);
|
||||
SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f);
|
||||
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
|
||||
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
|
||||
freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050);
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
|
||||
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
|
||||
if (!channelUsed) {
|
||||
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(m_nActiveSamples);
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
}
|
||||
} else if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1) {
|
||||
++CurrentPretendGear;
|
||||
gearSoundStartTime = CTimer::GetTimeInMilliseconds();
|
||||
params.m_pVehicle->bAudioChangingGear = TRUE;
|
||||
if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0))
|
||||
if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0))
|
||||
return;
|
||||
SampleManager.SetChannelLoopCount(m_nActiveSamples, 1);
|
||||
SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1);
|
||||
SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1);
|
||||
SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1);
|
||||
|
||||
SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120);
|
||||
SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f);
|
||||
SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120);
|
||||
SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
|
||||
SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f);
|
||||
freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050);
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
|
||||
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq);
|
||||
if (!channelUsed) {
|
||||
SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(m_nActiveSamples);
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE);
|
||||
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
}
|
||||
} else {
|
||||
nCruising = 1;
|
||||
|
@ -1992,7 +1994,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
|
|||
} else {
|
||||
PlayCruising:
|
||||
bAccelSampleStopped = TRUE;
|
||||
SampleManager.StopChannel(m_nActiveSamples);
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn
|
||||
&& !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) {
|
||||
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
|
||||
cAudioManager AudioManager;
|
||||
|
||||
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||
const int policeChannel = channels + 1;
|
||||
const int allChannels = channels + 2;
|
||||
|
||||
#define SPEED_OF_SOUND 343.f
|
||||
#define TIME_SPENT 40
|
||||
|
||||
|
@ -28,7 +24,7 @@ cAudioManager::cAudioManager()
|
|||
field_6 = 0;
|
||||
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
|
||||
m_nTimeSpent = TIME_SPENT;
|
||||
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
||||
m_nActiveSamples = NUM_CHANNELS_GENERIC;
|
||||
m_nActiveSampleQueue = 1;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 0;
|
||||
|
@ -276,7 +272,7 @@ cAudioManager::ResetTimers(uint32 time)
|
|||
ClearActiveSamples();
|
||||
ClearMissionAudio(0);
|
||||
ClearMissionAudio(1);
|
||||
SampleManager.StopChannel(policeChannel);
|
||||
SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
SampleManager.SetEffectsFadeVolume(0);
|
||||
SampleManager.SetMusicFadeVolume(0);
|
||||
MusicManager.ResetMusicAfterReload();
|
||||
|
@ -446,7 +442,7 @@ cAudioManager::ServiceSoundEffects()
|
|||
{
|
||||
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
|
||||
if (m_nUserPause && !m_nPreviousUserPause) {
|
||||
for (int32 i = 0; i < allChannels; i++)
|
||||
for (int32 i = 0; i < NUM_CHANNELS; i++)
|
||||
SampleManager.StopChannel(i);
|
||||
|
||||
ClearRequestedQueue();
|
||||
|
@ -773,7 +769,12 @@ cAudioManager::UpdateReflections()
|
|||
void
|
||||
cAudioManager::AddReleasingSounds()
|
||||
{
|
||||
bool8 toProcess[44]; // why not 27?
|
||||
// in case someone would want to increase it
|
||||
#ifdef FIX_BUGS
|
||||
bool8 toProcess[NUM_CHANNELS_GENERIC];
|
||||
#else
|
||||
bool8 toProcess[44];
|
||||
#endif
|
||||
|
||||
int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0;
|
||||
|
||||
|
|
|
@ -205,10 +205,10 @@ public:
|
|||
int32 m_nTimer;
|
||||
tSound m_sQueueSample;
|
||||
uint8 m_nActiveSampleQueue;
|
||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
||||
tSound m_asActiveSamples[NUM_SOUNDS_SAMPLES_SLOTS];
|
||||
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
|
||||
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
|
||||
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
|
||||
int32 m_nAudioEntitiesTotal;
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
#include "sampman.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||
const int policeChannel = channels + 1;
|
||||
|
||||
struct tPoliceRadioZone {
|
||||
char m_aName[8];
|
||||
uint32 m_nSampleIndex;
|
||||
|
@ -68,7 +65,7 @@ cAudioManager::InitialisePoliceRadio()
|
|||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
|
||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
||||
|
||||
SampleManager.SetChannelReverbFlag(policeChannel, FALSE);
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
||||
gSpecialSuspectLastSeenReport = FALSE;
|
||||
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
||||
gMinTimeToNextReport[i] = m_FrameCounter;
|
||||
|
@ -78,7 +75,7 @@ void
|
|||
cAudioManager::ResetPoliceRadio()
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
InitialisePoliceRadio();
|
||||
}
|
||||
|
||||
|
@ -168,7 +165,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (m_nUserPause != 0) {
|
||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
|
@ -200,7 +197,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
}
|
||||
return;
|
||||
}
|
||||
} else if (!SampleManager.GetChannelUsedFlag(policeChannel)) {
|
||||
} else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
|
||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
|
||||
SampleManager.StartPreloadedStreamedFile(1);
|
||||
|
@ -211,7 +208,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
}
|
||||
if (bChannelOpen) DoPoliceRadioCrackle();
|
||||
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) &&
|
||||
!SampleManager.GetChannelUsedFlag(policeChannel) && m_sPoliceRadioQueue.policeChannelTimer) {
|
||||
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
|
||||
if (m_sPoliceRadioQueue.policeChannelTimer) {
|
||||
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
|
||||
m_sPoliceRadioQueue.policeChannelTimer--;
|
||||
|
@ -230,7 +227,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
if (sample == NO_SAMPLE) {
|
||||
if (!processed) cWait = 30;
|
||||
} else {
|
||||
SampleManager.InitialiseChannel(policeChannel, sample, 0);
|
||||
SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, 0);
|
||||
switch (sample) {
|
||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
||||
freq = m_anRandomTable[4] % 2000 + 10025;
|
||||
|
@ -239,12 +236,12 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
||||
}
|
||||
PoliceChannelFreq = freq;
|
||||
SampleManager.SetChannelFrequency(policeChannel, freq);
|
||||
SampleManager.SetChannelVolume(policeChannel, 100);
|
||||
SampleManager.SetChannelPan(policeChannel, 63);
|
||||
SampleManager.SetChannelLoopCount(policeChannel, 1);
|
||||
SampleManager.SetChannelLoopPoints(policeChannel, 0, -1);
|
||||
SampleManager.StartChannel(policeChannel);
|
||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
||||
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
||||
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
||||
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
||||
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
||||
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
||||
}
|
||||
if (processed) ResetPoliceRadio();
|
||||
}
|
||||
|
|
|
@ -137,3 +137,26 @@ enum eAudioType
|
|||
AUDIOTYPE_POLICERADIO,
|
||||
TOTAL_AUDIO_TYPES,
|
||||
};
|
||||
|
||||
#ifdef GTA_PS2
|
||||
enum
|
||||
{
|
||||
NUM_CHANNELS_GENERIC = 42,
|
||||
CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC,
|
||||
CHANNEL_MISSION_AUDIO_1,
|
||||
CHANNEL_MISSION_AUDIO_2,
|
||||
CHANNEL_PLAYER_VEHICLE_ENGINE,
|
||||
NUM_CHANNELS
|
||||
};
|
||||
#else
|
||||
enum
|
||||
{
|
||||
#ifdef PS2_AUDIO_CHANNELS
|
||||
NUM_CHANNELS_GENERIC = 42,
|
||||
#else
|
||||
NUM_CHANNELS_GENERIC = 27,
|
||||
#endif
|
||||
CHANNEL_POLICE_RADIO,
|
||||
NUM_CHANNELS
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
extern bool IsFXSupported();
|
||||
|
||||
ALuint alSources[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alSources[NUM_CHANNELS];
|
||||
ALuint alFilters[NUM_CHANNELS];
|
||||
ALuint alBuffers[NUM_CHANNELS];
|
||||
bool bChannelsCreated = false;
|
||||
|
||||
int32 CChannel::channelsThatNeedService = 0;
|
||||
|
@ -22,10 +22,10 @@ uint8 tempStereoBuffer[PED_BLOCKSIZE * 2];
|
|||
void
|
||||
CChannel::InitChannels()
|
||||
{
|
||||
alGenSources(MAXCHANNELS+MAX2DCHANNELS, alSources);
|
||||
alGenBuffers(MAXCHANNELS+MAX2DCHANNELS, alBuffers);
|
||||
alGenSources(NUM_CHANNELS, alSources);
|
||||
alGenBuffers(NUM_CHANNELS, alBuffers);
|
||||
if (IsFXSupported())
|
||||
alGenFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
||||
alGenFilters(NUM_CHANNELS, alFilters);
|
||||
bChannelsCreated = true;
|
||||
}
|
||||
|
||||
|
@ -34,13 +34,13 @@ CChannel::DestroyChannels()
|
|||
{
|
||||
if (bChannelsCreated)
|
||||
{
|
||||
alDeleteSources(MAXCHANNELS + MAX2DCHANNELS, alSources);
|
||||
alDeleteSources(NUM_CHANNELS, alSources);
|
||||
memset(alSources, 0, sizeof(alSources));
|
||||
alDeleteBuffers(MAXCHANNELS + MAX2DCHANNELS, alBuffers);
|
||||
alDeleteBuffers(NUM_CHANNELS, alBuffers);
|
||||
memset(alBuffers, 0, sizeof(alBuffers));
|
||||
if (IsFXSupported())
|
||||
{
|
||||
alDeleteFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
||||
alDeleteFilters(NUM_CHANNELS, alFilters);
|
||||
memset(alFilters, 0, sizeof(alFilters));
|
||||
}
|
||||
bChannelsCreated = false;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "AudioSamples.h"
|
||||
#include "audio_enums.h"
|
||||
|
||||
#define MAX_VOLUME 127
|
||||
#define MAX_FREQ DIGITALRATE
|
||||
|
@ -115,10 +116,9 @@ enum
|
|||
|
||||
#define MAXPROVIDERS 64
|
||||
|
||||
#define MAXCHANNELS 28
|
||||
#define MAXCHANNELS_SURROUND 24
|
||||
#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1)
|
||||
#define MAXCHANNELS_SURROUND (MAXCHANNELS-4)
|
||||
#define MAX2DCHANNELS 3
|
||||
#define CHANNEL2D MAXCHANNELS
|
||||
|
||||
#define MAX_STREAMS 1
|
||||
|
||||
|
@ -126,7 +126,13 @@ enum
|
|||
#define DIGITALBITS 16
|
||||
#define DIGITALCHANNELS 2
|
||||
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS 34
|
||||
#ifdef FIX_BUGS
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2+MAX2DCHANNELS)
|
||||
#else
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2)
|
||||
#endif
|
||||
|
||||
static_assert( NUM_CHANNELS == MAXCHANNELS + MAX2DCHANNELS, "The number of channels doesn't match with an enum" );
|
||||
|
||||
extern int gBankStartOffset[67];
|
||||
|
||||
|
|
|
@ -1785,7 +1785,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -1816,7 +1816,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -1918,7 +1918,7 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -1947,7 +1947,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
|||
{
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -1970,7 +1970,7 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -1998,7 +1998,7 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -2026,7 +2026,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -2054,7 +2054,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -2087,7 +2087,7 @@ cSampleManager::StartChannel(uint32 nChannel)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
@ -2115,7 +2115,7 @@ cSampleManager::StopChannel(uint32 nChannel)
|
|||
|
||||
switch ( nChannel )
|
||||
{
|
||||
case CHANNEL2D:
|
||||
case CHANNEL_POLICE_RADIO:
|
||||
case CHANNEL2D+1:
|
||||
case CHANNEL2D+2:
|
||||
{
|
||||
|
|
|
@ -94,8 +94,8 @@ int32 nPedSlotSfx [MAX_PEDSFX];
|
|||
int32 nPedSlotSfxAddr[MAX_PEDSFX];
|
||||
uint8 nCurrentPedSlot;
|
||||
|
||||
CChannel aChannel[MAXCHANNELS+MAX2DCHANNELS];
|
||||
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
||||
CChannel aChannel[NUM_CHANNELS];
|
||||
uint8 nChannelVolume[NUM_CHANNELS];
|
||||
|
||||
uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
|
||||
ALuint ALStreamSources[MAX_STREAMS][2];
|
||||
|
@ -283,7 +283,8 @@ set_new_provider(int index)
|
|||
_maxSamples = MAXCHANNELS;
|
||||
|
||||
ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ,
|
||||
ALC_MONO_SOURCES, MAX_STREAMS * 2 + MAXCHANNELS,
|
||||
ALC_MONO_SOURCES, MAX_DIGITAL_MIXER_CHANNELS - MAX2DCHANNELS,
|
||||
ALC_STEREO_SOURCES, MAX2DCHANNELS,
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -1052,7 +1053,7 @@ cSampleManager::Initialise(void)
|
|||
}
|
||||
|
||||
{
|
||||
for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
|
||||
for ( int32 i = 0; i < NUM_CHANNELS; i++ )
|
||||
nChannelVolume[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -1276,7 +1277,7 @@ cSampleManager::UpdateEffectsVolume(void)
|
|||
{
|
||||
if ( _bSampmanInitialised )
|
||||
{
|
||||
for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
|
||||
for ( int32 i = 0; i < NUM_CHANNELS; i++ )
|
||||
{
|
||||
if ( GetChannelUsedFlag(i) )
|
||||
{
|
||||
|
@ -1584,7 +1585,7 @@ bool8 cSampleManager::UpdateReverb(void)
|
|||
void
|
||||
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
if ( usingEAX || _usingEFX )
|
||||
{
|
||||
|
@ -1603,7 +1604,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
|||
bool8
|
||||
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
uintptr addr;
|
||||
|
||||
|
@ -1645,7 +1646,6 @@ void
|
|||
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT( nChannel < CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
|
||||
uint32 vol = nVolume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
@ -1667,7 +1667,6 @@ void
|
|||
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
|
||||
{
|
||||
ASSERT( nChannel < CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
|
||||
aChannel[nChannel].SetPosition(-fX, fY, fZ);
|
||||
}
|
||||
|
@ -1676,7 +1675,6 @@ void
|
|||
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
|
||||
{
|
||||
ASSERT( nChannel < CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
aChannel[nChannel].SetDistances(fMax, fMin);
|
||||
}
|
||||
|
||||
|
@ -1684,7 +1682,7 @@ void
|
|||
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT(nChannel >= CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
if(nChannel >= CHANNEL2D)
|
||||
{
|
||||
|
@ -1709,7 +1707,7 @@ void
|
|||
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
||||
{
|
||||
ASSERT(nChannel >= CHANNEL2D);
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
if ( nChannel >= CHANNEL2D )
|
||||
{
|
||||
|
@ -1720,7 +1718,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
|||
void
|
||||
cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
aChannel[nChannel].SetCurrentFreq(nFreq);
|
||||
}
|
||||
|
@ -1728,7 +1726,7 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
|
|||
void
|
||||
cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
aChannel[nChannel].SetLoopPoints(nLoopStart / (DIGITALBITS / 8), nLoopEnd / (DIGITALBITS / 8));
|
||||
}
|
||||
|
@ -1736,7 +1734,7 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
|
|||
void
|
||||
cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
aChannel[nChannel].SetLoopCount(nLoopCount);
|
||||
}
|
||||
|
@ -1744,7 +1742,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
|||
bool8
|
||||
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
return aChannel[nChannel].IsUsed();
|
||||
}
|
||||
|
@ -1752,7 +1750,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
|||
void
|
||||
cSampleManager::StartChannel(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
aChannel[nChannel].Start();
|
||||
}
|
||||
|
@ -1760,7 +1758,7 @@ cSampleManager::StartChannel(uint32 nChannel)
|
|||
void
|
||||
cSampleManager::StopChannel(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
ASSERT( nChannel < NUM_CHANNELS );
|
||||
|
||||
aChannel[nChannel].Stop();
|
||||
}
|
||||
|
@ -2167,7 +2165,7 @@ cSampleManager::Service(void)
|
|||
stream->Update();
|
||||
}
|
||||
int refCount = CChannel::channelsThatNeedService;
|
||||
for ( int32 i = 0; refCount && i < MAXCHANNELS+MAX2DCHANNELS; i++ )
|
||||
for ( int32 i = 0; refCount && i < NUM_CHANNELS; i++ )
|
||||
{
|
||||
if ( aChannel[i].Update() )
|
||||
refCount--;
|
||||
|
|
|
@ -131,7 +131,6 @@ enum Config {
|
|||
NUM_PED_COMMENTS_SLOTS = 20,
|
||||
|
||||
NUM_SOUNDS_SAMPLES_BANKS = 2,
|
||||
NUM_SOUNDS_SAMPLES_SLOTS = 27,
|
||||
NUM_AUDIOENTITIES = 250,
|
||||
|
||||
NUM_AUDIO_REFLECTIONS = 8,
|
||||
|
@ -400,6 +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_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
|
||||
|
|
Loading…
Reference in a new issue