Changeset d67a08e for tests/src/io
- Timestamp:
- Dec 6, 2013, 3:26:27 AM (11 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 9ec63a0, af27265
- Parents:
- 52b5f34
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/io/test-sink.c
r52b5f34 rd67a08e 9 9 err = 2; 10 10 PRINT_ERR("not enough arguments\n"); 11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] \n", argv[0]);11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 12 12 return err; 13 13 } 14 14 15 uint_t samplerate = 44100;16 uint_t hop_size = 512;17 uint_t n_frames = 0, read = 0;18 19 15 char_t *source_path = argv[1]; 20 16 char_t *sink_path = argv[2]; 21 if ( argc == 4 ) samplerate = atoi(argv[3]); 17 18 uint_t samplerate = 0; 19 uint_t hop_size = 256; 20 if ( argc >= 4 ) samplerate = atoi(argv[3]); 21 if ( argc >= 5 ) hop_size = atoi(argv[4]); 22 if ( argc >= 6 ) { 23 err = 2; 24 PRINT_ERR("too many arguments\n"); 25 return err; 26 } 22 27 23 28 fvec_t *vec = new_fvec(hop_size); 29 if (!vec) { err = 1; goto beach_fvec; } 30 24 31 aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); 32 if (!i) { err = 1; goto beach_source; } 33 25 34 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); 35 26 36 aubio_sink_t *o = new_aubio_sink(sink_path, samplerate); 37 if (!o) { err = 1; goto beach_sink; } 27 38 28 if (!i || !o) { err = 1; goto beach; }39 uint_t n_frames = 0, read = 0; 29 40 30 41 do { … … 34 45 } while ( read == hop_size ); 35 46 36 PRINT_MSG("wrote %d frames at %dHz from %s written to %s\n", 37 n_frames, samplerate, source_path, sink_path); 47 PRINT_MSG("read %d frames at %dHz (%d blocks) from %s written to %s\n", 48 n_frames, samplerate, n_frames / hop_size, 49 source_path, sink_path); 38 50 39 beach: 51 del_aubio_sink(o); 52 beach_sink: 40 53 del_aubio_source(i); 41 del_aubio_sink(o); 54 beach_source: 42 55 del_fvec(vec); 56 beach_fvec: 43 57 return err; 44 58 }
Note: See TracChangeset
for help on using the changeset viewer.