summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-05-23 15:14:30 +0200
committerSergeanur <s.anureev@yandex.ua>2021-06-24 20:32:43 +0200
commit7a2dbd9112d9537453bb51a503858b769af32204 (patch)
treea22d211dbc943a08b64449e57961230736de671f
parentThis means sound should be panned right, not volume (diff)
downloadre3-7a2dbd9112d9537453bb51a503858b769af32204.tar
re3-7a2dbd9112d9537453bb51a503858b769af32204.tar.gz
re3-7a2dbd9112d9537453bb51a503858b769af32204.tar.bz2
re3-7a2dbd9112d9537453bb51a503858b769af32204.tar.lz
re3-7a2dbd9112d9537453bb51a503858b769af32204.tar.xz
re3-7a2dbd9112d9537453bb51a503858b769af32204.tar.zst
re3-7a2dbd9112d9537453bb51a503858b769af32204.zip
-rw-r--r--src/audio/AudioLogic.cpp44
-rw-r--r--src/audio/AudioManager.cpp17
-rw-r--r--src/audio/AudioManager.h8
-rw-r--r--src/audio/audio_enums.h22
-rw-r--r--src/audio/oal/channel.cpp18
-rw-r--r--src/audio/sampman.h14
-rw-r--r--src/audio/sampman_miles.cpp20
-rw-r--r--src/audio/sampman_oal.cpp55
-rw-r--r--src/core/config.h2
9 files changed, 114 insertions, 86 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index f63ea4b3..17d31330 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -38,9 +38,9 @@
#include "ZoneCull.h"
#include "sampman.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
uint32 gPornNextTime;
uint32 gSawMillNextTime;
@@ -224,24 +224,26 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
}
}
ClearMissionAudio();
- SampleManager.StopChannel(policeChannel);
+ SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
}
void
cAudioManager::ProcessReverb() const
{
if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
+#ifndef GTA_PS2
for (uint32 i = 0; i <
#ifdef FIX_BUGS
- channels
+ NUM_CHANNELS_GENERIC
#else
- 28
+ NUM_CHANNELS_GENERIC+1
#endif
;
i++) {
if (m_asActiveSamples[i].m_bReverbFlag)
SampleManager.SetChannelReverbFlag(i, TRUE);
}
+#endif
}
}
@@ -278,7 +280,7 @@ cAudioManager::ProcessSpecial()
CPlayerPed *playerPed = FindPlayerPed();
if (playerPed) {
if(playerPed->EnteringCar() && !playerPed->bInVehicle)
- SampleManager.StopChannel(m_nActiveSamples);
+ SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
}
}
}
@@ -931,7 +933,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) {
@@ -1231,7 +1233,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
else
accelerateState = Pads[0].GetAccelerate();
- channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
+ channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE);
transmission = params.m_pTransmission;
velocityChange = params.m_fVelocityChange;
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
@@ -1278,7 +1280,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
if (accelerateState <= 0) {
if (params.m_fVelocityChange < -0.001f) {
if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
+ SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
bAccelSampleStopped = TRUE;
}
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction)
@@ -1290,7 +1292,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
automobile->m_fGasPedalAudio = gasPedalAudio;
} else if (LastAccel > 0) {
if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
+ SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
bAccelSampleStopped = TRUE;
}
nCruising = 0;
@@ -1334,7 +1336,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
+ SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
bAccelSampleStopped = TRUE;
}
AddPlayerCarSample(vol, freq, (engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_REV_1), SFX_BANK_0, 2, TRUE);
@@ -1361,22 +1363,22 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
}
}
- 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, 85);
- SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f);
+ SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 85);
+ SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z);
+ SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.f, 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);
}
}
break;
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 8d9d867d..1f758dd2 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -13,10 +13,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 50
@@ -26,7 +22,7 @@ cAudioManager::cAudioManager()
m_bReverb = TRUE;
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;
@@ -267,7 +263,7 @@ cAudioManager::ResetTimers(uint32 time)
}
ClearActiveSamples();
ClearMissionAudio();
- SampleManager.StopChannel(policeChannel);
+ SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
SampleManager.SetEffectsFadeVolume(0);
SampleManager.SetMusicFadeVolume(0);
MusicManager.ResetMusicAfterReload();
@@ -429,7 +425,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();
@@ -692,7 +688,12 @@ cAudioManager::UpdateReflections()
void
cAudioManager::AddReleasingSounds()
{
- bool8 toProcess[44]; // why not 27? because PS2?
+ // 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;
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 4a888788..a3ae4cfb 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -195,10 +195,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;
@@ -498,7 +498,7 @@ public:
#endif
};
-#ifdef AUDIO_MSS
+#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
#endif
diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h
index 027042cb..69d37a64 100644
--- a/src/audio/audio_enums.h
+++ b/src/audio/audio_enums.h
@@ -254,3 +254,25 @@ enum eAudioType
AUDIOTYPE_POLICERADIO,
TOTAL_AUDIO_TYPES,
};
+
+#ifdef GTA_PS2
+enum
+{
+ NUM_CHANNELS_GENERIC = 43,
+ CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC,
+ CHANNEL_MISSION_AUDIO,
+ CHANNEL_PLAYER_VEHICLE_ENGINE,
+ NUM_CHANNELS
+};
+#else
+enum
+{
+#ifdef PS2_AUDIO_CHANNELS
+ NUM_CHANNELS_GENERIC = 43,
+#else
+ NUM_CHANNELS_GENERIC = 27,
+#endif
+ CHANNEL_POLICE_RADIO,
+ NUM_CHANNELS
+};
+#endif
diff --git a/src/audio/oal/channel.cpp b/src/audio/oal/channel.cpp
index 1bb4c4a8..04e7e529 100644
--- a/src/audio/oal/channel.cpp
+++ b/src/audio/oal/channel.cpp
@@ -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;
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 765c75d3..b5f72d5c 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -1,5 +1,6 @@
#pragma once
#include "AudioSamples.h"
+#include "audio_enums.h"
#define MAX_VOLUME 127
#define MAX_FREQ DIGITALRATE
@@ -99,10 +100,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 1
-#define CHANNEL2D MAXCHANNELS
#define MAX_STREAMS 2
@@ -110,7 +110,13 @@ enum
#define DIGITALBITS 16
#define DIGITALCHANNELS 2
-#define MAX_DIGITAL_MIXER_CHANNELS 32
+#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" );
class cSampleManager
{
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 4237c6a3..ddfaaa5f 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1657,7 +1657,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1686,7 +1686,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1786,7 +1786,7 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
nChannelVolume[nChannel] = vol;
@@ -1814,7 +1814,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
#ifndef FIX_BUGS
if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
@@ -1835,7 +1835,7 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1861,7 +1861,7 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1887,7 +1887,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1913,7 +1913,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1944,7 +1944,7 @@ cSampleManager::StartChannel(uint32 nChannel)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
@@ -1970,7 +1970,7 @@ cSampleManager::StopChannel(uint32 nChannel)
switch ( nChannel )
{
- case CHANNEL2D:
+ case CHANNEL_POLICE_RADIO:
{
b2d = TRUE;
break;
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 15add7cb..18d1ca37 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -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];
@@ -212,9 +212,8 @@ add_providers()
static void
release_existing()
{
- for ( int32 i = 0; i < MAXCHANNELS; i++ )
+ for ( int32 i = 0; i < NUM_CHANNELS; i++ )
aChannel[i].Term();
- aChannel[CHANNEL2D].Term();
if ( IsFXSupported() )
{
@@ -283,7 +282,7 @@ 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,
0,
};
@@ -370,7 +369,8 @@ set_new_provider(int index)
for ( int32 i = 0; i < MAXCHANNELS; i++ )
aChannel[i].Init(i);
- aChannel[CHANNEL2D].Init(CHANNEL2D, true);
+ for ( int32 i = 0; i < MAX2DCHANNELS; i++ )
+ aChannel[MAXCHANNELS+i].Init(MAXCHANNELS+i, true);
if ( IsFXSupported() )
{
@@ -950,7 +950,7 @@ cSampleManager::Initialise(void)
}
{
- for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
+ for ( int32 i = 0; i < NUM_CHANNELS; i++ )
nChannelVolume[i] = 0;
}
@@ -1153,7 +1153,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) )
{
@@ -1461,7 +1461,7 @@ bool8 cSampleManager::UpdateReverb(void)
void
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
if ( usingEAX || _usingEFX )
{
@@ -1480,7 +1480,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;
@@ -1521,8 +1521,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
- ASSERT( nChannel != CHANNEL2D );
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < MAXCHANNELS );
uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
@@ -1544,8 +1543,7 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
void
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
{
- ASSERT( nChannel != CHANNEL2D );
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < MAXCHANNELS );
aChannel[nChannel].SetPosition(-fX, fY, fZ);
}
@@ -1553,18 +1551,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+MAX2DCHANNELS );
+ ASSERT( nChannel < MAXCHANNELS );
aChannel[nChannel].SetDistances(fMax, fMin);
}
void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{
- ASSERT( nChannel == CHANNEL2D );
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ 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;
@@ -1586,10 +1583,10 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
void
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{
- ASSERT(nChannel == CHANNEL2D);
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel >= MAXCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
- if ( nChannel == CHANNEL2D )
+ if ( nChannel == CHANNEL_POLICE_RADIO )
{
aChannel[nChannel].SetPan(nPan);
}
@@ -1598,7 +1595,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);
}
@@ -1606,7 +1603,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));
}
@@ -1614,7 +1611,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);
}
@@ -1622,7 +1619,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
bool8
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
return aChannel[nChannel].IsUsed();
}
@@ -1630,7 +1627,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
void
cSampleManager::StartChannel(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
aChannel[nChannel].Start();
}
@@ -1638,7 +1635,7 @@ cSampleManager::StartChannel(uint32 nChannel)
void
cSampleManager::StopChannel(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
aChannel[nChannel].Stop();
}
@@ -1961,7 +1958,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--;
diff --git a/src/core/config.h b/src/core/config.h
index ebb26b39..6355c1a5 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -128,7 +128,6 @@ enum Config {
NUM_PED_COMMENTS_SLOTS = 20,
NUM_SOUNDS_SAMPLES_BANKS = 2,
- NUM_SOUNDS_SAMPLES_SLOTS = 27,
NUM_AUDIOENTITIES = 200,
NUM_AUDIO_REFLECTIONS = 5,
@@ -395,6 +394,7 @@ enum Config {
// Audio
#define RADIO_SCROLL_TO_PREV_STATION
#define AUDIO_CACHE
+#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (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