aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-15 21:13:13 -0800
committerChris Robinson <[email protected]>2012-02-15 21:13:13 -0800
commit7e9af6f406a5f010435d04db2828c083f36ea673 (patch)
treef2e52c746279579781e396cc9ae01e8aaaecad70 /Alc
parent6b272ff585ee5e4563348e115d3c2b5fe689d2e7 (diff)
Use a switch to check the device format with winmm
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/winmm.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index ee2c3a34..6ca5f31d 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -513,16 +513,39 @@ static ALCenum WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
if(i == NumCaptureDevices)
return ALC_INVALID_VALUE;
+ switch(pDevice->FmtChans)
+ {
+ case DevFmtMono:
+ case DevFmtStereo:
+ break;
+
+ case DevFmtQuad:
+ case DevFmtX51:
+ case DevFmtX51Side:
+ case DevFmtX61:
+ case DevFmtX71:
+ return ALC_INVALID_ENUM;
+ }
+
+ switch(pDevice->FmtType)
+ {
+ case DevFmtUByte:
+ case DevFmtShort:
+ case DevFmtInt:
+ case DevFmtFloat:
+ break;
+
+ case DevFmtByte:
+ case DevFmtUShort:
+ case DevFmtUInt:
+ return ALC_INVALID_ENUM;
+ }
+
pData = calloc(1, sizeof(*pData));
if(!pData)
return ALC_OUT_OF_MEMORY;
pDevice->ExtraData = pData;
- if((pDevice->FmtChans != DevFmtMono && pDevice->FmtChans != DevFmtStereo) ||
- (pDevice->FmtType != DevFmtUByte && pDevice->FmtType != DevFmtShort &&
- pDevice->FmtType != DevFmtInt && pDevice->FmtType != DevFmtFloat))
- goto failure;
-
memset(&wfexCaptureFormat, 0, sizeof(WAVEFORMATEX));
wfexCaptureFormat.wFormatTag = ((pDevice->FmtType == DevFmtFloat) ?
WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM);