From 1a6a47af41208f6656e1517f75692978c5f23473 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 5 Aug 2018 14:11:46 +1000 Subject: [PATCH] WASAPI: Try fixing a glitching bug with capture. --- mini_al.h | 11 ++++++++--- tests/mal_test_0.vcxproj | 21 ++++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/mini_al.h b/mini_al.h index aae31777..49f3f057 100644 --- a/mini_al.h +++ b/mini_al.h @@ -6565,7 +6565,7 @@ mal_uint32 mal_device__get_available_frames__wasapi(mal_device* pDevice) { mal_assert(pDevice != NULL); -#if 1 +#if 0 if (pDevice->type == mal_device_type_playback) { mal_uint32 paddingFramesCount; HRESULT hr = mal_IAudioClient_GetCurrentPadding((mal_IAudioClient*)pDevice->wasapi.pAudioClient, &paddingFramesCount); @@ -6589,15 +6589,20 @@ mal_uint32 mal_device__get_available_frames__wasapi(mal_device* pDevice) } #else mal_uint32 paddingFramesCount; - HRESULT hr = mal_IAudioClient_GetCurrentPadding(pDevice->wasapi.pAudioClient, &paddingFramesCount); + HRESULT hr = mal_IAudioClient_GetCurrentPadding((mal_IAudioClient*)pDevice->wasapi.pAudioClient, &paddingFramesCount); if (FAILED(hr)) { return 0; } + // Slightly different rules for exclusive and shared modes. if (pDevice->exclusiveMode) { return paddingFramesCount; } else { - return pDevice->bufferSizeInFrames - paddingFramesCount; + if (pDevice->type == mal_device_type_playback) { + return pDevice->bufferSizeInFrames - paddingFramesCount; + } else { + return paddingFramesCount; + } } #endif } diff --git a/tests/mal_test_0.vcxproj b/tests/mal_test_0.vcxproj index 79ff7f28..bc10ac97 100644 --- a/tests/mal_test_0.vcxproj +++ b/tests/mal_test_0.vcxproj @@ -270,7 +270,14 @@ true true - + + true + true + true + true + true + true + true true @@ -288,12 +295,12 @@ true - true - true - true - true - true - true + false + false + false + false + false + false true