From 7e9af6f406a5f010435d04db2828c083f36ea673 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 15 Feb 2012 21:13:13 -0800 Subject: Use a switch to check the device format with winmm --- Alc/backends/winmm.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'Alc') 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); -- cgit v1.2.3