diff options
author | Chris Robinson <[email protected]> | 2015-06-07 13:05:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-06-07 13:05:07 -0700 |
commit | e5964d6dc4b711a4743c799ffbc8e0c914e27db6 (patch) | |
tree | 503e4be52fa3a9b3c3cb39d52b2136db48ce27e8 /Alc/backends/mmdevapi.c | |
parent | ed3f32b087b346340eab4747e7dd9284b76437c4 (diff) |
Double check the mmdevapi capture format
This isn't a real solution, but it should get IAudioClient_IsFormatSupported to
stop failing.
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r-- | Alc/backends/mmdevapi.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index a4fd1071..963ff7c8 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -1427,6 +1427,7 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; WAVEFORMATEXTENSIBLE OutputType; + WAVEFORMATEX *wfx = NULL; REFERENCE_TIME buf_time; UINT32 buffer_len; void *ptr = NULL; @@ -1519,7 +1520,7 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) OutputType.Format.nBlockAlign; hr = IAudioClient_IsFormatSupported(self->client, - AUDCLNT_SHAREMODE_SHARED, &OutputType.Format, NULL + AUDCLNT_SHAREMODE_SHARED, &OutputType.Format, &wfx ); if(FAILED(hr)) { @@ -1527,6 +1528,27 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) return hr; } + /* FIXME: We should do conversion/resampling if we didn't get a matching format. */ + if(wfx->nSamplesPerSec != OutputType.Format.nSamplesPerSec || + wfx->wBitsPerSample != OutputType.Format.wBitsPerSample || + wfx->nChannels != OutputType.Format.nChannels || + wfx->nBlockAlign != OutputType.Format.nBlockAlign) + { + ERR("Did not get matching format, wanted: %s %s %uhz, got: %d channel(s) %d-bit %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), device->Frequency, + wfx->nChannels, wfx->wBitsPerSample, wfx->nSamplesPerSec); + CoTaskMemFree(wfx); + return E_FAIL; + } + + if(!MakeExtensible(&OutputType, wfx)) + { + CoTaskMemFree(wfx); + return E_FAIL; + } + CoTaskMemFree(wfx); + wfx = NULL; + hr = IAudioClient_Initialize(self->client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, buf_time, 0, &OutputType.Format, NULL |