Since version 1.0.8, assert() for some non-fatal errors are removed
and error messages are no longer shown to stderr as default. Instead,
the error messages appear only when the environment variable
-LIBASOUND_DEBUG is set. When LIBASOUND_DEBUG=assert is set, the
-default error message handler calls assert() to catch with a
-debugger.
+LIBASOUND_DEBUG is set (to a non-empty value).
+
+When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration
+will be dumped to stderr. Note that this will show even the non-fatal
+errors of plug layer (trial-and-error of parameters).
+When LIBASOUND_DEBUG=2 is set, the default error message handler calls
+assert() to catch with a debugger, in addition to parameter debugging.
This feature is disabled when --with-debug=no is passed to configure,
i.e. no strict checking is done in alsa-lib.
fprintf(stderr, ": %s", snd_strerror(err));
putc('\n', stderr);
va_end(arg);
- if (! strcmp(verbose, "assert"))
+ if (! strcmp(verbose, "assert") || atoi(verbose) > 1)
assert(0);
}
#ifndef NDEBUG
/*
- * dump hw_params when $LIBASOUND_DEBUG is set
+ * dump hw_params when $LIBASOUND_DEBUG is set to >= 1
*/
static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type,
snd_pcm_hw_param_t var, unsigned int val, int err)
const char *verbose = getenv("LIBASOUND_DEBUG");
snd_output_t *out;
- if (! verbose || ! *verbose)
+ if (! verbose || ! *verbose || atoi(verbose) < 1)
return;
if (snd_output_stdio_attach(&out, stderr, 0) < 0)
return;