Changeset d327b6f for src/io/source_wavread.c
- Timestamp:
- Dec 20, 2018, 8:34:33 PM (5 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
- Children:
- f7f946a
- Parents:
- 9630fa8 (diff), b8fa393 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_wavread.c
r9630fa8 rd327b6f 25 25 #include "fvec.h" 26 26 #include "fmat.h" 27 #include "ioutils.h" 27 28 #include "source_wavread.h" 28 29 … … 348 349 uint_t end = 0; 349 350 uint_t total_wrote = 0; 351 uint_t length = aubio_source_validate_input_length("source_wavread", s->path, 352 s->hop_size, read_data->length); 350 353 if (s->fid == NULL) { 351 354 AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n", … … 353 356 return; 354 357 } 355 while (total_wrote < s->hop_size) {356 end = MIN(s->read_samples - s->read_index, s->hop_size- total_wrote);358 while (total_wrote < length) { 359 end = MIN(s->read_samples - s->read_index, length - total_wrote); 357 360 for (i = 0; i < end; i++) { 358 361 read_data->data[i + total_wrote] = 0; … … 363 366 } 364 367 total_wrote += end; 365 if (total_wrote < s->hop_size) {368 if (total_wrote < length) { 366 369 uint_t wavread_read = 0; 367 370 aubio_source_wavread_readframe(s, &wavread_read); … … 375 378 } 376 379 } 377 if (total_wrote < s->hop_size) { 378 for (i = end; i < s->hop_size; i++) { 379 read_data->data[i] = 0.; 380 } 381 } 380 381 aubio_source_pad_output (read_data, total_wrote); 382 382 383 *read = total_wrote; 383 384 } … … 387 388 uint_t end = 0; 388 389 uint_t total_wrote = 0; 390 uint_t length = aubio_source_validate_input_length("source_wavread", s->path, 391 s->hop_size, read_data->length); 392 uint_t channels = aubio_source_validate_input_channels("source_wavread", 393 s->path, s->input_channels, read_data->height); 389 394 if (s->fid == NULL) { 390 395 AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n", … … 392 397 return; 393 398 } 394 while (total_wrote < s->hop_size) {395 end = MIN(s->read_samples - s->read_index, s->hop_size- total_wrote);396 for (j = 0; j < read_data->height; j++) {399 while (total_wrote < length) { 400 end = MIN(s->read_samples - s->read_index, length - total_wrote); 401 for (j = 0; j < channels; j++) { 397 402 for (i = 0; i < end; i++) { 398 403 read_data->data[j][i + total_wrote] = s->output->data[j][i]; … … 400 405 } 401 406 total_wrote += end; 402 if (total_wrote < s->hop_size) {407 if (total_wrote < length) { 403 408 uint_t wavread_read = 0; 404 409 aubio_source_wavread_readframe(s, &wavread_read); … … 412 417 } 413 418 } 414 if (total_wrote < s->hop_size) { 415 for (j = 0; j < read_data->height; j++) { 416 for (i = end; i < s->hop_size; i++) { 417 read_data->data[j][i] = 0.; 418 } 419 } 420 } 419 420 aubio_source_pad_multi_output(read_data, s->input_channels, total_wrote); 421 421 422 *read = total_wrote; 422 423 }
Note: See TracChangeset
for help on using the changeset viewer.