From 931877e591e8c8e5c72537a0d8a16e3d98bbfa33 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 30 Dec 2018 14:14:13 +1000 Subject: [PATCH] DirectSound: Updates to how shared mode is handled. * Return MAL_SHARE_MODE_NOT_SUPPORTED if SetCooperativeLevel fails. * Always fail with MAL_SHARE_MODE_NOT_SUPPORTED if exclusive mode is requested for capture. --- mini_al.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mini_al.h b/mini_al.h index 325c8c8b..febf509e 100644 --- a/mini_al.h +++ b/mini_al.h @@ -7530,7 +7530,7 @@ mal_result mal_context_create_IDirectSound__dsound(mal_context* pContext, mal_sh hWnd = ((MAL_PFN_GetDesktopWindow)pContext->win32.GetDesktopWindow)(); } if (FAILED(mal_IDirectSound_SetCooperativeLevel(pDirectSound, hWnd, (shareMode == mal_share_mode_exclusive) ? MAL_DSSCL_EXCLUSIVE : MAL_DSSCL_PRIORITY))) { - return mal_context_post_error(pContext, NULL, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSound_SetCooperateiveLevel() failed for playback device.", MAL_FAILED_TO_OPEN_BACKEND_DEVICE); + return mal_context_post_error(pContext, NULL, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSound_SetCooperateiveLevel() failed for playback device.", MAL_SHARE_MODE_NOT_SUPPORTED); } *ppDirectSound = pDirectSound; @@ -7542,8 +7542,10 @@ mal_result mal_context_create_IDirectSoundCapture__dsound(mal_context* pContext, mal_assert(pContext != NULL); mal_assert(ppDirectSoundCapture != NULL); - // Everything is shared in capture mode by the looks of it. - (void)shareMode; + /* DirectSound does not support exclusive mode for capture. */ + if (shareMode == mal_share_mode_exclusive) { + return MAL_SHARE_MODE_NOT_SUPPORTED; + } *ppDirectSoundCapture = NULL; mal_IDirectSoundCapture* pDirectSoundCapture = NULL;