source: tests/src/io/test-sink_apple_audio_file.c @ abd326c

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since abd326c was 9ffcf83, checked in by Paul Brossier <piem@piem.org>, 12 years ago

tests/src/io/: add AUBIO_UNSTABLE

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#define AUBIO_UNSTABLE 1
2#include <aubio.h>
3#include "utils_tests.h"
4
5int main (int argc, char **argv)
6{
7  sint_t err = 0;
8
9  if (argc < 3) {
10    err = 2;
11    PRINT_ERR("not enough arguments\n");
12    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
13    return err;
14  }
15
16#ifdef __APPLE__
17  uint_t samplerate = 44100;
18  uint_t hop_size = 512;
19  uint_t n_frames = 0, read = 0;
20
21  char_t *source_path = argv[1];
22  char_t *sink_path = argv[2];
23  if ( argc == 4 ) samplerate = atoi(argv[3]);
24
25  fvec_t *vec = new_fvec(hop_size);
26  aubio_source_apple_audio_t *i = new_aubio_source_apple_audio(source_path, samplerate, hop_size);
27  if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(i);
28  aubio_sink_apple_audio_t *o = new_aubio_sink_apple_audio(sink_path, samplerate);
29
30  if (!i || !o) { err = 1; goto beach; }
31
32  do {
33    aubio_source_apple_audio_do(i, vec, &read);
34    aubio_sink_apple_audio_do(o, vec, read);
35    n_frames += read;
36  } while ( read == hop_size );
37
38  PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
39      n_frames, source_path, sink_path, samplerate);
40
41beach:
42  del_aubio_source_apple_audio(i);
43  del_aubio_sink_apple_audio(o);
44  del_fvec(vec);
45#else
46  PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
47  err = 3;
48#endif /* __APPLE__ */
49  return err;
50}
Note: See TracBrowser for help on using the repository browser.