diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 27 | ||||
-rw-r--r-- | Alc/panning.c | 9 |
2 files changed, 15 insertions, 21 deletions
@@ -648,10 +648,12 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo voice->Flags |= VOICE_HAS_NFC; } - if(Device->Render_Mode == StereoPair) - CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); - else - CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + /* A scalar of 3 for plain stereo results in +/-30 degrees being + * moved to +/-90 degrees for direct right and left speaker + * responses. + */ + CalcAngleCoeffs((Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(Azi, 3.0f) : Azi, + Elev, Spread, coeffs); /* NOTE: W needs to be scaled by sqrt(2) due to FuMa normalization. */ ComputeDryPanGains(&Device->Dry, coeffs, DryGain*1.414213562f, @@ -895,10 +897,8 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo /* Calculate the directional coefficients once, which apply to all * input channels. */ - if(Device->Render_Mode == StereoPair) - CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); - else - CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + CalcAngleCoeffs((Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(Azi, 3.0f) : Azi, + Elev, Spread, coeffs); for(c = 0;c < num_channels;c++) { @@ -970,14 +970,15 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo continue; } - if(Device->Render_Mode == StereoPair) - CalcAnglePairwiseCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); - else - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); + CalcAngleCoeffs( + (Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(chans[c].angle, 3.0f) + : chans[c].angle, + chans[c].elevation, Spread, coeffs + ); + ComputeDryPanGains(&Device->Dry, coeffs, DryGain, voice->Direct.Params[c].Gains.Target ); - for(i = 0;i < NumSends;i++) { const ALeffectslot *Slot = SendSlots[i]; diff --git a/Alc/panning.c b/Alc/panning.c index 51d65a24..d114295b 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -40,6 +40,7 @@ extern inline void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline float ScaleAzimuthFront(float azimuth, float scale); 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]); @@ -150,14 +151,6 @@ void CalcAmbiCoeffs(const ALfloat y, const ALfloat z, const ALfloat x, const ALf } } -void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) -{ - ALfloat sign = (azimuth < 0.0f) ? -1.0f : 1.0f; - if(!(fabsf(azimuth) > F_PI_2)) - azimuth = minf(fabsf(azimuth) * F_PI_2 / (F_PI/6.0f), F_PI_2) * sign; - CalcAngleCoeffs(azimuth, elevation, spread, coeffs); -} - void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { |