ref: f530f121d2e4bed03160556e8d8710044c812d9b
parent: ccf8b77918b5c8a4e8335371bd5e8e0670b6d979
author: Paul Brossier <piem@piem.org>
date: Sun Oct 4 20:30:32 EDT 2009
src/temporal/{a,c}_weighting.{c,h}: set_a,c_weighting return 1 on error, 0 on success
--- a/src/temporal/a_weighting.c
+++ b/src/temporal/a_weighting.c
@@ -26,7 +26,7 @@
#include "temporal/filter.h"
#include "temporal/a_weighting.h"
-void aubio_filter_set_a_weighting (aubio_filter_t * f) {
+uint_t aubio_filter_set_a_weighting (aubio_filter_t * f) {
uint_t samplerate = aubio_filter_get_samplerate (f);
lvec_t *bs = aubio_filter_get_feedforward (f);
@@ -36,7 +36,7 @@
if ( order != 7 ) {
AUBIO_ERROR ( "order of A-weighting filter must be 7, not %d\n", order );
- return;
+ return 1;
}
/* select coefficients according to sampling frequency */
@@ -244,10 +244,11 @@
AUBIO_ERROR ( "sampling rate of A-weighting filter is %d, should be one of\
8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n",
samplerate );
- break;
+ return 1;
}
+ return 0;
}
aubio_filter_t * new_aubio_filter_a_weighting (uint_t samplerate, uint_t channels) {
--- a/src/temporal/a_weighting.h
+++ b/src/temporal/a_weighting.h
@@ -75,7 +75,7 @@
\param f filter object to get coefficients from
*/
-void aubio_filter_set_a_weighting (aubio_filter_t *f);
+uint_t aubio_filter_set_a_weighting (aubio_filter_t *f);
#ifdef __cplusplus
}
--- a/src/temporal/c_weighting.c
+++ b/src/temporal/c_weighting.c
@@ -25,7 +25,7 @@
#include "temporal/filter.h"
#include "temporal/c_weighting.h"
-void aubio_filter_set_c_weighting (aubio_filter_t * f) {
+uint_t aubio_filter_set_c_weighting (aubio_filter_t * f) {
uint_t samplerate = aubio_filter_get_samplerate (f);
lvec_t * bs = aubio_filter_get_feedforward (f);
@@ -35,7 +35,7 @@
if ( order != 5 ) {
AUBIO_ERROR ( "order of C-weighting filter must be 5, not %d\n", order );
- return;
+ return 1;
}
/* select coefficients according to sampling frequency */
@@ -199,10 +199,11 @@
AUBIO_ERROR ( "sampling rate of C-weighting filter is %d, should be one of\
8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n",
samplerate );
- break;
+ return 1;
}
+ return 0;
}
aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate, uint_t channels) {
--- a/src/temporal/c_weighting.h
+++ b/src/temporal/c_weighting.h
@@ -75,7 +75,7 @@
\param f filter object to get coefficients from
*/
-void aubio_filter_set_c_weighting (aubio_filter_t *f);
+uint_t aubio_filter_set_c_weighting (aubio_filter_t *f);
#ifdef __cplusplus
}