diff options
author | Chris Robinson <[email protected]> | 2018-02-17 18:16:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-02-18 23:56:51 -0800 |
commit | b5aa0c07599ce8e8fd17e4ec1a686f3cf0576458 (patch) | |
tree | 3015c6dc50ebc7e9e48dc2b4d18af84eaabdf038 | |
parent | 79604c3c0e0f3f71832a09348cc273a38882cc3e (diff) |
Remove the unnecessary ComputeAmbientGains
-rw-r--r-- | Alc/effects/distortion.c | 5 | ||||
-rw-r--r-- | Alc/panning.c | 26 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 15 |
3 files changed, 4 insertions, 42 deletions
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index dcb2bfe4..6ee89594 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -77,6 +77,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex { const ALCdevice *device = context->Device; ALfloat frequency = (ALfloat)device->Frequency; + ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat bandwidth; ALfloat cutoff; ALfloat edge; @@ -103,7 +104,9 @@ 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 * props->Distortion.Gain, state->Gain); + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain * props->Distortion.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/panning.c b/Alc/panning.c index cf42d3fb..08651736 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -38,7 +38,6 @@ 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]); @@ -162,31 +161,6 @@ void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, } -void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALsizei i; - - for(i = 0;i < numchans;i++) - gains[i] = chancoeffs[i][0] * 1.414213562f * ingain; - for(;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - -void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALfloat gain = 0.0f; - ALsizei i; - - for(i = 0;i < numchans;i++) - { - if(chanmap[i].Index == 0) - gain += chanmap[i].Scale; - } - gains[0] = gain * 1.414213562f * ingain; - for(i = 1;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { ALsizei i, j; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 609118bf..14262d9b 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -467,21 +467,6 @@ 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. - */ -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]); |