source: tests/src/temporal/test-c_weighting.c @ 378852b

feature/crepe_org
Last change on this file since 378852b was b2de03f, checked in by Paul Brossier <piem@piem.org>, 9 years ago

tests/src/temporal: avoid crash, clarify

  • Property mode set to 100644
File size: 981 bytes
Line 
1#include <aubio.h>
2
3int main (void)
4{
5  aubio_filter_t * f;
6
7  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
8  uint_t nrates = 6;
9  uint_t samplerate, i = 0;
10
11  for ( samplerate = rates[i]; i < nrates ; i++ ) {
12    f = new_aubio_filter_c_weighting (samplerate);
13    del_aubio_filter (f);
14
15    f = new_aubio_filter (5);
16    aubio_filter_set_c_weighting (f, samplerate);
17    del_aubio_filter (f);
18  }
19
20  // samplerate unknown
21  f = new_aubio_filter_c_weighting (4200);
22  if (!f) {
23    //PRINT_WRN ("failed creating C-weighting filter with samplerate=4200Hz");
24  }
25
26  // order to small
27  f = new_aubio_filter (2);
28  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
29    //PRINT_WRN ("failed setting filter to C-weighting");
30  }
31  del_aubio_filter (f);
32
33  // order to big
34  f = new_aubio_filter (12);
35  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
36    //PRINT_WRN ("failed setting filter to C-weighting");
37  }
38  del_aubio_filter (f);
39
40  return 0;
41}
42
Note: See TracBrowser for help on using the repository browser.