Commit c72a79f2 authored by David Reid's avatar David Reid

Clean up for asynchronous backends.

parent 73af94d2
...@@ -18659,38 +18659,10 @@ mal_result mal_device_start(mal_device* pDevice) ...@@ -18659,38 +18659,10 @@ mal_result mal_device_start(mal_device* pDevice)
// Asynchronous backends need to be handled differently. // Asynchronous backends need to be handled differently.
if (mal_context_is_backend_asynchronous(pDevice->pContext)) { if (mal_context_is_backend_asynchronous(pDevice->pContext)) {
#ifdef MAL_HAS_JACK result = pDevice->pContext->onDeviceStart(pDevice);
if (pDevice->pContext->backend == mal_backend_jack) { if (result == MAL_SUCCESS) {
result = pDevice->pContext->onDeviceStart(pDevice); mal_device__set_state(pDevice, MAL_STATE_STARTED);
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 { } else {
// Synchronous backends are started by signaling an event that's being waited on in the worker thread. We first wake up the // 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. // thread and then wait for the start event.
...@@ -18738,26 +18710,7 @@ mal_result mal_device_stop(mal_device* pDevice) ...@@ -18738,26 +18710,7 @@ mal_result mal_device_stop(mal_device* pDevice)
// Asynchronous backends need to be handled differently. // Asynchronous backends need to be handled differently.
if (mal_context_is_backend_asynchronous(pDevice->pContext)) { if (mal_context_is_backend_asynchronous(pDevice->pContext)) {
#ifdef MAL_HAS_JACK pDevice->pContext->onDeviceStop(pDevice);
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
} else { } else {
// Synchronous backends. // Synchronous backends.
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