aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/winmm.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-01-17 12:17:41 -0800
committerChris Robinson <[email protected]>2012-01-17 12:17:41 -0800
commitcf34b9c04e05b6a0b44e7d7cfbf31bcc865b342d (patch)
treee7c3d5d7c2c4d1dd4d82ad1ff14643474cc19c63 /Alc/backends/winmm.c
parent530597347c664277d91d5efc7fff8d10092f2e20 (diff)
Support 32-bit float in the WinMM backend
Diffstat (limited to 'Alc/backends/winmm.c')
-rw-r--r--Alc/backends/winmm.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 1af5105b..c795a70a 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -31,6 +31,10 @@
#include "AL/al.h"
#include "AL/alc.h"
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+#define WAVE_FORMAT_IEEE_FLOAT 0x0003
+#endif
+
typedef struct {
// MMSYSTEM Device
@@ -341,16 +345,17 @@ static ALCenum WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceName)
pDevice->FmtType = DevFmtUByte;
break;
case DevFmtUShort:
- case DevFmtFloat:
pDevice->FmtType = DevFmtShort;
break;
case DevFmtUByte:
case DevFmtShort:
+ case DevFmtFloat:
break;
}
memset(&wfexFormat, 0, sizeof(WAVEFORMATEX));
- wfexFormat.wFormatTag = WAVE_FORMAT_PCM;
+ wfexFormat.wFormatTag = ((pDevice->FmtType == DevFmtFloat) ?
+ WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM);
wfexFormat.nChannels = ChannelsFromDevFmt(pDevice->FmtChans);
wfexFormat.wBitsPerSample = BytesFromDevFmt(pDevice->FmtType) * 8;
wfexFormat.nBlockAlign = wfexFormat.wBitsPerSample *
@@ -529,11 +534,13 @@ static ALCenum WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
pDevice->ExtraData = pData;
if((pDevice->FmtChans != DevFmtMono && pDevice->FmtChans != DevFmtStereo) ||
- (pDevice->FmtType != DevFmtUByte && pDevice->FmtType != DevFmtShort))
+ (pDevice->FmtType != DevFmtUByte && pDevice->FmtType != DevFmtShort &&
+ pDevice->FmtType != DevFmtFloat))
goto failure;
memset(&wfexCaptureFormat, 0, sizeof(WAVEFORMATEX));
- wfexCaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
+ wfexCaptureFormat.wFormatTag = ((pDevice->FmtType == DevFmtFloat) ?
+ WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM);
wfexCaptureFormat.nChannels = ChannelsFromDevFmt(pDevice->FmtChans);
wfexCaptureFormat.wBitsPerSample = BytesFromDevFmt(pDevice->FmtType) * 8;
wfexCaptureFormat.nBlockAlign = wfexCaptureFormat.wBitsPerSample *