summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c4
-rw-r--r--Alc/ALu.c16
-rw-r--r--OpenAL32/Include/alMain.h3
-rw-r--r--alsoftrc.sample8
4 files changed, 29 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 54eb5ecf..7b757a87 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1562,6 +1562,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
TRACE("BS2B disabled\n");
}
+ device->Flags &= ~DEVICE_WIDE_STEREO;
+ if(device->Type != Loopback && !device->Hrtf && GetConfigValueBool(NULL, "wide-stereo", AL_FALSE))
+ device->Flags |= DEVICE_WIDE_STEREO;
+
oldMode = SetMixerFPUMode();
LockDevice(device);
context = device->ContextList;
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]);
}
}
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index f5d76b10..296461c0 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -612,6 +612,9 @@ struct ALCdevice_struct
// Sample type was requested by the config file
#define DEVICE_SAMPLE_TYPE_REQUEST (1<<3)
+// Stereo sources cover 120-degree angles around +/-90
+#define DEVICE_WIDE_STEREO (1<<16)
+
// Specifies if the device is currently running
#define DEVICE_RUNNING (1<<31)
diff --git a/alsoftrc.sample b/alsoftrc.sample
index bbb9815e..58746c8f 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -55,6 +55,14 @@
# stereo modes.
#cf_level = 0
+## wide-stereo:
+# Specifies that stereo sources are given a width of about 120 degrees on each
+# channel, centering on -90 (left) and +90 (right), as opposed to being points
+# placed at -30 (left) and +30 (right). This can be useful for surround-sound
+# to give stereo sources a more encompassing sound. Note that the sound's
+# overall volume will be slightly reduced to account for the extra output.
+#wide-stereo = false
+
## frequency:
# Sets the output frequency.
#frequency = 44100