From: Paul Brossier Date: Sat, 5 Sep 2015 09:49:08 +0000 (+0200) Subject: src/io/sink_sndfile.c: fix for double precision X-Git-Tag: 0.4.4~301^2~4 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=385a06e230ff2c09a5569467bea4351e0f5d9043;p=aubio.git src/io/sink_sndfile.c: fix for double precision --- diff --git a/src/io/sink_sndfile.c b/src/io/sink_sndfile.c index 7f1161ba..9fed7606 100644 --- a/src/io/sink_sndfile.c +++ b/src/io/sink_sndfile.c @@ -33,6 +33,12 @@ #define MAX_CHANNELS 6 #define MAX_SIZE 4096 +#if !HAVE_AUBIO_DOUBLE +#define aubio_sf_write_smpl sf_write_float +#else /* HAVE_AUBIO_DOUBLE */ +#define aubio_sf_write_smpl sf_write_double +#endif /* HAVE_AUBIO_DOUBLE */ + struct _aubio_sink_sndfile_t { uint_t samplerate; uint_t channels; @@ -134,7 +140,7 @@ uint_t aubio_sink_sndfile_open(aubio_sink_sndfile_t *s) { s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS); return AUBIO_FAIL; } - s->scratch_data = AUBIO_ARRAY(float,s->scratch_size); + s->scratch_data = AUBIO_ARRAY(smpl_t,s->scratch_size); return AUBIO_OK; } @@ -161,7 +167,7 @@ void aubio_sink_sndfile_do(aubio_sink_sndfile_t *s, fvec_t * write_data, uint_t } } - written_frames = sf_write_float (s->handle, s->scratch_data, nsamples); + written_frames = aubio_sf_write_smpl (s->handle, s->scratch_data, nsamples); if (written_frames/channels != write) { AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n", write, s->path, (uint_t)written_frames); @@ -191,7 +197,7 @@ void aubio_sink_sndfile_do_multi(aubio_sink_sndfile_t *s, fmat_t * write_data, u } } - written_frames = sf_write_float (s->handle, s->scratch_data, nsamples); + written_frames = aubio_sf_write_smpl (s->handle, s->scratch_data, nsamples); if (written_frames/channels != write) { AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n", write, s->path, (uint_t)written_frames);