src/effects/timestretch.h: add _seek method
authorPaul Brossier <piem@piem.org>
Thu, 29 Sep 2016 11:38:04 +0000 (13:38 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 29 Sep 2016 11:38:04 +0000 (13:38 +0200)
src/effects/timestretch.h
src/effects/timestretch_dummy.c
src/effects/timestretch_rubberband.c

index 2728dc6..c85cbcc 100644 (file)
@@ -156,6 +156,16 @@ uint_t aubio_timestretch_set_transpose (aubio_timestretch_t * o, smpl_t transpos
 */
 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
index 2c1b0a5..a01abde 100644 (file)
@@ -86,6 +86,9 @@ uint_t aubio_timestretch_get_latency (aubio_timestretch_t * o UNUSED) {
   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 */
index 5f4b0a6..2f259df 100644 (file)
@@ -208,4 +208,12 @@ aubio_timestretch_do (aubio_timestretch_t * p, fvec_t * out, uint_t * read)
   }
 }
 
+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