diff options
author | Chris Robinson <[email protected]> | 2018-01-11 03:45:23 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-11 03:45:23 -0800 |
commit | 15f9d15ba006fab67a3ace8b2560c3397e75b1aa (patch) | |
tree | b65235f68b7b76ca1943ce2442d79ef972f2cfc0 /Alc | |
parent | 279799ad7020360e59763cbd80af82e202357c51 (diff) |
Avoid using macros to access anonymous structures
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 1 | ||||
-rw-r--r-- | Alc/ALu.c | 34 | ||||
-rw-r--r-- | Alc/bformatdec.c | 2 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 4 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 2 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 6 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 2 | ||||
-rw-r--r-- | Alc/effects/echo.c | 4 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 2 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 2 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 6 | ||||
-rw-r--r-- | Alc/mixer.c | 4 | ||||
-rw-r--r-- | Alc/panning.c | 29 |
13 files changed, 52 insertions, 46 deletions
@@ -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 @@ -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, diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c index ba6daac5..3efdfba9 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.c @@ -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 diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 65d2225b..9be69f92 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -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; diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index 81f3c31b..4ae2acdb 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -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]); } diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 32e5b49e..af8dc954 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -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); } } } diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 546750d2..56931646 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -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) diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index 97a70eea..3d538d9d 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -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) diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index f2428e95..8be689d2 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -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 diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index af64448d..70751d87 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -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]); } diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 711b4372..f6cd2b04 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -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 } diff --git a/Alc/mixer.c b/Alc/mixer.c index 01586f7c..d99a4a8f 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -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) diff --git a/Alc/panning.c b/Alc/panning.c index aaae6bbd..37bf3ac9 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -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); |