Changeset f33ab63


Ignore:
Timestamp:
Sep 5, 2014, 2:41:59 AM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
2abe563
Parents:
0ff4434
Message:

src/io/source_sndfile.c: improve seek errors and strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_sndfile.c

    r0ff4434 rf33ab63  
    200200#ifdef HAVE_SAMPLERATE
    201201  if (s->ratio != 1) {
    202     AUBIO_ERR("source_sndfile: no multi channel resampling yet");
     202    AUBIO_ERR("source_sndfile: no multi channel resampling yet\n");
    203203    return;
    204204    //ptr_data = s->input_data->data;
     
    265265uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) {
    266266  uint_t resampled_pos = (uint_t)ROUND(pos / s->ratio);
    267   return sf_seek (s->handle, resampled_pos, SEEK_SET);
     267  sf_count_t sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET);
     268  if (sf_ret == -1) {
     269    AUBIO_ERR("source_sndfile: Failed seeking %s at %d: %s\n", s->path, pos, sf_strerror (NULL));
     270    return AUBIO_FAIL;
     271  }
     272  if (sf_ret != resampled_pos) {
     273    AUBIO_ERR("source_sndfile: Tried seeking %s at %d, but got %lld: %s\n",
     274        s->path, resampled_pos, sf_ret, sf_strerror (NULL));
     275    return AUBIO_FAIL;
     276  }
     277  return AUBIO_OK;
    268278}
    269279
     
    273283  }
    274284  if(sf_close(s->handle)) {
    275     AUBIO_ERR("source_sndfile: Error closing file %s: %s", s->path, sf_strerror (NULL));
     285    AUBIO_ERR("source_sndfile: Error closing file %s: %s\n", s->path, sf_strerror (NULL));
    276286    return AUBIO_FAIL;
    277287  }
Note: See TracChangeset for help on using the changeset viewer.