shithub: aubio

Download patch

ref: 52efae1200ebd8c5acf4d389f165cfac2bd8cceb
parent: 5158c229289734eef3a32b17c32c535348e2472a
author: Paul Brossier <piem@piem.org>
date: Fri Jan 3 13:50:36 EST 2014

src/io/source.c: add source_wavread

--- a/src/io/source.c
+++ b/src/io/source.c
@@ -32,6 +32,9 @@
 #ifdef HAVE_SNDFILE
 #include "io/source_sndfile.h"
 #endif /* HAVE_SNDFILE */
+#ifdef HAVE_WAVREAD
+#include "io/source_wavread.h"
+#endif /* HAVE_WAVREAD */
 
 typedef void (*aubio_source_do_t)(aubio_source_t * s, fvec_t * data, uint_t * read);
 typedef void (*aubio_source_do_multi_t)(aubio_source_t * s, fmat_t * data, uint_t * read);
@@ -88,6 +91,18 @@
     return s;
   }
 #endif /* HAVE_SNDFILE */
+#if HAVE_WAVREAD
+  s->source = (void *)new_aubio_source_wavread(uri, samplerate, hop_size);
+  if (s->source) {
+    s->s_do = (aubio_source_do_t)(aubio_source_wavread_do);
+    s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_wavread_do_multi);
+    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_wavread_get_channels);
+    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_wavread_get_samplerate);
+    s->s_seek = (aubio_source_seek_t)(aubio_source_wavread_seek);
+    s->s_del = (del_aubio_source_t)(del_aubio_source_wavread);
+    return s;
+  }
+#endif /* HAVE_WAVREAD */
   AUBIO_ERROR("failed creating aubio source with %s\n", uri);
   AUBIO_FREE(s);
   return NULL;