aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-11-07 02:18:24 -0800
committerChris Robinson <[email protected]>2014-11-07 02:18:24 -0800
commit4c3f27193f7379513b3e45398711cfe1238184fd (patch)
tree93499e0af78b28be8568bd4ac689d3a40728b96f /Alc
parent6c954e71dbd99a2ceb072c08481aee92ef8461c0 (diff)
Use a separate macro for the max output channel count
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c4
-rw-r--r--Alc/ALu.c22
-rw-r--r--Alc/effects/autowah.c4
-rw-r--r--Alc/effects/chorus.c4
-rw-r--r--Alc/effects/compressor.c4
-rw-r--r--Alc/effects/dedicated.c8
-rw-r--r--Alc/effects/distortion.c4
-rw-r--r--Alc/effects/echo.c4
-rw-r--r--Alc/effects/equalizer.c4
-rw-r--r--Alc/effects/flanger.c4
-rw-r--r--Alc/effects/modulator.c4
-rw-r--r--Alc/effects/reverb.c10
-rw-r--r--Alc/mixer.c2
-rw-r--r--Alc/panning.c16
14 files changed, 47 insertions, 47 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 0c448d55..ed0019be 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1470,7 +1470,7 @@ void SetDefaultWFXChannelOrder(ALCdevice *device)
{
ALuint i;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
device->ChannelName[i] = InvalidChannel;
switch(device->FmtChans)
@@ -1534,7 +1534,7 @@ void SetDefaultChannelOrder(ALCdevice *device)
{
ALuint i;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
device->ChannelName[i] = InvalidChannel;
switch(device->FmtChans)
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 009d5366..7e88590c 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -129,7 +129,7 @@ static void UpdateDryStepping(DirectParams *params, ALuint num_chans)
for(i = 0;i < num_chans;i++)
{
MixGains *gains = params->Mix.Gains[i];
- for(j = 0;j < MaxChannels;j++)
+ for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
{
gains[j].Current = gains[j].Target;
gains[j].Step = 1.0f;
@@ -143,7 +143,7 @@ static void UpdateDryStepping(DirectParams *params, ALuint num_chans)
for(i = 0;i < num_chans;i++)
{
MixGains *gains = params->Mix.Gains[i];
- for(j = 0;j < MaxChannels;j++)
+ for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
{
ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
@@ -461,10 +461,10 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
for(c = 0;c < num_channels;c++)
{
MixGains *gains = voice->Direct.Mix.Gains[c];
- ALfloat Target[MaxChannels];
+ ALfloat Target[MAX_OUTPUT_CHANNELS];
ComputeBFormatGains(Device, matrix[c], DryGain, Target);
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i].Target = Target[i];
}
/* B-Format cannot handle logarithmic gain stepping, since the gain can
@@ -483,7 +483,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
MixGains *gains = voice->Direct.Mix.Gains[c];
int idx;
- for(j = 0;j < MaxChannels;j++)
+ for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
gains[j].Target = 0.0f;
if((idx=GetChannelIdxByName(Device, chans[c].channel)) != -1)
gains[idx].Target = DryGain;
@@ -528,13 +528,13 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
for(c = 0;c < num_channels;c++)
{
MixGains *gains = voice->Direct.Mix.Gains[c];
- ALfloat Target[MaxChannels];
+ ALfloat Target[MAX_OUTPUT_CHANNELS];
/* Special-case LFE */
if(chans[c].channel == LFE)
{
int idx;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i].Target = 0.0f;
if((idx=GetChannelIdxByName(Device, chans[c].channel)) != -1)
gains[idx].Target = DryGain;
@@ -542,7 +542,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
}
ComputeAngleGains(Device, chans[c].angle, chans[c].elevation, DryGain, Target);
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i].Target = Target[i];
}
UpdateDryStepping(&voice->Direct, num_channels);
@@ -996,7 +996,7 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
{
MixGains *gains = voice->Direct.Mix.Gains[0];
ALfloat radius = ALSource->Radius;
- ALfloat Target[MaxChannels];
+ ALfloat Target[MAX_OUTPUT_CHANNELS];
/* Normalize the length, and compute panned gains. */
if(!(Distance > FLT_EPSILON) && !(radius > FLT_EPSILON))
@@ -1013,7 +1013,7 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
ComputeDirectionalGains(Device, Position, DryGain, Target);
}
- for(j = 0;j < MaxChannels;j++)
+ for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
gains[j].Target = Target[j];
UpdateDryStepping(&voice->Direct, 1);
@@ -1128,7 +1128,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
IncrementRef(&device->MixCount);
SamplesToDo = minu(size, BUFFERSIZE);
- for(c = 0;c < MaxChannels;c++)
+ for(c = 0;c < MAX_OUTPUT_CHANNELS;c++)
memset(device->DryBuffer[c], 0, SamplesToDo*sizeof(ALfloat));
V0(device->Backend,lock)();
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c
index e4edb2d4..8caf1fcc 100644
--- a/Alc/effects/autowah.c
+++ b/Alc/effects/autowah.c
@@ -39,7 +39,7 @@ typedef struct ALautowahState {
DERIVE_FROM_TYPE(ALeffectState);
/* Effect gains for each channel */
- ALfloat Gain[MaxChannels];
+ ALfloat Gain[MAX_OUTPUT_CHANNELS];
/* Effect parameters */
ALfloat AttackRate;
@@ -135,7 +135,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
}
state->GainCtrl = gain;
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[kt];
if(!(gain > GAIN_SILENCE_THRESHOLD))
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 6e541208..0dde134a 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -46,7 +46,7 @@ typedef struct ALchorusState {
ALint lfo_disp;
/* Gains for left and right sides */
- ALfloat Gain[2][MaxChannels];
+ ALfloat Gain[2][MAX_OUTPUT_CHANNELS];
/* effect parameters */
enum ChorusWaveForm waveform;
@@ -223,7 +223,7 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, co
break;
}
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[0][kt];
if(gain > GAIN_SILENCE_THRESHOLD)
diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c
index bc1cb81a..ab88ecf0 100644
--- a/Alc/effects/compressor.c
+++ b/Alc/effects/compressor.c
@@ -31,7 +31,7 @@ typedef struct ALcompressorState {
DERIVE_FROM_TYPE(ALeffectState);
/* Effect gains for each channel */
- ALfloat Gain[MaxChannels];
+ ALfloat Gain[MAX_OUTPUT_CHANNELS];
/* Effect parameters */
ALboolean Enabled;
@@ -116,7 +116,7 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples
}
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[kt];
if(!(gain > GAIN_SILENCE_THRESHOLD))
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c
index 755ed611..2d955888 100644
--- a/Alc/effects/dedicated.c
+++ b/Alc/effects/dedicated.c
@@ -32,7 +32,7 @@
typedef struct ALdedicatedState {
DERIVE_FROM_TYPE(ALeffectState);
- ALfloat gains[MaxChannels];
+ ALfloat gains[MAX_OUTPUT_CHANNELS];
} ALdedicatedState;
@@ -50,7 +50,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, ALCdevice *device
ALfloat Gain;
ALuint i;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
state->gains[i] = 0.0f;
Gain = Slot->Gain * Slot->EffectProps.Dedicated.Gain;
@@ -80,7 +80,7 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo
const ALfloat *gains = state->gains;
ALuint i, c;
- for(c = 0;c < MaxChannels;c++)
+ for(c = 0;c < MAX_OUTPUT_CHANNELS;c++)
{
if(!(gains[c] > GAIN_SILENCE_THRESHOLD))
continue;
@@ -108,7 +108,7 @@ ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(fa
if(!state) return NULL;
SET_VTABLE2(ALdedicatedState, ALeffectState, state);
- for(s = 0;s < MaxChannels;s++)
+ for(s = 0;s < MAX_OUTPUT_CHANNELS;s++)
state->gains[s] = 0.0f;
return STATIC_CAST(ALeffectState, state);
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c
index 95e76ac1..9474f3ae 100644
--- a/Alc/effects/distortion.c
+++ b/Alc/effects/distortion.c
@@ -34,7 +34,7 @@ typedef struct ALdistortionState {
DERIVE_FROM_TYPE(ALeffectState);
/* Effect gains for each channel */
- ALfloat Gain[MaxChannels];
+ ALfloat Gain[MAX_OUTPUT_CHANNELS];
/* Effect parameters */
ALfilterState lowpass;
@@ -154,7 +154,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples
temps[it] = oversample_buffer[it][0] * state->attenuation;
}
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[kt];
if(!(gain > GAIN_SILENCE_THRESHOLD))
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index 69d9b84f..d6c62a30 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -43,7 +43,7 @@ typedef struct ALechoState {
} Tap[2];
ALuint Offset;
/* The panning gains for the two taps */
- ALfloat Gain[2][MaxChannels];
+ ALfloat Gain[2][MAX_OUTPUT_CHANNELS];
ALfloat FeedGain;
@@ -138,7 +138,7 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const
offset++;
}
- for(k = 0;k < MaxChannels;k++)
+ for(k = 0;k < MAX_OUTPUT_CHANNELS;k++)
{
ALfloat gain = state->Gain[0][k];
if(gain > GAIN_SILENCE_THRESHOLD)
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index f555cbe5..dc02e9b0 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -75,7 +75,7 @@ typedef struct ALequalizerState {
DERIVE_FROM_TYPE(ALeffectState);
/* Effect gains for each channel */
- ALfloat Gain[MaxChannels];
+ ALfloat Gain[MAX_OUTPUT_CHANNELS];
/* Effect parameters */
ALfilterState filter[4];
@@ -140,7 +140,7 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo
temps[it] = smp;
}
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[kt];
if(!(gain > GAIN_SILENCE_THRESHOLD))
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index a38b3b13..e5a49a43 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -46,7 +46,7 @@ typedef struct ALflangerState {
ALint lfo_disp;
/* Gains for left and right sides */
- ALfloat Gain[2][MaxChannels];
+ ALfloat Gain[2][MAX_OUTPUT_CHANNELS];
/* effect parameters */
enum FlangerWaveForm waveform;
@@ -223,7 +223,7 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo,
break;
}
- for(kt = 0;kt < MaxChannels;kt++)
+ for(kt = 0;kt < MAX_OUTPUT_CHANNELS;kt++)
{
ALfloat gain = state->Gain[0][kt];
if(gain > GAIN_SILENCE_THRESHOLD)
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index 01d19bcb..c69a8a09 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -42,7 +42,7 @@ typedef struct ALmodulatorState {
ALuint index;
ALuint step;
- ALfloat Gain[MaxChannels];
+ ALfloat Gain[MAX_OUTPUT_CHANNELS];
ALfilterState Filter;
} ALmodulatorState;
@@ -92,7 +92,7 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \
temps[i] = samp * func(index); \
} \
\
- for(k = 0;k < MaxChannels;k++) \
+ for(k = 0;k < MAX_OUTPUT_CHANNELS;k++) \
{ \
ALfloat gain = state->Gain[k]; \
if(!(gain > GAIN_SILENCE_THRESHOLD)) \
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 5b937d96..e1b47ec2 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -86,7 +86,7 @@ typedef struct ALreverbState {
// The gain for each output channel based on 3D panning (only for the
// EAX path).
- ALfloat PanGain[MaxChannels];
+ ALfloat PanGain[MAX_OUTPUT_CHANNELS];
} Early;
// Decorrelator delay line.
@@ -125,7 +125,7 @@ typedef struct ALreverbState {
// The gain for each output channel based on 3D panning (only for the
// EAX path).
- ALfloat PanGain[MaxChannels];
+ ALfloat PanGain[MAX_OUTPUT_CHANNELS];
} Late;
struct {
@@ -565,7 +565,7 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples
for(index = 0;index < SamplesToDo;index++)
VerbPass(State, SamplesIn[index], out[index]);
- for(c = 0;c < MaxChannels;c++)
+ for(c = 0;c < MAX_OUTPUT_CHANNELS;c++)
{
ALfloat gain = State->Gain[c];
if(!(gain > GAIN_SILENCE_THRESHOLD))
@@ -586,7 +586,7 @@ static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo,
for(index = 0;index < SamplesToDo;index++)
EAXVerbPass(State, SamplesIn[index], early[index], late[index]);
- for(c = 0;c < MaxChannels;c++)
+ for(c = 0;c < MAX_OUTPUT_CHANNELS;c++)
{
ALfloat earlyGain, lateGain;
@@ -1231,7 +1231,7 @@ static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(f
state->Late.LpSample[index] = 0.0f;
}
- for(index = 0;index < MaxChannels;index++)
+ for(index = 0;index < MAX_OUTPUT_CHANNELS;index++)
{
state->Early.PanGain[index] = 0.0f;
state->Late.PanGain[index] = 0.0f;
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 8db51c12..82165c02 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -432,7 +432,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
parms->Filters[chan].ActiveType
);
if(!voice->IsHrtf)
- Mix(samples, MaxChannels, parms->OutBuffer, parms->Mix.Gains[chan],
+ Mix(samples, Device->NumSpeakers, parms->OutBuffer, parms->Mix.Gains[chan],
parms->Counter, OutPos, DstBufferSize);
else
HrtfMix(parms->OutBuffer, samples, parms->Counter, voice->Offset,
diff --git a/Alc/panning.c b/Alc/panning.c
index 051eac10..99739d58 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -32,7 +32,7 @@
#include "alu.h"
-void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation, ALfloat ingain, ALfloat gains[MaxChannels])
+void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALfloat dir[3] = {
sinf(angle) * cosf(elevation),
@@ -42,7 +42,7 @@ void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation
ComputeDirectionalGains(device, dir, ingain, gains);
}
-void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfloat ingain, ALfloat gains[MaxChannels])
+void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALfloat coeffs[MAX_AMBI_COEFFS];
ALuint i, j;
@@ -68,7 +68,7 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
coeffs[14] = x * (x*x - 3.0f*y*y); /* X * (X*X - 3*Y*Y) */
coeffs[15] = y * (3.0f*x*x - y*y); /* Y * (3*X*X - Y*Y) */
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i] = 0.0f;
for(i = 0;i < device->NumSpeakers;i++)
{
@@ -78,21 +78,21 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
}
}
-void ComputeAmbientGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MaxChannels])
+void ComputeAmbientGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALuint i;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i] = 0.0f;
for(i = 0;i < device->NumSpeakers;i++)
gains[i] = device->Speaker[i].HOACoeff[0] * ingain;
}
-void ComputeBFormatGains(const ALCdevice *device, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MaxChannels])
+void ComputeBFormatGains(const ALCdevice *device, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALuint i, j;
- for(i = 0;i < MaxChannels;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
gains[i] = 0.0f;
for(i = 0;i < device->NumSpeakers;i++)
{
@@ -196,7 +196,7 @@ ALvoid aluInitPanning(ALCdevice *device)
chanmap = X71Cfg;
break;
}
- for(i = 0;i < MaxChannels && device->ChannelName[i] != InvalidChannel;i++)
+ for(i = 0;i < MAX_OUTPUT_CHANNELS && device->ChannelName[i] != InvalidChannel;i++)
{
for(j = 0;j < count;j++)
{