Changeset ad1ba08 for src


Ignore:
Timestamp:
Sep 20, 2014, 3:26:13 PM (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:
ffc1f79
Parents:
9657163
Message:

src/io/sink_sndfile.c: improve error messages, set nsamples after write

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_sndfile.c

    r9657163 rad1ba08  
    142142void aubio_sink_sndfile_do(aubio_sink_sndfile_t *s, fvec_t * write_data, uint_t write){
    143143  uint_t i, j,  channels = s->channels;
    144   int nsamples = channels*write;
     144  int nsamples = 0;
    145145  smpl_t *pwrite;
    146146  sf_count_t written_frames;
    147147
    148148  if (write > s->max_size) {
    149     AUBIO_WRN("trying to write %d frames, but only %d can be written at a time",
     149    AUBIO_WRN("sink_sndfile: trying to write %d frames, but only %d can be written at a time\n",
    150150      write, s->max_size);
    151151    write = s->max_size;
    152152  }
     153
     154  nsamples = channels * write;
    153155
    154156  /* interleaving data  */
     
    162164  written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
    163165  if (written_frames/channels != write) {
    164     AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written",
     166    AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n",
    165167      write, s->path, (uint_t)written_frames);
    166168  }
     
    170172void aubio_sink_sndfile_do_multi(aubio_sink_sndfile_t *s, fmat_t * write_data, uint_t write){
    171173  uint_t i, j,  channels = s->channels;
    172   int nsamples = channels*write;
     174  int nsamples = 0;
    173175  smpl_t *pwrite;
    174176  sf_count_t written_frames;
    175177
    176178  if (write > s->max_size) {
    177     AUBIO_WRN("trying to write %d frames, but only %d can be written at a time",
     179    AUBIO_WRN("sink_sndfile: trying to write %d frames, but only %d can be written at a time\n",
    178180      write, s->max_size);
    179181    write = s->max_size;
    180182  }
     183
     184  nsamples = channels * write;
    181185
    182186  /* interleaving data  */
     
    190194  written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
    191195  if (written_frames/channels != write) {
    192     AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written",
     196    AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n",
    193197      write, s->path, (uint_t)written_frames);
    194198  }
Note: See TracChangeset for help on using the changeset viewer.