summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-12-21 02:59:30 -0800
committerChris Robinson <[email protected]>2009-12-21 02:59:30 -0800
commitddfad996a92bc681ede2607315981754107b67eb (patch)
treebe1d7a3083a7ba879394643e2c398bd09a0db9aa /Alc
parentd786f990940456eeb74bbe235756179a48912adf (diff)
Don't render mono as stereo
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c6
-rw-r--r--Alc/ALu.c42
2 files changed, 24 insertions, 24 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 426d39f8..13acaa3a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1547,7 +1547,8 @@ void SetDefaultChannelOrder(ALCdevice *device)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: /* Mono is rendered as stereo; fall-through... */
+ case 1: device->DevChannels[0] = FRONT_CENTER; break;
+
case 2: device->DevChannels[0] = FRONT_LEFT;
device->DevChannels[1] = FRONT_RIGHT; break;
@@ -1586,7 +1587,8 @@ void SetDefaultWFXChannelOrder(ALCdevice *device)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: /* Mono is rendered as stereo; fall-through... */
+ case 1: device->DevChannels[0] = FRONT_CENTER; break;
+
case 2: device->DevChannels[0] = FRONT_LEFT;
device->DevChannels[1] = FRONT_RIGHT; break;
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 61218f22..c5f81987 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -235,23 +235,19 @@ ALvoid aluInitPanning(ALCcontext *Context)
switch(Context->Device->Format)
{
- /* Mono is rendered as stereo, then downmixed during post-process */
case AL_FORMAT_MONO8:
case AL_FORMAT_MONO16:
case AL_FORMAT_MONO_FLOAT32:
- Context->ChannelMatrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5);
- Context->ChannelMatrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5);
- Context->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = 1.0f;
- Context->ChannelMatrix[SIDE_RIGHT][FRONT_RIGHT] = 1.0f;
- Context->ChannelMatrix[BACK_LEFT][FRONT_LEFT] = 1.0f;
- Context->ChannelMatrix[BACK_RIGHT][FRONT_RIGHT] = 1.0f;
- Context->ChannelMatrix[BACK_CENTER][FRONT_LEFT] = aluSqrt(0.5);
- Context->ChannelMatrix[BACK_CENTER][FRONT_RIGHT] = aluSqrt(0.5);
- Context->NumChan = 2;
- Speaker2Chan[0] = FRONT_LEFT;
- Speaker2Chan[1] = FRONT_RIGHT;
- SpeakerAngle[0] = -90.0f * M_PI/180.0f;
- SpeakerAngle[1] = 90.0f * M_PI/180.0f;
+ Context->ChannelMatrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[SIDE_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[SIDE_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[BACK_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[BACK_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Context->ChannelMatrix[BACK_CENTER][FRONT_CENTER] = 1.0f;
+ Context->NumChan = 1;
+ Speaker2Chan[0] = FRONT_CENTER;
+ SpeakerAngle[0] = 0.0f * M_PI/180.0f;
break;
case AL_FORMAT_STEREO8:
@@ -371,14 +367,20 @@ ALvoid aluInitPanning(ALCcontext *Context)
for(pos = 0; pos < LUT_NUM; pos++)
{
- /* source angle */
- Theta = aluLUTpos2Angle(pos);
-
/* clear all values */
offset = OUTPUTCHANNELS * pos;
for(s = 0; s < OUTPUTCHANNELS; s++)
Context->PanningLUT[offset+s] = 0.0f;
+ if(Context->NumChan == 1)
+ {
+ Context->PanningLUT[offset + Speaker2Chan[0]] = 1.0f;
+ continue;
+ }
+
+ /* source angle */
+ Theta = aluLUTpos2Angle(pos);
+
/* set panning values */
for(s = 0; s < Context->NumChan - 1; s++)
{
@@ -1251,7 +1253,6 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ALuint SamplesToDo;
ALeffectslot *ALEffectSlot;
ALCcontext *ALContext;
- ALfloat scalar;
int fpuState;
ALuint i, c;
@@ -1303,12 +1304,9 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
#define CHECK_WRITE_FORMAT(bits, type, func) \
case AL_FORMAT_MONO##bits: \
- scalar = aluSqrt(0.5); \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)((DryBuffer[i][ChanMap[0]] + \
- DryBuffer[i][ChanMap[1]]) * \
- scalar); \
+ ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
buffer = ((type*)buffer) + 1; \
} \
break; \