From c72a79f25cd3b9b27a0b2f6ccda0031b9b35b5d9 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 15 Jul 2018 21:18:10 +1000 Subject: [PATCH] Clean up for asynchronous backends. --- mini_al.h | 55 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/mini_al.h b/mini_al.h index 40664d3d..49c56134 100644 --- a/mini_al.h +++ b/mini_al.h @@ -18659,38 +18659,10 @@ mal_result mal_device_start(mal_device* pDevice) // Asynchronous backends need to be handled differently. if (mal_context_is_backend_asynchronous(pDevice->pContext)) { -#ifdef MAL_HAS_JACK - if (pDevice->pContext->backend == mal_backend_jack) { - result = pDevice->pContext->onDeviceStart(pDevice); - if (result == MAL_SUCCESS) { - mal_device__set_state(pDevice, MAL_STATE_STARTED); - } + result = pDevice->pContext->onDeviceStart(pDevice); + if (result == MAL_SUCCESS) { + mal_device__set_state(pDevice, MAL_STATE_STARTED); } -#endif -#ifdef MAL_HAS_COREAUDIO - if (pDevice->pContext->backend == mal_backend_coreaudio) { - result = pDevice->pContext->onDeviceStart(pDevice); - if (result == MAL_SUCCESS) { - mal_device__set_state(pDevice, MAL_STATE_STARTED); - } - } -#endif -#ifdef MAL_HAS_OPENSL - if (pDevice->pContext->backend == mal_backend_opensl) { - result = pDevice->pContext->onDeviceStart(pDevice); - if (result == MAL_SUCCESS) { - mal_device__set_state(pDevice, MAL_STATE_STARTED); - } - } -#endif -#ifdef MAL_HAS_SDL - if (pDevice->pContext->backend == mal_backend_sdl) { - result = pDevice->pContext->onDeviceStart(pDevice); - if (result == MAL_SUCCESS) { - mal_device__set_state(pDevice, MAL_STATE_STARTED); - } - } -#endif } else { // Synchronous backends are started by signaling an event that's being waited on in the worker thread. We first wake up the // thread and then wait for the start event. @@ -18738,26 +18710,7 @@ mal_result mal_device_stop(mal_device* pDevice) // Asynchronous backends need to be handled differently. if (mal_context_is_backend_asynchronous(pDevice->pContext)) { -#ifdef MAL_HAS_JACK - if (pDevice->pContext->backend == mal_backend_jack) { - pDevice->pContext->onDeviceStop(pDevice); - } -#endif -#ifdef MAL_HAS_COREAUDIO - if (pDevice->pContext->backend == mal_backend_coreaudio) { - pDevice->pContext->onDeviceStop(pDevice); - } -#endif -#ifdef MAL_HAS_OPENSL - if (pDevice->pContext->backend == mal_backend_opensl) { - pDevice->pContext->onDeviceStop(pDevice); - } -#endif -#ifdef MAL_HAS_SDL - if (pDevice->pContext->backend == mal_backend_sdl) { - pDevice->pContext->onDeviceStop(pDevice); - } -#endif + pDevice->pContext->onDeviceStop(pDevice); } else { // Synchronous backends.