aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/dsound.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-08-15 13:20:35 -0700
committerChris Robinson <[email protected]>2009-08-15 13:20:35 -0700
commitdc26261065a7ff78657ac79accc993c78069deca (patch)
tree2b9696d7aedc196acce6f1b05409c0f8237abf13 /Alc/dsound.c
parent9bea67fb1c99698ccdf9cfa695a09036846163c6 (diff)
Support 32-bit float output
Diffstat (limited to 'Alc/dsound.c')
-rw-r--r--Alc/dsound.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/Alc/dsound.c b/Alc/dsound.c
index d9ca73e6..ce628665 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -45,6 +45,7 @@
#endif
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
static void *ds_handle;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID pcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter);
@@ -242,22 +243,28 @@ static ALCboolean DSoundStartContext(ALCdevice *device, ALCcontext *context)
{
if(aluBytesFromFormat(device->Format) == 1)
format = AL_FORMAT_MONO8;
- else
+ else if(aluBytesFromFormat(device->Format) == 2)
format = AL_FORMAT_MONO16;
+ else if(aluBytesFromFormat(device->Format) == 4)
+ format = AL_FORMAT_MONO_FLOAT32;
}
else if(speakers == DSSPEAKER_STEREO)
{
if(aluBytesFromFormat(device->Format) == 1)
format = AL_FORMAT_STEREO8;
- else
+ else if(aluBytesFromFormat(device->Format) == 2)
format = AL_FORMAT_STEREO16;
+ else if(aluBytesFromFormat(device->Format) == 4)
+ format = AL_FORMAT_STEREO_FLOAT32;
}
else if(speakers == DSSPEAKER_QUAD)
{
if(aluBytesFromFormat(device->Format) == 1)
format = AL_FORMAT_QUAD8;
- else
+ else if(aluBytesFromFormat(device->Format) == 2)
format = AL_FORMAT_QUAD16;
+ else if(aluBytesFromFormat(device->Format) == 4)
+ format = AL_FORMAT_QUAD32;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_BACK_LEFT |
@@ -267,8 +274,10 @@ static ALCboolean DSoundStartContext(ALCdevice *device, ALCcontext *context)
{
if(aluBytesFromFormat(device->Format) == 1)
format = AL_FORMAT_51CHN8;
- else
+ else if(aluBytesFromFormat(device->Format) == 2)
format = AL_FORMAT_51CHN16;
+ else if(aluBytesFromFormat(device->Format) == 4)
+ format = AL_FORMAT_51CHN32;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_FRONT_CENTER |
@@ -280,8 +289,10 @@ static ALCboolean DSoundStartContext(ALCdevice *device, ALCcontext *context)
{
if(aluBytesFromFormat(device->Format) == 1)
format = AL_FORMAT_71CHN8;
- else
+ else if(aluBytesFromFormat(device->Format) == 2)
format = AL_FORMAT_71CHN16;
+ else if(aluBytesFromFormat(device->Format) == 4)
+ format = AL_FORMAT_71CHN32;
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
SPEAKER_FRONT_CENTER |
@@ -304,12 +315,15 @@ static ALCboolean DSoundStartContext(ALCdevice *device, ALCcontext *context)
OutputType.Format.cbSize = 0;
}
- if(OutputType.Format.nChannels > 2)
+ if(OutputType.Format.nChannels > 2 || OutputType.Format.wBitsPerSample > 16)
{
OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
OutputType.Format.cbSize = 22;
- OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ if(OutputType.Format.wBitsPerSample == 32)
+ OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+ else
+ OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
}
else
{