bytes_read += fread(buf, 1, 4, s->fid);
buf[4] = '\0';
if ( strcmp((const char *)buf, "RIFF") != 0 ) {
- AUBIO_ERR("source_wavread: could not find RIFF header in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (could not find RIFF header)\n", s->path);
goto beach;
}
bytes_read += fread(buf, 1, 4, s->fid);
buf[4] = '\0';
if ( strcmp((const char *)buf, "WAVE") != 0 ) {
- AUBIO_ERR("source_wavread: wrong format in RIFF header in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (wrong format in RIFF header)\n", s->path);
goto beach;
}
buf[4] = '\0';
bytes_junk += read_little_endian(buf, 4);
if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
- AUBIO_ERR("source_wavread: could not seek past JUNK Chunk in %s (%s)\n",
+ AUBIO_ERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
s->path, strerror(errno));
goto beach;
}
// get the fmt chunk
if ( strcmp((const char *)buf, "fmt ") != 0 ) {
- AUBIO_ERR("source_wavread: failed finding fmt RIFF header in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (could not find 'fmt ' in RIFF header)\n", s->path);
goto beach;
}
format = read_little_endian(buf, 4);
if ( format != 16 ) {
// TODO accept format 18
- AUBIO_ERR("source_wavread: file %s is not encoded with PCM\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (not encoded with PCM)\n", s->path);
goto beach;
}
if ( buf[1] || buf[2] | buf[3] ) {
- AUBIO_ERR("source_wavread: Subchunk1Size should be 0, in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (Subchunk1Size should be 0)\n", s->path);
goto beach;
}
// AudioFormat
bytes_read += fread(buf, 1, 2, s->fid);
if ( buf[0] != 1 || buf[1] != 0) {
- AUBIO_ERR("source_wavread: AudioFormat should be PCM, in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (AudioFormat should be PCM)\n", s->path);
goto beach;
}
#endif
if ( byterate * 8 != sr * channels * bitspersample ) {
- AUBIO_ERR("source_wavread: wrong byterate in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (wrong byterate)\n", s->path);
goto beach;
}
if ( blockalign * 8 != channels * bitspersample ) {
- AUBIO_ERR("source_wavread: wrong blockalign in %s\n", s->path);
+ AUBIO_ERR("source_wavread: Failed opening %s (wrong blockalign)\n", s->path);
goto beach;
}