Commit d9a95b08 authored by David Reid's avatar David Reid

Add some logging to context initialization.

Public issue https://github.com/mackron/miniaudio/issues/247
parent 21e7c413
...@@ -32592,6 +32592,7 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC ...@@ -32592,6 +32592,7 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
} }
if (pContext->callbacks.onContextInit != NULL) { 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); result = pContext->callbacks.onContextInit(pContext, pConfig, &pContext->callbacks);
} else { } else {
result = MA_NO_BACKEND; result = MA_NO_BACKEND;
...@@ -32619,12 +32620,14 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC ...@@ -32619,12 +32620,14 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
#ifdef MA_HAS_ALSA #ifdef MA_HAS_ALSA
case ma_backend_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); result = ma_context_init__alsa(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_PULSEAUDIO #ifdef MA_HAS_PULSEAUDIO
case ma_backend_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); result = ma_context_init__pulse(pConfig, pContext);
} break; } break;
#endif #endif
...@@ -32637,36 +32640,42 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC ...@@ -32637,36 +32640,42 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
#ifdef MA_HAS_COREAUDIO #ifdef MA_HAS_COREAUDIO
case ma_backend_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); result = ma_context_init__coreaudio(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_SNDIO #ifdef MA_HAS_SNDIO
case ma_backend_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); result = ma_context_init__sndio(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_AUDIO4 #ifdef MA_HAS_AUDIO4
case ma_backend_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); result = ma_context_init__audio4(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_OSS #ifdef MA_HAS_OSS
case ma_backend_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); result = ma_context_init__oss(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_AAUDIO #ifdef MA_HAS_AAUDIO
case ma_backend_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); result = ma_context_init__aaudio(pConfig, pContext);
} break; } break;
#endif #endif
#ifdef MA_HAS_OPENSL #ifdef MA_HAS_OPENSL
case ma_backend_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); result = ma_context_init__opensl(pConfig, pContext);
} break; } break;
#endif #endif
...@@ -32714,6 +32723,8 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC ...@@ -32714,6 +32723,8 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
pContext->backend = backend; pContext->backend = backend;
return result; return result;
} else {
ma_post_log_messagef(pContext, NULL, MA_LOG_LEVEL_VERBOSE, "Failed to initialize %s backend.", ma_get_backend_name(backend));
} }
} }
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