From d9a95b08d833965ed0a6b82c26df512e99f7ad82 Mon Sep 17 00:00:00 2001 From: David Reid Date: Tue, 15 Dec 2020 18:32:21 +1000 Subject: [PATCH] Add some logging to context initialization. Public issue https://github.com/mackron/miniaudio/issues/247 --- miniaudio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index b734cd3b..3a0a1cab 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -32592,6 +32592,7 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC } if (pContext->callbacks.onContextInit != NULL) { + ma_post_log_messagef(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize %s backend...", ma_get_backend_name(backend)); result = pContext->callbacks.onContextInit(pContext, pConfig, &pContext->callbacks); } else { result = MA_NO_BACKEND; @@ -32619,12 +32620,14 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC #ifdef MA_HAS_ALSA case ma_backend_alsa: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize ALSA backend..."); result = ma_context_init__alsa(pConfig, pContext); } break; #endif #ifdef MA_HAS_PULSEAUDIO case ma_backend_pulseaudio: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize PulseAudio backend..."); result = ma_context_init__pulse(pConfig, pContext); } break; #endif @@ -32637,36 +32640,42 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC #ifdef MA_HAS_COREAUDIO case ma_backend_coreaudio: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize CoreAudio backend..."); result = ma_context_init__coreaudio(pConfig, pContext); } break; #endif #ifdef MA_HAS_SNDIO case ma_backend_sndio: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize sndio backend..."); result = ma_context_init__sndio(pConfig, pContext); } break; #endif #ifdef MA_HAS_AUDIO4 case ma_backend_audio4: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize audio(4) backend..."); result = ma_context_init__audio4(pConfig, pContext); } break; #endif #ifdef MA_HAS_OSS case ma_backend_oss: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize OSS backend..."); result = ma_context_init__oss(pConfig, pContext); } break; #endif #ifdef MA_HAS_AAUDIO case ma_backend_aaudio: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize AAudio backend..."); result = ma_context_init__aaudio(pConfig, pContext); } break; #endif #ifdef MA_HAS_OPENSL case ma_backend_opensl: { + ma_post_log_message(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Attempting to initialize OpenSL backend..."); result = ma_context_init__opensl(pConfig, pContext); } break; #endif @@ -32714,6 +32723,8 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC pContext->backend = backend; return result; + } else { + ma_post_log_messagef(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Failed to initialize %s backend.", ma_get_backend_name(backend)); } }