Changeset b4e1438
- Timestamp:
- Apr 25, 2016, 4:45:22 PM (9 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:
- 691791e
- Parents:
- c6e7ba1
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_wavread.c
rc6e7ba1 rb4e1438 53 53 uint_t eof; 54 54 55 uint_t duration; 56 55 57 size_t seek_start; 56 58 … … 72 74 size_t bytes_read = 0, bytes_expected = 44; 73 75 unsigned char buf[5]; 74 unsigned int format, channels, sr, byterate, blockalign, bitspersample;//, data_size;76 unsigned int format, channels, sr, byterate, blockalign, duration, bitspersample;//, data_size; 75 77 76 78 if (path == NULL) { … … 216 218 // Subchunk2Size 217 219 bytes_read += fread(buf, 1, 4, s->fid); 220 duration = read_little_endian(buf, 4) / blockalign; 221 218 222 //data_size = buf[0] + (buf[1] << 8) + (buf[2] << 16) + (buf[3] << 24); 219 223 //AUBIO_MSG("found %d frames in %s\n", 8 * data_size / bitspersample / channels, s->path); … … 235 239 s->blockalign= blockalign; 236 240 s->bitspersample = bitspersample; 241 242 s->duration = duration; 237 243 238 244 s->short_output = (unsigned char *)calloc(s->blockalign, AUBIO_WAVREAD_BUFSIZE); … … 375 381 } 376 382 383 uint_t aubio_source_wavread_get_duration (const aubio_source_wavread_t * s) { 384 if (s && s->duration) { 385 return s->duration; 386 } 387 return 0; 388 } 389 377 390 uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) { 378 391 if (!s->fid) { -
src/io/source_wavread.h
rc6e7ba1 rb4e1438 126 126 /** 127 127 128 get the duration of source object, in frames 129 130 \param s source object, created with ::new_aubio_source_sndfile 131 \return number of frames in file 132 133 */ 134 uint_t aubio_source_wavread_get_duration (const aubio_source_wavread_t *s); 135 136 /** 137 128 138 close source 129 139 -
tests/src/io/test-source_wavread.c
rc6e7ba1 rb4e1438 36 36 aubio_source_wavread_t * s = 37 37 new_aubio_source_wavread(source_path, samplerate, hop_size); 38 38 39 if (!s) { err = 1; goto beach; } 39 40 fvec_t *vec = new_fvec(hop_size); 41 42 uint_t n_frames_expected = aubio_source_wavread_get_duration(s); 40 43 41 44 samplerate = aubio_source_wavread_get_samplerate(s); … … 47 50 } while ( read == hop_size ); 48 51 49 PRINT_MSG("read %d frames at %dHz (%d blocks) from %s\n", n_frames, samplerate, 50 n_frames / hop_size, source_path); 52 PRINT_MSG("read %d frames (expected %d) at %dHz (%d blocks) from %s\n", 53 n_frames, n_frames_expected, samplerate, n_frames / hop_size, 54 source_path); 51 55 52 56 del_fvec (vec);
Note: See TracChangeset
for help on using the changeset viewer.