shithub: aubio

Download patch

ref: 11e92ea9e6151b892d042fac5514fabc86eb8220
parent: dd5a052d8a66edeec1176128900f0840cfc80841
author: Paul Brossier <piem@piem.org>
date: Sun Jul 15 10:24:16 EDT 2012

src/io/sink_sndfile.c: fix max_size

--- a/src/io/sink_sndfile.c
+++ b/src/io/sink_sndfile.c
@@ -36,6 +36,9 @@
   uint_t samplerate;
   uint_t channels;
   char_t *path;
+
+  uint_t max_size;
+
   SNDFILE *handle;
   uint_t scratch_size;
   smpl_t *scratch_data;
@@ -70,7 +73,7 @@
     return NULL;
   }	
 
-  s->scratch_size = s->max-size*s->channels;
+  s->scratch_size = s->max_size*s->channels;
   /* allocate data for de/interleaving reallocated when needed. */
   if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
     AUBIO_ERR("%d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
@@ -89,9 +92,9 @@
   smpl_t *pwrite;
 
   if (write > s->max_size) {
-    write = s->max_size;
     AUBIO_WRN("trying to write %d frames, but only %d can be written at a time",
-      write, s->max_frames);
+      write, s->max_size);
+    write = s->max_size;
   }
 
   /* interleaving data  */