Changeset 37d0a0c for src


Ignore:
Timestamp:
Nov 28, 2016, 3:13:19 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
6f440b3
Parents:
0840440
Message:

src/io/source_wavread.c: improve error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_wavread.c

    r0840440 r37d0a0c  
    110110  buf[4] = '\0';
    111111  if ( strcmp((const char *)buf, "RIFF") != 0 ) {
    112     AUBIO_ERR("source_wavread: could not find RIFF header in %s\n", s->path);
     112    AUBIO_ERR("source_wavread: Failed opening %s (could not find RIFF header)\n", s->path);
    113113    goto beach;
    114114  }
     
    121121  buf[4] = '\0';
    122122  if ( strcmp((const char *)buf, "WAVE") != 0 ) {
    123     AUBIO_ERR("source_wavread: wrong format in RIFF header in %s\n", s->path);
     123    AUBIO_ERR("source_wavread: Failed opening %s (wrong format in RIFF header)\n", s->path);
    124124    goto beach;
    125125  }
     
    135135    bytes_junk += read_little_endian(buf, 4);
    136136    if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
    137       AUBIO_ERR("source_wavread: could not seek past JUNK Chunk in %s (%s)\n",
     137      AUBIO_ERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
    138138          s->path, strerror(errno));
    139139      goto beach;
     
    148148  // get the fmt chunk
    149149  if ( strcmp((const char *)buf, "fmt ") != 0 ) {
    150     AUBIO_ERR("source_wavread: failed finding fmt RIFF header in %s\n", s->path);
     150    AUBIO_ERR("source_wavread: Failed opening %s (could not find 'fmt ' in RIFF header)\n", s->path);
    151151    goto beach;
    152152  }
     
    157157  if ( format != 16 ) {
    158158    // TODO accept format 18
    159     AUBIO_ERR("source_wavread: file %s is not encoded with PCM\n", s->path);
     159    AUBIO_ERR("source_wavread: Failed opening %s (not encoded with PCM)\n", s->path);
    160160    goto beach;
    161161  }
    162162  if ( buf[1] || buf[2] | buf[3] ) {
    163     AUBIO_ERR("source_wavread: Subchunk1Size should be 0, in %s\n", s->path);
     163    AUBIO_ERR("source_wavread: Failed opening %s (Subchunk1Size should be 0)\n", s->path);
    164164    goto beach;
    165165  }
     
    168168  bytes_read += fread(buf, 1, 2, s->fid);
    169169  if ( buf[0] != 1 || buf[1] != 0) {
    170     AUBIO_ERR("source_wavread: AudioFormat should be PCM, in %s\n", s->path);
     170    AUBIO_ERR("source_wavread: Failed opening %s (AudioFormat should be PCM)\n", s->path);
    171171    goto beach;
    172172  }
     
    200200
    201201  if ( byterate * 8 != sr * channels * bitspersample ) {
    202     AUBIO_ERR("source_wavread: wrong byterate in %s\n", s->path);
     202    AUBIO_ERR("source_wavread: Failed opening %s (wrong byterate)\n", s->path);
    203203    goto beach;
    204204  }
    205205
    206206  if ( blockalign * 8 != channels * bitspersample ) {
    207     AUBIO_ERR("source_wavread: wrong blockalign in %s\n", s->path);
     207    AUBIO_ERR("source_wavread: Failed opening %s (wrong blockalign)\n", s->path);
    208208    goto beach;
    209209  }
Note: See TracChangeset for help on using the changeset viewer.