0b4170174162b234379605725e850bb9c7748dcd
[aubio.git] / tests / src / temporal / test-a_weighting.c
1 #include <aubio.h>
2
3 int main (void)
4 {
5   aubio_init();
6
7   aubio_filter_t * f;
8
9   uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
10   uint_t nrates = 6;
11   uint_t samplerate, i = 0;
12
13   for ( samplerate = rates[i]; i < nrates ; i++ ) {
14     f = new_aubio_filter_a_weighting (samplerate);
15     del_aubio_filter (f);
16
17     f = new_aubio_filter (7);
18     aubio_filter_set_a_weighting (f, samplerate);
19     del_aubio_filter (f);
20   }
21
22   // samplerate unknown
23   f = new_aubio_filter_a_weighting (4200);
24   if (!f) {
25     //PRINT_MSG ("failed creating A-weighting filter with samplerate=4200Hz\n");
26   }
27
28   // order to small
29   f = new_aubio_filter (2);
30   if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
31     //PRINT_MSG ("failed setting filter to A-weighting\n");
32   }
33   del_aubio_filter (f);
34
35   // order to big
36   f = new_aubio_filter (12);
37   if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
38     //PRINT_MSG ("failed setting filter to A-weighting\n");
39   }
40   del_aubio_filter (f);
41
42   aubio_cleanup();
43   
44   return 0;
45 }
46