aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-08-09 05:38:07 -0700
committerChris Robinson <[email protected]>2012-08-09 05:38:07 -0700
commitd6fd52a0e544dee1e8ae2a1ec908ec689e9f2ae1 (patch)
treefad4d5ac9270d20493dcdada98ca34d0b6d7dbae /Alc/ALu.c
parent0dde7dd88a24a59a484ec36bc26bec19e0ee7d0a (diff)
Add an option for wide stereo sources
Replaces the old stereodup option
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 5ee170a0..c13a5262 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -68,6 +68,10 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{ FrontLeft, -30.0f * F_PI/180.0f },
{ FrontRight, 30.0f * F_PI/180.0f }
};
+ static const struct ChanMap StereoWideMap[2] = {
+ { FrontLeft, -90.0f * F_PI/180.0f },
+ { FrontRight, 90.0f * F_PI/180.0f }
+ };
static const struct ChanMap RearMap[2] = {
{ BackLeft, -150.0f * F_PI/180.0f },
{ BackRight, 150.0f * F_PI/180.0f }
@@ -119,6 +123,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
enum Resampler Resampler;
ALint num_channels = 0;
ALboolean DirectChannels;
+ ALfloat hwidth = 0.0f;
ALfloat Pitch;
ALfloat cw;
ALint i, c;
@@ -200,7 +205,13 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
break;
case FmtStereo:
- chans = StereoMap;
+ if(!(Device->Flags&DEVICE_WIDE_STEREO))
+ chans = StereoMap;
+ else
+ {
+ chans = StereoWideMap;
+ hwidth = 60.0f * F_PI/180.0f;
+ }
num_channels = 2;
break;
@@ -274,6 +285,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
else
{
+ DryGain *= lerp(1.0f, 1.0f/sqrtf(Device->NumChan), hwidth/(F_PI*2.0f));
for(c = 0;c < num_channels;c++)
{
/* Special-case LFE */
@@ -282,7 +294,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
SrcMatrix[c][chans[c].channel] = DryGain;
continue;
}
- ComputeAngleGains(Device, chans[c].angle, 0.0f, DryGain,
+ ComputeAngleGains(Device, chans[c].angle, hwidth, DryGain,
SrcMatrix[c]);
}
}