- 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
- Location:
- src/io
- Files:
-
- 2 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
Note: See TracChangeset
for help on using the changeset viewer.