From: Paul Brossier Date: Tue, 27 Sep 2016 23:29:58 +0000 (+0200) Subject: src/aubio_setup.c: add custom logging function X-Git-Url: https://git.aubio.org/?p=pd-aubio.git;a=commitdiff_plain;h=3ea2133a9af69bea32549e8b49ff6df8dfaec952 src/aubio_setup.c: add custom logging function --- diff --git a/src/aubio_setup.c b/src/aubio_setup.c index f56be15..6f3664f 100644 --- a/src/aubio_setup.c +++ b/src/aubio_setup.c @@ -1,5 +1,7 @@ #include +#include +#include char aubio_version[] = "aubio external for pd, version " PACKAGE_VERSION; @@ -25,9 +27,22 @@ void *aubio_new (void) return (void *)x; } +void aubio_custom_log(int level, const char *message, void *data) +{ + // remove the last character, removing the trailing space + char *pos; + if ((pos=strchr(message, '\n')) != NULL) { + *pos = '\0'; + } + post(message); +} + void aubio_setup (void) { post(aubio_version); + // register custom log function for errors and warnings + aubio_log_set_level_function(AUBIO_LOG_ERR, aubio_custom_log, NULL); + aubio_log_set_level_function(AUBIO_LOG_WRN, aubio_custom_log, NULL); aubioonset_tilde_setup(); aubiotempo_tilde_setup(); aubiotss_tilde_setup();