Commit bbd1674d authored by David Reid's avatar David Reid

No exclusive mode for AAudio, OpenSL|ES and Web Audio.

parent 9b80030f
...@@ -18010,6 +18010,11 @@ mal_result mal_context_get_device_info__aaudio(mal_context* pContext, mal_device ...@@ -18010,6 +18010,11 @@ mal_result mal_context_get_device_info__aaudio(mal_context* pContext, mal_device
mal_assert(pContext != NULL); mal_assert(pContext != NULL);
/* No exclusive mode with AAudio. */
if (shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
/* ID */ /* ID */
if (pDeviceID != NULL) { if (pDeviceID != NULL) {
pDeviceInfo->id.aaudio = pDeviceID->aaudio; pDeviceInfo->id.aaudio = pDeviceID->aaudio;
...@@ -18063,6 +18068,11 @@ mal_result mal_device_init__aaudio(mal_context* pContext, mal_device_type type, ...@@ -18063,6 +18068,11 @@ mal_result mal_device_init__aaudio(mal_context* pContext, mal_device_type type,
mal_assert(pDevice != NULL); mal_assert(pDevice != NULL);
/* No exclusive mode with AAudio. */
if (pConfig->shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
/* We need to make a copy of the config so we can make an adjustment to the buffer size. */ /* We need to make a copy of the config so we can make an adjustment to the buffer size. */
mal_device_config config = *pConfig; mal_device_config config = *pConfig;
config.bufferSizeInFrames = pDevice->bufferSizeInFrames; config.bufferSizeInFrames = pDevice->bufferSizeInFrames;
...@@ -18519,13 +18529,17 @@ return_default_device:; ...@@ -18519,13 +18529,17 @@ return_default_device:;
mal_result mal_context_get_device_info__opensl(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, mal_share_mode shareMode, mal_device_info* pDeviceInfo) mal_result mal_context_get_device_info__opensl(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, mal_share_mode shareMode, mal_device_info* pDeviceInfo)
{ {
mal_assert(pContext != NULL); mal_assert(pContext != NULL);
(void)shareMode;
mal_assert(g_malOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it and then attempted to get device info. */ mal_assert(g_malOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it and then attempted to get device info. */
if (g_malOpenSLInitCounter == 0) { if (g_malOpenSLInitCounter == 0) {
return MAL_INVALID_OPERATION; return MAL_INVALID_OPERATION;
} }
/* No exclusive mode with OpenSL|ES. */
if (shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
// TODO: Test Me. // TODO: Test Me.
// //
// This is currently untested, so for now we are just returning default devices. // This is currently untested, so for now we are just returning default devices.
...@@ -18691,6 +18705,11 @@ mal_result mal_device_init__opensl(mal_context* pContext, mal_device_type type, ...@@ -18691,6 +18705,11 @@ mal_result mal_device_init__opensl(mal_context* pContext, mal_device_type type,
return MAL_NO_BACKEND; return MAL_NO_BACKEND;
#endif #endif
/* No exclusive mode with OpenSL|ES. */
if (pConfig->shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
// Use s32 as the internal format for when floating point is specified. // Use s32 as the internal format for when floating point is specified.
if (pConfig->format == mal_format_f32) { if (pConfig->format == mal_format_f32) {
pDevice->internalFormat = mal_format_s32; pDevice->internalFormat = mal_format_s32;
...@@ -19152,7 +19171,11 @@ mal_result mal_context_enumerate_devices__webaudio(mal_context* pContext, mal_en ...@@ -19152,7 +19171,11 @@ mal_result mal_context_enumerate_devices__webaudio(mal_context* pContext, mal_en
mal_result mal_context_get_device_info__webaudio(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, mal_share_mode shareMode, mal_device_info* pDeviceInfo) mal_result mal_context_get_device_info__webaudio(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, mal_share_mode shareMode, mal_device_info* pDeviceInfo)
{ {
mal_assert(pContext != NULL); mal_assert(pContext != NULL);
(void)shareMode;
/* No exclusive mode with Web Audio. */
if (shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
if (deviceType == mal_device_type_capture && !mal_is_capture_supported__webaudio()) { if (deviceType == mal_device_type_capture && !mal_is_capture_supported__webaudio()) {
return MAL_NO_DEVICE; return MAL_NO_DEVICE;
...@@ -19239,6 +19262,11 @@ void mal_device_uninit__webaudio(mal_device* pDevice) ...@@ -19239,6 +19262,11 @@ void mal_device_uninit__webaudio(mal_device* pDevice)
mal_result mal_device_init__webaudio(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, const mal_device_config* pConfig, mal_device* pDevice) mal_result mal_device_init__webaudio(mal_context* pContext, mal_device_type deviceType, const mal_device_id* pDeviceID, const mal_device_config* pConfig, mal_device* pDevice)
{ {
/* No exclusive mode with Web Audio. */
if (pConfig->shareMode == mal_share_mode_exclusive) {
return MAL_SHARE_MODE_NOT_SUPPORTED;
}
if (deviceType == mal_device_type_capture && !mal_is_capture_supported__webaudio()) { if (deviceType == mal_device_type_capture && !mal_is_capture_supported__webaudio()) {
return MAL_NO_DEVICE; return MAL_NO_DEVICE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment