Rename OUTPUTCHANNELS to something more descriptive

This commit is contained in:
Chris Robinson 2010-12-01 18:33:17 -08:00
parent 14441e0e53
commit 9e8fb89a52
12 changed files with 65 additions and 65 deletions

View File

@ -914,7 +914,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
aluInitPanning(device);
for(i = 0;i < OUTPUTCHANNELS;i++)
for(i = 0;i < MAXCHANNELS;i++)
{
device->ClickRemoval[i] = 0.0f;
device->PendingClicks[i] = 0.0f;

View File

@ -258,7 +258,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
if(Channels == FmtStereo)
{
for(i = 0;i < OUTPUTCHANNELS;i++)
for(i = 0;i < MAXCHANNELS;i++)
ALSource->Params.DryGains[i] = 0.0f;
if(DupStereo == AL_FALSE)
@ -322,7 +322,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
else
{
for(i = 0;i < OUTPUTCHANNELS;i++)
for(i = 0;i < MAXCHANNELS;i++)
ALSource->Params.DryGains[i] = DryGain * ListenerGain;
}
@ -729,13 +729,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
pos = aluCart2LUTpos(-Position[2], Position[0]);
SpeakerGain = &Device->PanningLUT[OUTPUTCHANNELS * pos];
SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
DirGain = aluSqrt(Position[0]*Position[0] + Position[2]*Position[2]);
// elevation adjustment for directional gain. this sucks, but
// has low complexity
AmbientGain = aluSqrt(1.0/Device->NumChan);
for(s = 0;s < OUTPUTCHANNELS;s++)
for(s = 0;s < MAXCHANNELS;s++)
ALSource->Params.DryGains[s] = 0.0f;
for(s = 0;s < (ALsizei)Device->NumChan;s++)
{
@ -806,7 +806,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
SamplesToDo = min(size, BUFFERSIZE);
/* Clear mixing buffer */
memset(device->DryBuffer, 0, SamplesToDo*OUTPUTCHANNELS*sizeof(ALfloat));
memset(device->DryBuffer, 0, SamplesToDo*MAXCHANNELS*sizeof(ALfloat));
SuspendContext(NULL);
ctx = device->Contexts;
@ -868,13 +868,13 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
//Post processing loop
for(i = 0;i < SamplesToDo;i++)
{
for(c = 0;c < OUTPUTCHANNELS;c++)
for(c = 0;c < MAXCHANNELS;c++)
{
device->ClickRemoval[c] -= device->ClickRemoval[c] / 256.0f;
device->DryBuffer[i][c] += device->ClickRemoval[c];
}
}
for(i = 0;i < OUTPUTCHANNELS;i++)
for(i = 0;i < MAXCHANNELS;i++)
{
device->ClickRemoval[i] += device->PendingClicks[i];
device->PendingClicks[i] = 0.0f;
@ -886,8 +886,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
const Channel chans[] = { \
__VA_ARGS__ \
}; \
ALfloat (*DryBuffer)[OUTPUTCHANNELS] = device->DryBuffer; \
ALfloat (*Matrix)[OUTPUTCHANNELS] = device->ChannelMatrix; \
ALfloat (*DryBuffer)[MAXCHANNELS] = device->DryBuffer; \
ALfloat (*Matrix)[MAXCHANNELS] = device->ChannelMatrix; \
const ALuint *ChanMap = device->DevChannels; \
\
for(i = 0;i < SamplesToDo;i++) \
@ -895,7 +895,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
for(j = 0;j < N;j++) \
{ \
ALfloat samp = 0.0f; \
for(c = 0;c < OUTPUTCHANNELS;c++) \
for(c = 0;c < MAXCHANNELS;c++) \
samp += DryBuffer[i][c] * Matrix[c][chans[j]]; \
((T*)buffer)[ChanMap[chans[j]]] = func(samp); \
} \
@ -910,14 +910,14 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
case AL_FORMAT_STEREO##bits: \
if(device->Bs2b) \
{ \
ALfloat (*DryBuffer)[OUTPUTCHANNELS] = device->DryBuffer; \
ALfloat (*Matrix)[OUTPUTCHANNELS] = device->ChannelMatrix; \
ALfloat (*DryBuffer)[MAXCHANNELS] = device->DryBuffer; \
ALfloat (*Matrix)[MAXCHANNELS] = device->ChannelMatrix; \
const ALuint *ChanMap = device->DevChannels; \
\
for(i = 0;i < SamplesToDo;i++) \
{ \
float samples[2] = { 0.0f, 0.0f }; \
for(c = 0;c < OUTPUTCHANNELS;c++) \
for(c = 0;c < MAXCHANNELS;c++) \
{ \
samples[0] += DryBuffer[i][c]*Matrix[c][FRONT_LEFT]; \
samples[1] += DryBuffer[i][c]*Matrix[c][FRONT_RIGHT]; \

View File

@ -49,7 +49,7 @@ typedef struct ALechoState {
ALfloat FeedGain;
ALfloat Gain[OUTPUTCHANNELS];
ALfloat Gain[MAXCHANNELS];
FILTER iirFilter;
ALfloat history[2];
@ -90,7 +90,7 @@ static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
for(i = 0;i < state->BufferLength;i++)
state->SampleBuffer[i] = 0.0f;
for(i = 0;i < OUTPUTCHANNELS;i++)
for(i = 0;i < MAXCHANNELS;i++)
state->Gain[i] = 0.0f;
for(i = 0;i < Device->NumChan;i++)
{
@ -125,7 +125,7 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeff
state->iirFilter.coeff = a;
}
static ALvoid EchoProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
static ALvoid EchoProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
{
ALechoState *state = (ALechoState*)effect;
const ALuint mask = state->BufferLength-1;

View File

@ -43,7 +43,7 @@ typedef struct ALmodulatorState {
ALuint index;
ALuint step;
ALfloat Gain[OUTPUTCHANNELS];
ALfloat Gain[MAXCHANNELS];
FILTER iirFilter;
ALfloat history[1];
@ -92,7 +92,7 @@ static ALboolean ModulatorDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
ALmodulatorState *state = (ALmodulatorState*)effect;
ALuint index;
for(index = 0;index < OUTPUTCHANNELS;index++)
for(index = 0;index < MAXCHANNELS;index++)
state->Gain[index] = 0.0f;
for(index = 0;index < Device->NumChan;index++)
{
@ -125,7 +125,7 @@ static ALvoid ModulatorUpdate(ALeffectState *effect, ALCcontext *Context, const
state->iirFilter.coeff = a;
}
static ALvoid ModulatorProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
static ALvoid ModulatorProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
{
ALmodulatorState *state = (ALmodulatorState*)effect;
const ALfloat gain = Slot->Gain;

View File

@ -77,7 +77,7 @@ typedef struct ALverbState {
ALuint Offset[4];
// The gain for each output channel based on 3D panning (only for the
// EAX path).
ALfloat PanGain[OUTPUTCHANNELS];
ALfloat PanGain[MAXCHANNELS];
} Early;
// Decorrelator delay line.
DelayLine Decorrelator;
@ -107,7 +107,7 @@ typedef struct ALverbState {
ALfloat LpSample[4];
// The gain for each output channel based on 3D panning (only for the
// EAX path).
ALfloat PanGain[OUTPUTCHANNELS];
ALfloat PanGain[MAXCHANNELS];
} Late;
struct {
// Attenuation to compensate for the modal density and decay rate of
@ -627,10 +627,10 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
* panning direction.
*/
pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]);
speakerGain = &Device->PanningLUT[OUTPUTCHANNELS * pos];
speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
dirGain = aluSqrt((earlyPan[0] * earlyPan[0]) + (earlyPan[2] * earlyPan[2]));
for(index = 0;index < OUTPUTCHANNELS;index++)
for(index = 0;index < MAXCHANNELS;index++)
State->Early.PanGain[index] = 0.0f;
for(index = 0;index < Device->NumChan;index++)
{
@ -640,10 +640,10 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
pos = aluCart2LUTpos(latePan[2], latePan[0]);
speakerGain = &Device->PanningLUT[OUTPUTCHANNELS * pos];
speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
dirGain = aluSqrt((latePan[0] * latePan[0]) + (latePan[2] * latePan[2]));
for(index = 0;index < OUTPUTCHANNELS;index++)
for(index = 0;index < MAXCHANNELS;index++)
State->Late.PanGain[index] = 0.0f;
for(index = 0;index < Device->NumChan;index++)
{
@ -1014,7 +1014,7 @@ static ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
frequency);
}
for(index = 0;index < OUTPUTCHANNELS;index++)
for(index = 0;index < MAXCHANNELS;index++)
State->Gain[index] = 0.0f;
for(index = 0;index < Device->NumChan;index++)
{
@ -1161,7 +1161,7 @@ static ALvoid EAXVerbUpdate(ALeffectState *effect, ALCcontext *Context, const AL
// This processes the reverb state, given the input samples and an output
// buffer.
static ALvoid VerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
static ALvoid VerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
{
ALverbState *State = (ALverbState*)effect;
ALuint index;
@ -1194,7 +1194,7 @@ static ALvoid VerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuin
// This processes the EAX reverb state, given the input samples and an output
// buffer.
static ALvoid EAXVerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
static ALvoid EAXVerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
{
ALverbState *State = (ALverbState*)effect;
ALuint index;
@ -1207,7 +1207,7 @@ static ALvoid EAXVerbProcess(ALeffectState *effect, const ALeffectslot *Slot, AL
EAXVerbPass(State, SamplesIn[index], early, late);
// Unfortunately, while the number and configuration of gains for
// panning adjust according to OUTPUTCHANNELS, the output from the
// panning adjust according to MAXCHANNELS, the output from the
// reverb engine is not so scalable.
SamplesOut[index][FRONT_LEFT] +=
(State->Early.PanGain[FRONT_LEFT]*early[0] +
@ -1307,7 +1307,7 @@ ALeffectState *VerbCreate(void)
State->Late.LpSample[index] = 0.0f;
}
for(index = 0;index < OUTPUTCHANNELS;index++)
for(index = 0;index < MAXCHANNELS;index++)
{
State->Early.PanGain[index] = 0.0f;
State->Late.PanGain[index] = 0.0f;

View File

@ -68,10 +68,10 @@ static void Mix_##T##_Mono_##sampler(ALsource *Source, ALCdevice *Device, \
const T *data, ALuint *DataPosInt, ALuint *DataPosFrac, \
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) \
{ \
ALfloat (*DryBuffer)[OUTPUTCHANNELS]; \
ALfloat (*DryBuffer)[MAXCHANNELS]; \
ALfloat *ClickRemoval, *PendingClicks; \
ALuint pos, frac; \
ALfloat DrySend[OUTPUTCHANNELS]; \
ALfloat DrySend[MAXCHANNELS]; \
FILTER *DryFilter; \
ALuint BufferIdx; \
ALuint increment; \
@ -84,7 +84,7 @@ static void Mix_##T##_Mono_##sampler(ALsource *Source, ALCdevice *Device, \
ClickRemoval = Device->ClickRemoval; \
PendingClicks = Device->PendingClicks; \
DryFilter = &Source->Params.iirFilter; \
for(i = 0;i < OUTPUTCHANNELS;i++) \
for(i = 0;i < MAXCHANNELS;i++) \
DrySend[i] = Source->Params.DryGains[i]; \
\
pos = 0; \
@ -222,10 +222,10 @@ static void Mix_##T##_Stereo_##sampler(ALsource *Source, ALCdevice *Device, \
BACK_LEFT, BACK_RIGHT \
}; \
const ALfloat scaler = 1.0f/Channels; \
ALfloat (*DryBuffer)[OUTPUTCHANNELS]; \
ALfloat (*DryBuffer)[MAXCHANNELS]; \
ALfloat *ClickRemoval, *PendingClicks; \
ALuint pos, frac; \
ALfloat DrySend[OUTPUTCHANNELS]; \
ALfloat DrySend[MAXCHANNELS]; \
FILTER *DryFilter; \
ALuint BufferIdx; \
ALuint increment; \
@ -238,7 +238,7 @@ static void Mix_##T##_Stereo_##sampler(ALsource *Source, ALCdevice *Device, \
ClickRemoval = Device->ClickRemoval; \
PendingClicks = Device->PendingClicks; \
DryFilter = &Source->Params.iirFilter; \
for(i = 0;i < OUTPUTCHANNELS;i++) \
for(i = 0;i < MAXCHANNELS;i++) \
DrySend[i] = Source->Params.DryGains[i]; \
\
pos = 0; \
@ -370,10 +370,10 @@ static void Mix_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device,\
{ \
static const ALuint Channels = sizeof(chans)/sizeof(chans[0]); \
const ALfloat scaler = 1.0f/Channels; \
ALfloat (*DryBuffer)[OUTPUTCHANNELS]; \
ALfloat (*DryBuffer)[MAXCHANNELS]; \
ALfloat *ClickRemoval, *PendingClicks; \
ALuint pos, frac; \
ALfloat DrySend[OUTPUTCHANNELS]; \
ALfloat DrySend[MAXCHANNELS]; \
FILTER *DryFilter; \
ALuint BufferIdx; \
ALuint increment; \
@ -386,7 +386,7 @@ static void Mix_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device,\
ClickRemoval = Device->ClickRemoval; \
PendingClicks = Device->PendingClicks; \
DryFilter = &Source->Params.iirFilter; \
for(i = 0;i < OUTPUTCHANNELS;i++) \
for(i = 0;i < MAXCHANNELS;i++) \
DrySend[i] = Source->Params.DryGains[i]; \
\
pos = 0; \

View File

@ -31,8 +31,8 @@
#include "AL/alc.h"
#include "alu.h"
static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[OUTPUTCHANNELS],
Channel Speaker2Chan[OUTPUTCHANNELS], ALint chans)
static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[MAXCHANNELS],
Channel Speaker2Chan[MAXCHANNELS], ALint chans)
{
char layout_str[256];
char *confkey, *next;
@ -162,17 +162,17 @@ ALint aluCart2LUTpos(ALfloat re, ALfloat im)
ALvoid aluInitPanning(ALCdevice *Device)
{
ALfloat SpeakerAngle[OUTPUTCHANNELS];
ALfloat (*Matrix)[OUTPUTCHANNELS];
ALfloat SpeakerAngle[MAXCHANNELS];
ALfloat (*Matrix)[MAXCHANNELS];
Channel *Speaker2Chan;
ALfloat Alpha, Theta;
ALfloat *PanningLUT;
ALint pos, offset;
ALuint s, s2;
for(s = 0;s < OUTPUTCHANNELS;s++)
for(s = 0;s < MAXCHANNELS;s++)
{
for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
for(s2 = 0;s2 < MAXCHANNELS;s2++)
Device->ChannelMatrix[s][s2] = ((s==s2) ? 1.0f : 0.0f);
}
@ -313,18 +313,18 @@ ALvoid aluInitPanning(ALCdevice *Device)
if(GetConfigValueBool(NULL, "scalemix", 0))
{
ALfloat maxout = 1.0f;
for(s = 0;s < OUTPUTCHANNELS;s++)
for(s = 0;s < MAXCHANNELS;s++)
{
ALfloat out = 0.0f;
for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
for(s2 = 0;s2 < MAXCHANNELS;s2++)
out += Device->ChannelMatrix[s2][s];
maxout = __max(maxout, out);
}
maxout = 1.0f/maxout;
for(s = 0;s < OUTPUTCHANNELS;s++)
for(s = 0;s < MAXCHANNELS;s++)
{
for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
for(s2 = 0;s2 < MAXCHANNELS;s2++)
Device->ChannelMatrix[s2][s] *= maxout;
}
}
@ -333,8 +333,8 @@ ALvoid aluInitPanning(ALCdevice *Device)
for(pos = 0; pos < LUT_NUM; pos++)
{
/* clear all values */
offset = OUTPUTCHANNELS * pos;
for(s = 0; s < OUTPUTCHANNELS; s++)
offset = MAXCHANNELS * pos;
for(s = 0; s < MAXCHANNELS; s++)
PanningLUT[offset+s] = 0.0f;
if(Device->NumChan == 1)

View File

@ -41,7 +41,7 @@ struct ALeffectState {
ALvoid (*Destroy)(ALeffectState *State);
ALboolean (*DeviceUpdate)(ALeffectState *State, ALCdevice *Device);
ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, const ALeffect *Effect);
ALvoid (*Process)(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]);
ALvoid (*Process)(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS]);
};
ALeffectState *NoneCreate(void);

View File

@ -373,18 +373,18 @@ struct ALCdevice_struct
ALboolean DuplicateStereo;
// Dry path buffer mix
ALfloat DryBuffer[BUFFERSIZE][OUTPUTCHANNELS];
ALfloat DryBuffer[BUFFERSIZE][MAXCHANNELS];
ALuint DevChannels[OUTPUTCHANNELS];
ALuint DevChannels[MAXCHANNELS];
ALfloat ChannelMatrix[OUTPUTCHANNELS][OUTPUTCHANNELS];
ALfloat ChannelMatrix[MAXCHANNELS][MAXCHANNELS];
Channel Speaker2Chan[OUTPUTCHANNELS];
ALfloat PanningLUT[OUTPUTCHANNELS * LUT_NUM];
Channel Speaker2Chan[MAXCHANNELS];
ALfloat PanningLUT[MAXCHANNELS * LUT_NUM];
ALuint NumChan;
ALfloat ClickRemoval[OUTPUTCHANNELS];
ALfloat PendingClicks[OUTPUTCHANNELS];
ALfloat ClickRemoval[MAXCHANNELS];
ALfloat PendingClicks[MAXCHANNELS];
// Contexts created on this device
ALCcontext **Contexts;

View File

@ -91,14 +91,14 @@ typedef struct ALsource
struct {
ALint Step;
ALfloat DryGains[OUTPUTCHANNELS];
ALfloat DryGains[MAXCHANNELS];
FILTER iirFilter;
ALfloat history[OUTPUTCHANNELS*2];
ALfloat history[MAXCHANNELS*2];
struct {
ALfloat WetGain;
FILTER iirFilter;
ALfloat history[OUTPUTCHANNELS];
ALfloat history[MAXCHANNELS];
} Send[MAX_SENDS];
} Params;

View File

@ -72,7 +72,7 @@ typedef enum {
SIDE_LEFT,
SIDE_RIGHT,
OUTPUTCHANNELS
MAXCHANNELS
} Channel;
#define BUFFERSIZE 4096

View File

@ -449,7 +449,7 @@ static ALvoid NoneUpdate(ALeffectState *State, ALCcontext *Context, const ALeffe
(void)Context;
(void)Effect;
}
static ALvoid NoneProcess(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
static ALvoid NoneProcess(ALeffectState *State, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
{
(void)State;
(void)Slot;