mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 16:24:04 +02:00
No exclusive mode for AAudio, OpenSL|ES and Web Audio.
This commit is contained in:
@@ -18010,6 +18010,11 @@ mal_result mal_context_get_device_info__aaudio(mal_context* pContext, mal_device
|
||||
|
||||
mal_assert(pContext != NULL);
|
||||
|
||||
/* No exclusive mode with AAudio. */
|
||||
if (shareMode == mal_share_mode_exclusive) {
|
||||
return MAL_SHARE_MODE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* ID */
|
||||
if (pDeviceID != NULL) {
|
||||
pDeviceInfo->id.aaudio = pDeviceID->aaudio;
|
||||
@@ -18063,6 +18068,11 @@ mal_result mal_device_init__aaudio(mal_context* pContext, mal_device_type type,
|
||||
|
||||
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. */
|
||||
mal_device_config config = *pConfig;
|
||||
config.bufferSizeInFrames = pDevice->bufferSizeInFrames;
|
||||
@@ -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_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. */
|
||||
if (g_malOpenSLInitCounter == 0) {
|
||||
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.
|
||||
//
|
||||
// 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,
|
||||
return MAL_NO_BACKEND;
|
||||
#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.
|
||||
if (pConfig->format == mal_format_f32) {
|
||||
pDevice->internalFormat = mal_format_s32;
|
||||
@@ -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_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()) {
|
||||
return MAL_NO_DEVICE;
|
||||
@@ -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)
|
||||
{
|
||||
/* 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()) {
|
||||
return MAL_NO_DEVICE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user