From 0d4228dc1596a332d0e0d522554f315f79da6ae7 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 29 Sep 2016 13:38:04 +0200 Subject: [PATCH] src/effects/timestretch.h: add _seek method --- src/effects/timestretch.h | 10 ++++++++++ src/effects/timestretch_dummy.c | 3 +++ src/effects/timestretch_rubberband.c | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/src/effects/timestretch.h b/src/effects/timestretch.h index 2728dc68..c85cbccb 100644 --- a/src/effects/timestretch.h +++ b/src/effects/timestretch.h @@ -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 diff --git a/src/effects/timestretch_dummy.c b/src/effects/timestretch_dummy.c index 2c1b0a50..a01abde6 100644 --- a/src/effects/timestretch_dummy.c +++ b/src/effects/timestretch_dummy.c @@ -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 */ diff --git a/src/effects/timestretch_rubberband.c b/src/effects/timestretch_rubberband.c index 5f4b0a66..2f259dfc 100644 --- a/src/effects/timestretch_rubberband.c +++ b/src/effects/timestretch_rubberband.c @@ -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 -- 2.11.0