aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c9
-rw-r--r--Alc/backends/coreaudio.c1
-rw-r--r--Alc/backends/dsound.c5
-rw-r--r--Alc/backends/mmdevapi.c3
-rw-r--r--Alc/backends/opensl.c1
-rw-r--r--Alc/backends/pulseaudio.c3
-rw-r--r--Alc/backends/wave.c20
-rw-r--r--Alc/backends/winmm.c1
-rw-r--r--Alc/panning.c19
-rw-r--r--OpenAL32/Include/alMain.h7
10 files changed, 67 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index c011600c..d2b98edf 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1327,6 +1327,7 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans)
case DevFmtX51Rear: return "5.1 Surround (Rear)";
case DevFmtX61: return "6.1 Surround";
case DevFmtX71: return "7.1 Surround";
+ case DevFmtBFormat3D: return "B-Format 3D";
}
return "(unknown channels)";
}
@@ -1357,6 +1358,7 @@ ALuint ChannelsFromDevFmt(enum DevFmtChannels chans)
case DevFmtX51Rear: return 6;
case DevFmtX61: return 7;
case DevFmtX71: return 8;
+ case DevFmtBFormat3D: return 4;
}
return 0;
}
@@ -1523,6 +1525,12 @@ void SetDefaultWFXChannelOrder(ALCdevice *device)
device->ChannelName[6] = SideLeft;
device->ChannelName[7] = SideRight;
break;
+ case DevFmtBFormat3D:
+ device->ChannelName[0] = Aux0;
+ device->ChannelName[1] = Aux1;
+ device->ChannelName[2] = Aux2;
+ device->ChannelName[3] = Aux3;
+ break;
}
}
@@ -1564,6 +1572,7 @@ void SetDefaultChannelOrder(ALCdevice *device)
case DevFmtQuad:
case DevFmtX51:
case DevFmtX61:
+ case DevFmtBFormat3D:
SetDefaultWFXChannelOrder(device);
break;
}
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index b38cc4ee..43e881da 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -522,6 +522,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
case DevFmtX51Rear:
case DevFmtX61:
case DevFmtX71:
+ case DevFmtBFormat3D:
ERR("%s not supported\n", DevFmtChannelsString(device->FmtChans));
goto error;
}
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 378c0798..fee1fd98 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -468,6 +468,9 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self)
case DevFmtMono:
OutputType.dwChannelMask = SPEAKER_FRONT_CENTER;
break;
+ case DevFmtBFormat3D:
+ device->FmtChans = DevFmtStereo;
+ /*fall-through*/
case DevFmtStereo:
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT;
@@ -780,6 +783,8 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
SPEAKER_SIDE_LEFT |
SPEAKER_SIDE_RIGHT;
break;
+ case DevFmtBFormat3D:
+ break;
}
InputType.Format.wFormatTag = WAVE_FORMAT_PCM;
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index e79122af..95a0948c 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -816,6 +816,9 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self)
OutputType.Format.nChannels = 1;
OutputType.dwChannelMask = MONO;
break;
+ case DevFmtBFormat3D:
+ device->FmtChans = DevFmtStereo;
+ /*fall-through*/
case DevFmtStereo:
OutputType.Format.nChannels = 2;
OutputType.dwChannelMask = STEREO;
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index 6a022753..1043359c 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -79,6 +79,7 @@ static SLuint32 GetChannelMask(enum DevFmtChannels chans)
SL_SPEAKER_FRONT_CENTER|SL_SPEAKER_LOW_FREQUENCY|
SL_SPEAKER_BACK_LEFT|SL_SPEAKER_BACK_RIGHT|
SL_SPEAKER_SIDE_LEFT|SL_SPEAKER_SIDE_RIGHT;
+ case DevFmtBFormat3D: break;
}
return 0;
}
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index 783ed3ce..7ad7dd18 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -956,6 +956,9 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
case DevFmtMono:
mapname = "mono";
break;
+ case DevFmtBFormat3D:
+ device->FmtChans = DevFmtStereo;
+ /*fall-through*/
case DevFmtStereo:
mapname = "front-left,front-right";
break;
diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c
index 6999f0cb..bfe0e2cf 100644
--- a/Alc/backends/wave.c
+++ b/Alc/backends/wave.c
@@ -44,6 +44,15 @@ static const ALubyte SUBTYPE_FLOAT[] = {
0x00, 0x38, 0x9b, 0x71
};
+static const ALubyte SUBTYPE_BFORMAT_PCM[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x21, 0x07, 0xd3, 0x11, 0x86, 0x44, 0xc8, 0xc1,
+ 0xca, 0x00, 0x00, 0x00
+};
+
+static const ALubyte SUBTYPE_BFORMAT_FLOAT[] = {
+ 0x03, 0x00, 0x00, 0x00, 0x21, 0x07, 0xd3, 0x11, 0x86, 0x44, 0xc8, 0xc1,
+ 0xca, 0x00, 0x00, 0x00
+};
static void fwrite16le(ALushort val, FILE *f)
{
@@ -233,11 +242,15 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
ALuint channels=0, bits=0, chanmask=0;
+ int isbformat = 0;
size_t val;
fseek(self->mFile, 0, SEEK_SET);
clearerr(self->mFile);
+ if(GetConfigValueBool("wave", "bformat", 0))
+ device->FmtChans = DevFmtBFormat3D;
+
switch(device->FmtType)
{
case DevFmtByte:
@@ -264,6 +277,10 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break;
case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break;
case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break;
+ case DevFmtBFormat3D:
+ isbformat = 1;
+ chanmask = 0;
+ break;
}
bits = BytesFromDevFmt(device->FmtType) * 8;
channels = ChannelsFromDevFmt(device->FmtChans);
@@ -295,7 +312,8 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
// 32-bit val, channel mask
fwrite32le(chanmask, self->mFile);
// 16 byte GUID, sub-type format
- val = fwrite(((bits==32) ? SUBTYPE_FLOAT : SUBTYPE_PCM), 1, 16, self->mFile);
+ val = fwrite(((bits==32) ? (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) :
+ (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM)), 1, 16, self->mFile);
(void)val;
fprintf(self->mFile, "data");
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 74d3f858..fe2701b0 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -561,6 +561,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name)
case DevFmtX51Rear:
case DevFmtX61:
case DevFmtX71:
+ case DevFmtBFormat3D:
return ALC_INVALID_ENUM;
}
diff --git a/Alc/panning.c b/Alc/panning.c
index 474b704c..a9d0f5cb 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -75,7 +75,7 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
{
for(j = 0;j < MAX_AMBI_COEFFS;j++)
gains[i] += device->Channel[i].HOACoeff[j]*coeffs[j];
- gains[i] = maxf(gains[i], 0.0f) * ingain;
+ gains[i] *= ingain;
}
}
@@ -134,6 +134,11 @@ DECL_CONST static inline const char *GetLabelFromChannel(enum Channel channel)
case BottomBackLeft: return "bottom-back-left";
case BottomBackRight: return "bottom-back-right";
+ case Aux0: return "aux-0";
+ case Aux1: return "aux-1";
+ case Aux2: return "aux-2";
+ case Aux3: return "aux-3";
+
case InvalidChannel: break;
}
return "(unknown)";
@@ -241,6 +246,8 @@ static bool LoadChannelSetup(ALCdevice *device)
channels = surround71_chans;
count = COUNTOF(surround71_chans);
break;
+ case DevFmtBFormat3D:
+ break;
}
if(!layout)
@@ -341,6 +348,11 @@ ALvoid aluInitPanning(ALCdevice *device)
{ BottomFrontRight, { { 0.176777f, 0.125000f, -0.125000f, -0.125000f }, { 0.176777f, 0.125000f, -0.125000f, -0.125000f } } },
{ BottomBackLeft, { { 0.176777f, -0.125000f, 0.125000f, -0.125000f }, { 0.176777f, -0.125000f, 0.125000f, -0.125000f } } },
{ BottomBackRight, { { 0.176777f, -0.125000f, -0.125000f, -0.125000f }, { 0.176777f, -0.125000f, -0.125000f, -0.125000f } } },
+ }, BFormat3D[4] = {
+ { Aux0, { { 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f } } },
+ { Aux1, { { 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f } } },
+ { Aux2, { { 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f } } },
+ { Aux3, { { 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f } } },
};
const ChannelMap *chanmap = NULL;
size_t count = 0;
@@ -420,6 +432,11 @@ ALvoid aluInitPanning(ALCdevice *device)
count = COUNTOF(X71Cfg);
chanmap = X71Cfg;
break;
+
+ case DevFmtBFormat3D:
+ count = COUNTOF(BFormat3D);
+ chanmap = BFormat3D;
+ break;
}
SetChannelMap(device, chanmap, count);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 6b406247..a3e40e8b 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -539,6 +539,11 @@ enum Channel {
BottomBackLeft,
BottomBackRight,
+ Aux0,
+ Aux1,
+ Aux2,
+ Aux3,
+
InvalidChannel
};
@@ -566,6 +571,8 @@ enum DevFmtChannels {
/* Similar to 5.1, except using rear channels instead of sides */
DevFmtX51Rear = 0x80000000,
+ DevFmtBFormat3D,
+
DevFmtChannelsDefault = DevFmtStereo
};
#define MAX_OUTPUT_CHANNELS (8)