From a063e379c07015da449bf5a5a6f55cc449f49830 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 15 Jul 2018 21:21:23 +1000 Subject: [PATCH] Setup callbacks for the NULL backend. --- mini_al.h | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/mini_al.h b/mini_al.h index 49c56134..2027381e 100644 --- a/mini_al.h +++ b/mini_al.h @@ -4479,26 +4479,6 @@ mal_result mal_context_get_device_info__null(mal_context* pContext, mal_device_t return MAL_SUCCESS; } -mal_result mal_context_init__null(mal_context* pContext) -{ - mal_assert(pContext != NULL); - - pContext->onDeviceIDEqual = mal_context_is_device_id_equal__null; - pContext->onEnumDevices = mal_context_enumerate_devices__null; - pContext->onGetDeviceInfo = mal_context_get_device_info__null; - - // The null backend always works. - return MAL_SUCCESS; -} - -mal_result mal_context_uninit__null(mal_context* pContext) -{ - mal_assert(pContext != NULL); - mal_assert(pContext->backend == mal_backend_null); - - (void)pContext; - return MAL_SUCCESS; -} void mal_device_uninit__null(mal_device* pDevice) { @@ -4670,6 +4650,35 @@ mal_result mal_device__main_loop__null(mal_device* pDevice) return MAL_SUCCESS; } + + +mal_result mal_context_uninit__null(mal_context* pContext) +{ + mal_assert(pContext != NULL); + mal_assert(pContext->backend == mal_backend_null); + + (void)pContext; + return MAL_SUCCESS; +} + +mal_result mal_context_init__null(mal_context* pContext) +{ + mal_assert(pContext != NULL); + + pContext->onUninit = mal_context_uninit__null; + pContext->onDeviceIDEqual = mal_context_is_device_id_equal__null; + pContext->onEnumDevices = mal_context_enumerate_devices__null; + pContext->onGetDeviceInfo = mal_context_get_device_info__null; + pContext->onDeviceInit = mal_device_init__null; + pContext->onDeviceUninit = mal_device_uninit__null; + pContext->onDeviceStart = mal_device__start_backend__null; + pContext->onDeviceStop = mal_device__stop_backend__null; + pContext->onDeviceBreakMainLoop = mal_device__break_main_loop__null; + pContext->onDeviceMainLoop = mal_device__main_loop__null; + + // The null backend always works. + return MAL_SUCCESS; +} #endif