- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/io/base-sink_custom.h
r05774ba3 r43ea60d 26 26 char_t *sink_path = argv[2]; 27 27 28 aubio_source_t *src = NULL; 29 aubio_sink_custom_t *snk = NULL; 30 28 31 if ( argc >= 4 ) samplerate = atoi(argv[3]); 29 32 if ( argc >= 5 ) hop_size = atoi(argv[4]); 30 33 31 34 fvec_t *vec = new_fvec(hop_size); 35 if (!vec) { err = 1; goto failure; } 32 36 33 aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); 34 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); 37 src = new_aubio_source(source_path, samplerate, hop_size); 38 if (!src) { err = 1; goto failure; } 39 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(src); 35 40 36 aubio_sink_custom_t *o = new_aubio_sink_custom(sink_path, samplerate); 37 38 if (!vec || !i || !o) { err = 1; goto failure; } 41 snk = new_aubio_sink_custom(sink_path, samplerate); 42 if (!snk) { err = 1; goto failure; } 39 43 40 44 do { 41 aubio_source_do( i, vec, &read);42 aubio_sink_custom_do( o, vec, read);45 aubio_source_do(src, vec, &read); 46 aubio_sink_custom_do(snk, vec, read); 43 47 n_frames += read; 44 48 } while ( read == hop_size ); … … 49 53 50 54 // close sink now (optional) 51 aubio_sink_custom_close( o);55 aubio_sink_custom_close(snk); 52 56 53 57 failure: 54 if ( o)55 del_aubio_sink_custom( o);56 if ( i)57 del_aubio_source( i);58 if (snk) 59 del_aubio_sink_custom(snk); 60 if (src) 61 del_aubio_source(src); 58 62 if (vec) 59 63 del_fvec(vec);
Note: See TracChangeset
for help on using the changeset viewer.