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
RevLine 
[a4364b8]1#include <aubio.h>
2
[158e031]3int main (void)
[3684ab4]4{
[a4364b8]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++ ) {
[aea235c]12    f = new_aubio_filter_c_weighting (samplerate);
[a4364b8]13    del_aubio_filter (f);
14
[aea235c]15    f = new_aubio_filter (5);
[59c046d]16    aubio_filter_set_c_weighting (f, samplerate);
[a4364b8]17    del_aubio_filter (f);
18  }
19
20  // samplerate unknown
[aea235c]21  f = new_aubio_filter_c_weighting (4200);
[b2de03f]22  if (!f) {
23    //PRINT_WRN ("failed creating C-weighting filter with samplerate=4200Hz");
24  }
[a4364b8]25
26  // order to small
[aea235c]27  f = new_aubio_filter (2);
[b2de03f]28  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
29    //PRINT_WRN ("failed setting filter to C-weighting");
30  }
[a4364b8]31  del_aubio_filter (f);
32
33  // order to big
[aea235c]34  f = new_aubio_filter (12);
[b2de03f]35  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
36    //PRINT_WRN ("failed setting filter to C-weighting");
37  }
[a4364b8]38  del_aubio_filter (f);
39
40  return 0;
41}
42
Note: See TracBrowser for help on using the repository browser.