- Timestamp:
- Dec 20, 2018, 6:19:22 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 9b5aa50
- Parents:
- f5a97ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_wavread.c
rf5a97ed rec3f25f9 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++) {380 if (total_wrote < length) { 381 for (i = end; i < length; i++) { 379 382 read_data->data[i] = 0.; 380 383 } … … 387 390 uint_t end = 0; 388 391 uint_t total_wrote = 0; 392 uint_t length = aubio_source_validate_input_length("source_wavread", s->path, 393 s->hop_size, read_data->length); 394 uint_t channels = aubio_source_validate_input_channels("source_wavread", 395 s->path, s->input_channels, read_data->height); 389 396 if (s->fid == NULL) { 390 397 AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n", … … 392 399 return; 393 400 } 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++) {401 while (total_wrote < length) { 402 end = MIN(s->read_samples - s->read_index, length - total_wrote); 403 for (j = 0; j < channels; j++) { 397 404 for (i = 0; i < end; i++) { 398 405 read_data->data[j][i + total_wrote] = s->output->data[j][i]; … … 400 407 } 401 408 total_wrote += end; 402 if (total_wrote < s->hop_size) {409 if (total_wrote < length) { 403 410 uint_t wavread_read = 0; 404 411 aubio_source_wavread_readframe(s, &wavread_read); … … 412 419 } 413 420 } 414 if (total_wrote < s->hop_size) {421 if (total_wrote < length) { 415 422 for (j = 0; j < read_data->height; j++) { 416 for (i = end; i < s->hop_size; i++) {423 for (i = end; i < length; i++) { 417 424 read_data->data[j][i] = 0.; 418 425 }
Note: See TracChangeset
for help on using the changeset viewer.