shithub: aubio

Download patch

ref: a0a4d018bf73924b7d3b8231d703a5740fedff9b
parent: 79706161dbc8c4445f10e15dfb723ec405cab03f
author: Paul Brossier <piem@piem.org>
date: Thu Sep 29 09:38:04 EDT 2016

src/effects/timestretch.h: add _seek method

--- a/src/effects/timestretch.h
+++ b/src/effects/timestretch.h
@@ -156,6 +156,16 @@
 */
 smpl_t aubio_timestretch_get_transpose (aubio_timestretch_t * o);
 
+/** seek to a posisition the transposition of the time stretching object, in semitones
+
+  \param o time stretching object as returned by ::new_aubio_timestretch()
+  \param pos position to seek to, in frames
+
+  \return transposition of the time stretching object, in semitones
+
+*/
+uint_t aubio_timestretch_seek(aubio_timestretch_t * o, uint_t pos);
+
 #ifdef __cplusplus
 }
 #endif
--- a/src/effects/timestretch_dummy.c
+++ b/src/effects/timestretch_dummy.c
@@ -86,6 +86,9 @@
   return 0.;
 }
 
+uint_t aubio_timestretch_seek(aubio_timestretch_t *o UNUSED, uint_t pos UNUSED) {
+  return AUBIO_FAIL;
+}
 // end of dummy implementation
 
 #endif /* HAVE_RUBBERBAND */
--- a/src/effects/timestretch_rubberband.c
+++ b/src/effects/timestretch_rubberband.c
@@ -208,4 +208,12 @@
   }
 }
 
+uint_t
+aubio_timestretch_seek (aubio_timestretch_t *p, uint_t pos)
+{
+  p->eof = 0;
+  rubberband_reset(p->rb);
+  return aubio_source_seek(p->source, pos);
+}
+
 #endif