Ignore:
Timestamp:
Feb 23, 2014, 5:29:42 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:
18d8bef
Parents:
4ed4b1f
Message:

src/io/sink_sndfile.c: add missing do_multi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_sndfile.c

    r4ed4b1f r2eccf22  
    2727
    2828#include "aubio_priv.h"
    29 #include "sink_sndfile.h"
    3029#include "fvec.h"
     30#include "fmat.h"
     31#include "io/sink_sndfile.h"
    3132
    3233#define MAX_CHANNELS 6
     
    167168}
    168169
     170void aubio_sink_sndfile_do_multi(aubio_sink_sndfile_t *s, fmat_t * write_data, uint_t write){
     171  uint_t i, j,  channels = s->channels;
     172  int nsamples = channels*write;
     173  smpl_t *pwrite;
     174  sf_count_t written_frames;
     175
     176  if (write > s->max_size) {
     177    AUBIO_WRN("trying to write %d frames, but only %d can be written at a time",
     178      write, s->max_size);
     179    write = s->max_size;
     180  }
     181
     182  /* interleaving data  */
     183  for ( i = 0; i < write_data->height; i++) {
     184    pwrite = (smpl_t *)write_data->data[i];
     185    for (j = 0; j < write; j++) {
     186      s->scratch_data[channels*j+i] = pwrite[j];
     187    }
     188  }
     189
     190  written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
     191  if (written_frames/channels != write) {
     192    AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written",
     193      write, s->path, (uint_t)written_frames);
     194  }
     195  return;
     196}
     197
    169198uint_t aubio_sink_sndfile_close (aubio_sink_sndfile_t *s) {
    170199  if (!s->handle) {
Note: See TracChangeset for help on using the changeset viewer.