ref: 23f1c490891edf52d289f4332fb02eb847cc9bbe
parent: e4a888256b3ffbd466f3a4c10c7fa767f8762ac4
author: Paul Brossier <[email protected]>
date: Sun Feb 26 20:18:45 EST 2017
src/io/source_wavread.c: raise error in _do/_do_multi, not _readframe
--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -295,11 +295,6 @@
void aubio_source_wavread_readframe(aubio_source_wavread_t *s, uint_t *wavread_read) {
unsigned char *short_ptr = s->short_output;
- if (s->fid == NULL) {
- fmat_zeros(s->output);
- *wavread_read = 0;
- return;
- }
size_t read = fread(short_ptr, s->blockalign, AUBIO_WAVREAD_BUFSIZE, s->fid);
uint_t i, j, b, bitspersample = s->bitspersample;
uint_t wrap_at = (1 << ( bitspersample - 1 ) );
@@ -333,6 +328,11 @@
uint_t i, j;
uint_t end = 0;
uint_t total_wrote = 0;
+ if (s->fid == NULL) {
+ AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
+ s->path);
+ return;
+ }
while (total_wrote < s->hop_size) {
end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
for (i = 0; i < end; i++) {
@@ -367,6 +367,11 @@
uint_t i,j;
uint_t end = 0;
uint_t total_wrote = 0;
+ if (s->fid == NULL) {
+ AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
+ s->path);
+ return;
+ }
while (total_wrote < s->hop_size) {
end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
for (j = 0; j < read_data->height; j++) {