summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/sampman_oal.cpp58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index e74fac82..a4c92482 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];
@@ -213,9 +213,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() )
{
@@ -284,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,
};
@@ -370,8 +370,9 @@ set_new_provider(int index)
CChannel::InitChannels();
for ( int32 i = 0; i < MAXCHANNELS; i++ )
- aChannel[i].Init(i);
- aChannel[CHANNEL2D].Init(CHANNEL2D, true);
+ aChannel[i].Init(i);
+ for ( int32 i = 0; i < MAX2DCHANNELS; i++ )
+ aChannel[MAXCHANNELS+i].Init(MAXCHANNELS+i, true);
if ( IsFXSupported() )
{
@@ -978,7 +979,7 @@ cSampleManager::Initialise(void)
}
{
- for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
+ for ( int32 i = 0; i < NUM_CHANNELS; i++ )
nChannelVolume[i] = 0;
}
@@ -1184,7 +1185,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) )
{
@@ -1492,7 +1493,7 @@ bool8 cSampleManager::UpdateReverb(void)
void
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
if ( usingEAX || _usingEFX )
{
@@ -1511,7 +1512,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;
@@ -1552,8 +1553,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;
@@ -1574,8 +1574,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);
}
@@ -1583,18 +1582,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;
@@ -1616,10 +1614,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);
}
@@ -1628,7 +1626,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);
}
@@ -1636,7 +1634,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));
}
@@ -1644,7 +1642,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);
}
@@ -1652,7 +1650,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
bool8
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
return aChannel[nChannel].IsUsed();
}
@@ -1660,7 +1658,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
void
cSampleManager::StartChannel(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
aChannel[nChannel].Start();
}
@@ -1668,7 +1666,7 @@ cSampleManager::StartChannel(uint32 nChannel)
void
cSampleManager::StopChannel(uint32 nChannel)
{
- ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
+ ASSERT( nChannel < NUM_CHANNELS );
aChannel[nChannel].Stop();
}
@@ -2007,7 +2005,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--;