shithub: aubio

Download patch

ref: 779966bd7d91e0ff09e26d8d2f8524791e72e5b4
parent: 5d1f716d0a6ce26298befa58d87e5a6dc938fa76
author: Paul Brossier <piem@piem.org>
date: Sun Jul 15 10:54:38 EDT 2012

src/io/sink.c: implement

--- a/src/io/sink.c
+++ b/src/io/sink.c
@@ -44,13 +44,30 @@
   if (s->sink) return s;
 #endif /* HAVE_SNDFILE */
 #endif /* __APPLE__ */
-  if (s->sink == NULL) { AUBIO_FREE(s); return NULL; }
+  AUBIO_ERROR("failed opening %s", uri);
+  AUBIO_FREE(s);
+  return NULL;
 }
 
 void aubio_sink_do(aubio_sink_t * s, fvec_t * write_data, uint_t write) {
+#ifdef __APPLE__
+  aubio_sink_apple_audio_do((aubio_sink_apple_audio_t *)s->sink, write_data, write);
+#else /* __APPLE__ */
+#if HAVE_SNDFILE
+  aubio_sink_sndfile_do((aubio_sink_sndfile_t *)s->sink, write_data, write);
+#endif /* HAVE_SNDFILE */
+#endif /* __APPLE__ */
 }
 
 void del_aubio_sink(aubio_sink_t * s) {
+  if (!s) return;
+#ifdef __APPLE__
+  del_aubio_sink_apple_audio((aubio_sink_apple_audio_t *)s->sink);
+#else /* __APPLE__ */
+#if HAVE_SNDFILE
+  del_aubio_sink_sndfile((aubio_sink_sndfile_t *)s->sink);
+#endif /* HAVE_SNDFILE */
+#endif /* __APPLE__ */
   AUBIO_FREE(s);
   return;
 }