source: tests/src/temporal/test-a_weighting.c @ 53849b0

feature/crepe
Last change on this file since 53849b0 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: 990 bytes
RevLine 
[a4364b8]1#include <aubio.h>
2
[158e031]3int main (void)
[3684ab4]4{
[a4364b8]5 
6  aubio_filter_t * f;
7
8  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
9  uint_t nrates = 6;
10  uint_t samplerate, i = 0;
11
12  for ( samplerate = rates[i]; i < nrates ; i++ ) {
[aea235c]13    f = new_aubio_filter_a_weighting (samplerate);
[a4364b8]14    del_aubio_filter (f);
15
[aea235c]16    f = new_aubio_filter (7);
[59c046d]17    aubio_filter_set_a_weighting (f, samplerate);
[a4364b8]18    del_aubio_filter (f);
19  }
20
21  // samplerate unknown
[aea235c]22  f = new_aubio_filter_a_weighting (4200);
[b2de03f]23  if (!f) {
24    //PRINT_MSG ("failed creating A-weighting filter with samplerate=4200Hz\n");
25  }
[a4364b8]26
27  // order to small
[aea235c]28  f = new_aubio_filter (2);
[b2de03f]29  if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
30    //PRINT_MSG ("failed setting filter to A-weighting\n");
31  }
[a4364b8]32  del_aubio_filter (f);
33
34  // order to big
[aea235c]35  f = new_aubio_filter (12);
[b2de03f]36  if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
37    //PRINT_MSG ("failed setting filter to A-weighting\n");
38  }
[a4364b8]39  del_aubio_filter (f);
40
41  return 0;
42}
43
Note: See TracBrowser for help on using the repository browser.