From: Paul Brossier Date: Thu, 29 Sep 2016 11:38:04 +0000 (+0200) Subject: src/effects/timestretch.h: add _seek method X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=a0a4d018bf73924b7d3b8231d703a5740fedff9b;p=aubio.git src/effects/timestretch.h: add _seek method --- 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