From 3ea2133a9af69bea32549e8b49ff6df8dfaec952 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 28 Sep 2016 01:29:58 +0200 Subject: [PATCH] src/aubio_setup.c: add custom logging function --- src/aubio_setup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(); -- 2.11.0