mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
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.
This commit is contained in:
@@ -7530,7 +7530,7 @@ mal_result mal_context_create_IDirectSound__dsound(mal_context* pContext, mal_sh
|
|||||||
hWnd = ((MAL_PFN_GetDesktopWindow)pContext->win32.GetDesktopWindow)();
|
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))) {
|
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;
|
*ppDirectSound = pDirectSound;
|
||||||
@@ -7542,8 +7542,10 @@ mal_result mal_context_create_IDirectSoundCapture__dsound(mal_context* pContext,
|
|||||||
mal_assert(pContext != NULL);
|
mal_assert(pContext != NULL);
|
||||||
mal_assert(ppDirectSoundCapture != NULL);
|
mal_assert(ppDirectSoundCapture != NULL);
|
||||||
|
|
||||||
// Everything is shared in capture mode by the looks of it.
|
/* DirectSound does not support exclusive mode for capture. */
|
||||||
(void)shareMode;
|
if (shareMode == mal_share_mode_exclusive) {
|
||||||
|
return MAL_SHARE_MODE_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
*ppDirectSoundCapture = NULL;
|
*ppDirectSoundCapture = NULL;
|
||||||
mal_IDirectSoundCapture* pDirectSoundCapture = NULL;
|
mal_IDirectSoundCapture* pDirectSoundCapture = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user