ref: 385a06e230ff2c09a5569467bea4351e0f5d9043
parent: a65d37a303f0f35cc5543f0ef8f9c8c355659980
author: Paul Brossier <piem@piem.org>
date: Sat Sep 5 07:49:08 EDT 2015
src/io/sink_sndfile.c: fix for double precision
--- 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 @@
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 @@
}
}
- 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 @@
}
}
- 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);