source: tests/src/io/test-sink_sndfile.c @ d9ab958

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since d9ab958 was d9ab958, checked in by Paul Brossier <piem@piem.org>, 8 years ago

tests/src/io/test-sink_sndfile.c: update and simplify

  • Property mode set to 100644
File size: 894 bytes
Line 
1#include <stdio.h>
2#include <aubio.h>
3#include "config.h"
4
5char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
6char_t *outpath = "/var/tmp/test.wav";
7
8int main(){
9  int err = 0;
10#ifdef HAVE_SNDFILE
11  uint_t samplerate = 44100;
12  uint_t hop_size = 512;
13  uint_t read = hop_size;
14  fvec_t *vec = new_fvec(hop_size);
15  aubio_source_sndfile_t * i = new_aubio_source_sndfile(path, samplerate, hop_size);
16  aubio_sink_sndfile_t *   o = new_aubio_sink_sndfile(outpath, samplerate);
17
18  if (!i || !o) { err = -1; goto beach; }
19
20  while ( read == hop_size ) {
21    aubio_source_sndfile_do(i, vec, &read);
22    aubio_sink_sndfile_do(o, vec, read);
23  }
24
25beach:
26  del_aubio_source_sndfile(i);
27  del_aubio_sink_sndfile(o);
28  del_fvec(vec);
29#else
30  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
31#endif /* HAVE_SNDFILE */
32  return err;
33}
34
Note: See TracBrowser for help on using the repository browser.