From 6901b5caa1f6ec66713da9a406ab44529cd2465b Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 26 Oct 2016 11:20:52 +1000 Subject: [PATCH] OpenSL|ES: Call the onStop callback when the device is stopped. --- mini_al.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mini_al.h b/mini_al.h index db6b8a4d..7ff11f5a 100644 --- a/mini_al.h +++ b/mini_al.h @@ -3265,6 +3265,12 @@ static mal_result mal_device__stop_backend__sles(mal_device* pDevice) // Make sure any queued buffers are cleared. MAL_SLES_BUFFERQUEUE(pDevice->sles.pBufferQueue)->Clear((SLAndroidSimpleBufferQueueItf)pDevice->sles.pBufferQueue); + // Make sure the client is aware that the device has stopped. There may be an OpenSL|ES callback for this, but I haven't found it. + mal_device__set_state(pDevice, MAL_STATE_STOPPED); + if (pDevice->onStop) { + pDevice->onStop(pDevice); + } + return MAL_SUCCESS; } #endif @@ -3721,7 +3727,6 @@ mal_result mal_device_stop(mal_device* pDevice) #ifdef MAL_ENABLE_OPENSLES if (pDevice->api == mal_api_sles) { mal_device__stop_backend__sles(pDevice); - mal_device__set_state(pDevice, MAL_STATE_STOPPED); } else #endif // Synchronous backends.