Avoid using macros to access anonymous structures

This commit is contained in:
Chris Robinson
2018-01-11 03:45:23 -08:00
parent 279799ad70
commit 15f9d15ba0
15 changed files with 122 additions and 104 deletions
+1
View File
@@ -1637,6 +1637,7 @@ void SetDefaultChannelOrder(ALCdevice *device)
}
extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan);
extern inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan);
/* ALCcontext_DeferUpdates
+17 -17
View File
@@ -520,8 +520,8 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
CalcDirectionCoeffs(Dir, Spread, coeffs);
/* NOTE: W needs to be scaled by sqrt(2) due to FuMa normalization. */
ComputePanningGains(Device->Dry, coeffs, DryGain*1.414213562f,
voice->Direct.Params[0].Gains.Target);
ComputeDryPanGains(&Device->Dry, coeffs, DryGain*1.414213562f,
voice->Direct.Params[0].Gains.Target);
for(c = 1;c < num_channels;c++)
{
for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
@@ -602,7 +602,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
voice->Direct.Buffer = Device->FOAOut.Buffer;
voice->Direct.Channels = Device->FOAOut.NumChannels;
for(c = 0;c < num_channels;c++)
ComputeFirstOrderGains(Device->FOAOut, matrix.m[c], DryGain,
ComputeFirstOrderGains(&Device->FOAOut, matrix.m[c], DryGain,
voice->Direct.Params[c].Gains.Target);
for(i = 0;i < NumSends;i++)
{
@@ -636,7 +636,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
int idx;
for(j = 0;j < MAX_OUTPUT_CHANNELS;j++)
voice->Direct.Params[c].Gains.Target[j] = 0.0f;
if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1)
if((idx=GetChannelIdxByName(&Device->RealOut, chans[c].channel)) != -1)
voice->Direct.Params[c].Gains.Target[idx] = DryGain;
}
@@ -830,13 +830,13 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
voice->Direct.Params[c].Gains.Target[j] = 0.0f;
if(Device->Dry.Buffer == Device->RealOut.Buffer)
{
int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel);
if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain;
}
continue;
}
ComputePanningGains(Device->Dry,
ComputeDryPanGains(&Device->Dry,
coeffs, DryGain * downmix_gain, voice->Direct.Params[c].Gains.Target
);
}
@@ -902,7 +902,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
voice->Direct.Params[c].Gains.Target[j] = 0.0f;
if(Device->Dry.Buffer == Device->RealOut.Buffer)
{
int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel);
if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain;
}
@@ -918,7 +918,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
CalcAnglePairwiseCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs);
else
CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs);
ComputePanningGains(Device->Dry,
ComputeDryPanGains(&Device->Dry,
coeffs, DryGain, voice->Direct.Params[c].Gains.Target
);
@@ -1725,8 +1725,8 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
SAFE_CONST(ALfloatBUFFERSIZE*,device->FOAOut.Buffer), SamplesToDo
);
lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
ridx = GetChannelIdxByName(device->RealOut, FrontRight);
lidx = GetChannelIdxByName(&device->RealOut, FrontLeft);
ridx = GetChannelIdxByName(&device->RealOut, FrontRight);
assert(lidx != -1 && ridx != -1);
state = device->Hrtf;
@@ -1761,8 +1761,8 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
}
else if(device->Uhj_Encoder)
{
int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(&device->RealOut, FrontRight);
if(lidx != -1 && ridx != -1)
{
/* Encode to stereo-compatible 2-channel UHJ output. */
@@ -1774,8 +1774,8 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
}
else if(device->Bs2b)
{
int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(&device->RealOut, FrontRight);
if(lidx != -1 && ridx != -1)
{
/* Apply binaural/crossfeed filter */
@@ -1791,9 +1791,9 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
if(device->Stablizer)
{
int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
int cidx = GetChannelIdxByName(device->RealOut, FrontCenter);
int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(&device->RealOut, FrontRight);
int cidx = GetChannelIdxByName(&device->RealOut, FrontCenter);
assert(lidx >= 0 && ridx >= 0 && cidx >= 0);
ApplyStablizer(device->Stablizer, Buffer, lidx, ridx, cidx,
+1 -1
View File
@@ -549,7 +549,7 @@ void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device)
{
ALfloat coeffs[MAX_AMBI_COEFFS] = { 0.0f };
CalcDirectionCoeffs(Ambi3DPoints[i], 0.0f, coeffs);
ComputePanningGains(device->Dry, coeffs, 1.0f, encgains[i]);
ComputeDryPanGains(&device->Dry, coeffs, 1.0f, encgains[i]);
}
/* Combine the matrices that do the in->virt and virt->out conversions
+2 -2
View File
@@ -148,9 +148,9 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCcontext *Conte
/* Gains for left and right sides */
CalcAngleCoeffs(-F_PI_2, 0.0f, 0.0f, coeffs);
ComputePanningGains(device->Dry, coeffs, Slot->Params.Gain, state->Gains[0].Target);
ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[0].Target);
CalcAngleCoeffs( F_PI_2, 0.0f, 0.0f, coeffs);
ComputePanningGains(device->Dry, coeffs, Slot->Params.Gain, state->Gains[1].Target);
ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[1].Target);
phase = props->Chorus.Phase;
rate = props->Chorus.Rate;
+1 -1
View File
@@ -86,7 +86,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCcontex
STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels;
for(i = 0;i < 4;i++)
ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i],
ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i],
slot->Params.Gain, state->Gain[i]);
}
+3 -3
View File
@@ -78,7 +78,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext
if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT)
{
int idx;
if((idx=GetChannelIdxByName(device->RealOut, LFE)) != -1)
if((idx=GetChannelIdxByName(&device->RealOut, LFE)) != -1)
{
STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels;
@@ -90,7 +90,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext
int idx;
/* Dialog goes to the front-center speaker if it exists, otherwise it
* plays from the front-center location. */
if((idx=GetChannelIdxByName(device->RealOut, FrontCenter)) != -1)
if((idx=GetChannelIdxByName(&device->RealOut, FrontCenter)) != -1)
{
STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels;
@@ -103,7 +103,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext
STATIC_CAST(ALeffectState,state)->OutBuffer = device->Dry.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->Dry.NumChannels;
ComputePanningGains(device->Dry, coeffs, Gain, state->gains);
ComputeDryPanGains(&device->Dry, coeffs, Gain, state->gains);
}
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex
cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth)
);
ComputeAmbientGains(device->Dry, slot->Params.Gain, state->Gain);
ComputeAmbientGains(&device->Dry, slot->Params.Gain, state->Gain);
}
static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
+2 -2
View File
@@ -139,11 +139,11 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context,
/* First tap panning */
CalcAngleCoeffs(-F_PI_2*lrpan, 0.0f, spread, coeffs);
ComputePanningGains(device->Dry, coeffs, slot->Params.Gain, state->Gains[0].Target);
ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[0].Target);
/* Second tap panning */
CalcAngleCoeffs( F_PI_2*lrpan, 0.0f, spread, coeffs);
ComputePanningGains(device->Dry, coeffs, slot->Params.Gain, state->Gains[1].Target);
ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[1].Target);
}
static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
+1 -1
View File
@@ -132,7 +132,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext
STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels;
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i],
ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i],
slot->Params.Gain, state->Gain[i]);
/* Calculate coefficients for the each type of filter. Note that the shelf
+1 -1
View File
@@ -148,7 +148,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext
STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer;
STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels;
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i],
ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i],
slot->Params.Gain, state->Gain[i]);
}
+4 -2
View File
@@ -1264,13 +1264,15 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
MATRIX_MULT(transform, rot, A2B);
memset(&State->Early.PanGain, 0, sizeof(State->Early.PanGain));
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputeFirstOrderGains(Device->FOAOut, transform.m[i], gain*earlyGain, State->Early.PanGain[i]);
ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*earlyGain,
State->Early.PanGain[i]);
rot = GetTransformFromVector(LateReverbPan);
MATRIX_MULT(transform, rot, A2B);
memset(&State->Late.PanGain, 0, sizeof(State->Late.PanGain));
for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
ComputeFirstOrderGains(Device->FOAOut, transform.m[i], gain*lateGain, State->Late.PanGain[i]);
ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*lateGain,
State->Late.PanGain[i]);
#undef MATRIX_MULT
}
+2 -2
View File
@@ -548,8 +548,8 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
ALsizei fademix = 0;
int lidx, ridx;
lidx = GetChannelIdxByName(Device->RealOut, FrontLeft);
ridx = GetChannelIdxByName(Device->RealOut, FrontRight);
lidx = GetChannelIdxByName(&Device->RealOut, FrontLeft);
ridx = GetChannelIdxByName(&Device->RealOut, FrontRight);
assert(lidx != -1 && ridx != -1);
if(!Counter)
+16 -13
View File
@@ -37,6 +37,9 @@
extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
extern inline void ComputeAmbientGains(const DryMixParams *dry, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
extern inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
extern inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
static const ALsizei FuMa2ACN[MAX_AMBI_COEFFS] = {
@@ -382,41 +385,41 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei sp
* and vice-versa.
*/
if(alstr_cmp_cstr(conf->Speakers[i].Name, "LF") == 0)
c = GetChannelIdxByName(device->RealOut, FrontLeft);
c = GetChannelIdxByName(&device->RealOut, FrontLeft);
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RF") == 0)
c = GetChannelIdxByName(device->RealOut, FrontRight);
c = GetChannelIdxByName(&device->RealOut, FrontRight);
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CE") == 0)
c = GetChannelIdxByName(device->RealOut, FrontCenter);
c = GetChannelIdxByName(&device->RealOut, FrontCenter);
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LS") == 0)
{
if(device->FmtChans == DevFmtX51Rear)
c = GetChannelIdxByName(device->RealOut, BackLeft);
c = GetChannelIdxByName(&device->RealOut, BackLeft);
else
c = GetChannelIdxByName(device->RealOut, SideLeft);
c = GetChannelIdxByName(&device->RealOut, SideLeft);
}
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RS") == 0)
{
if(device->FmtChans == DevFmtX51Rear)
c = GetChannelIdxByName(device->RealOut, BackRight);
c = GetChannelIdxByName(&device->RealOut, BackRight);
else
c = GetChannelIdxByName(device->RealOut, SideRight);
c = GetChannelIdxByName(&device->RealOut, SideRight);
}
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LB") == 0)
{
if(device->FmtChans == DevFmtX51)
c = GetChannelIdxByName(device->RealOut, SideLeft);
c = GetChannelIdxByName(&device->RealOut, SideLeft);
else
c = GetChannelIdxByName(device->RealOut, BackLeft);
c = GetChannelIdxByName(&device->RealOut, BackLeft);
}
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RB") == 0)
{
if(device->FmtChans == DevFmtX51)
c = GetChannelIdxByName(device->RealOut, SideRight);
c = GetChannelIdxByName(&device->RealOut, SideRight);
else
c = GetChannelIdxByName(device->RealOut, BackRight);
c = GetChannelIdxByName(&device->RealOut, BackRight);
}
else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CB") == 0)
c = GetChannelIdxByName(device->RealOut, BackCenter);
c = GetChannelIdxByName(&device->RealOut, BackCenter);
else
{
const char *name = alstr_get_cstr(conf->Speakers[i].Name);
@@ -424,7 +427,7 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei sp
char ch;
if(sscanf(name, "AUX%u%c", &n, &ch) == 1 && n < 16)
c = GetChannelIdxByName(device->RealOut, Aux0+n);
c = GetChannelIdxByName(&device->RealOut, Aux0+n);
else
{
ERR("AmbDec speaker label \"%s\" not recognized\n", name);
+40 -33
View File
@@ -678,6 +678,35 @@ typedef struct DistanceComp {
*/
#define BUFFERSIZE 2048
typedef struct DryMixParams {
AmbiConfig Ambi;
/* Number of coefficients in each Ambi.Coeffs to mix together (4 for first-
* order, 9 for second-order, etc). If the count is 0, Ambi.Map is used
* instead to map each output to a coefficient index.
*/
ALsizei CoeffCount;
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1];
} DryMixParams;
typedef struct BFMixParams {
AmbiConfig Ambi;
/* Will only be 4 or 0. */
ALsizei CoeffCount;
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} BFMixParams;
typedef struct RealMixParams {
enum Channel ChannelName[MAX_OUTPUT_CHANNELS];
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} RealMixParams;
struct ALCdevice_struct
{
RefCount ref;
@@ -752,38 +781,15 @@ struct ALCdevice_struct
alignas(16) ALfloat TempBuffer[4][BUFFERSIZE];
/* The "dry" path corresponds to the main output. */
struct {
AmbiConfig Ambi;
/* Number of coefficients in each Ambi.Coeffs to mix together (4 for
* first-order, 9 for second-order, etc). If the count is 0, Ambi.Map
* is used instead to map each output to a coefficient index.
*/
ALsizei CoeffCount;
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1];
} Dry;
DryMixParams Dry;
/* First-order ambisonics output, to be upsampled to the dry buffer if different. */
struct {
AmbiConfig Ambi;
/* Will only be 4 or 0. */
ALsizei CoeffCount;
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} FOAOut;
BFMixParams FOAOut;
/* "Real" output, which will be written to the device buffer. May alias the
* dry buffer.
*/
struct {
enum Channel ChannelName[MAX_OUTPUT_CHANNELS];
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei NumChannels;
} RealOut;
RealMixParams RealOut;
struct FrontStablizer *Stablizer;
@@ -984,12 +990,6 @@ void SetDefaultWFXChannelOrder(ALCdevice *device);
const ALCchar *DevFmtTypeString(enum DevFmtType type);
const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
/**
* GetChannelIdxByName
*
* Returns the index for the given channel name (e.g. FrontCenter), or -1 if it
* doesn't exist.
*/
inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan)
{
ALint i;
@@ -1000,7 +1000,14 @@ inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum
}
return -1;
}
#define GetChannelIdxByName(x, c) GetChannelIndex((x).ChannelName, (c))
/**
* GetChannelIdxByName
*
* Returns the index for the given channel name (e.g. FrontCenter), or -1 if it
* doesn't exist.
*/
inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan)
{ return GetChannelIndex(real->ChannelName, chan); }
extern FILE *LogFile;
+30 -25
View File
@@ -459,35 +459,41 @@ inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread,
*/
void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]);
void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputeAmbientGains
*
* Computes channel gains for ambient, omni-directional sounds.
*/
#define ComputeAmbientGains(b, g, o) do { \
if((b).CoeffCount > 0) \
ComputeAmbientGainsMC((b).Ambi.Coeffs, (b).NumChannels, g, o); \
else \
ComputeAmbientGainsBF((b).Ambi.Map, (b).NumChannels, g, o); \
} while (0)
void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
inline void ComputeAmbientGains(const DryMixParams *dry, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
if(dry->CoeffCount > 0)
ComputeAmbientGainsMC(dry->Ambi.Coeffs, dry->NumChannels, ingain, gains);
else
ComputeAmbientGainsBF(dry->Ambi.Map, dry->NumChannels, ingain, gains);
}
void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputePanningGains
* ComputeDryPanGains
*
* Computes panning gains using the given channel decoder coefficients and the
* pre-calculated direction or angle coefficients.
*/
#define ComputePanningGains(b, c, g, o) do { \
if((b).CoeffCount > 0) \
ComputePanningGainsMC((b).Ambi.Coeffs, (b).NumChannels, (b).CoeffCount, c, g, o);\
else \
ComputePanningGainsBF((b).Ambi.Map, (b).NumChannels, c, g, o); \
} while (0)
void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
if(dry->CoeffCount > 0)
ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount,
coeffs, ingain, gains);
else
ComputePanningGainsBF(dry->Ambi.Map, dry->NumChannels, coeffs, ingain, gains);
}
void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
/**
* ComputeFirstOrderGains
*
@@ -495,14 +501,13 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, con
* a 1x4 'slice' of a transform matrix for the input channel, used to scale and
* orient the sound samples.
*/
#define ComputeFirstOrderGains(b, m, g, o) do { \
if((b).CoeffCount > 0) \
ComputeFirstOrderGainsMC((b).Ambi.Coeffs, (b).NumChannels, m, g, o); \
else \
ComputeFirstOrderGainsBF((b).Ambi.Map, (b).NumChannels, m, g, o); \
} while (0)
void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]);
inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
if(foa->CoeffCount > 0)
ComputeFirstOrderGainsMC(foa->Ambi.Coeffs, foa->NumChannels, mtx, ingain, gains);
else
ComputeFirstOrderGainsBF(foa->Ambi.Map, foa->NumChannels, mtx, ingain, gains);
}
ALboolean MixSource(struct ALvoice *voice, struct ALsource *Source, ALCdevice *Device, ALsizei SamplesToDo);