From: Paul Brossier Date: Thu, 29 Sep 2016 11:22:22 +0000 (+0200) Subject: src/effects/timestretch.h: add get_samplerate method X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=fd99f0df666f9dccf3e07b4b7b7b14d7c001fb9b;p=aubio.git src/effects/timestretch.h: add get_samplerate method --- diff --git a/src/effects/timestretch.h b/src/effects/timestretch.h index 9ae6ce7f..2728dc68 100644 --- a/src/effects/timestretch.h +++ b/src/effects/timestretch.h @@ -84,6 +84,18 @@ aubio_timestretch_t *new_aubio_timestretch (const char_t * uri, */ uint_t aubio_timestretch_get_latency (aubio_timestretch_t * o); +/** get the samplerate of the time stretching object + + Call after new_aubio_timestretch() was called with 0 to match the original + samplerate of the input file. + + \param o time stretching object as returned by new_aubio_timestretch() + + \return samplerate of the time stretching object + + */ +uint_t aubio_timestretch_get_samplerate (aubio_timestretch_t * o); + /** set the stretching ratio of the time stretching object \param o time stretching object as returned by new_aubio_timestretch() diff --git a/src/effects/timestretch_dummy.c b/src/effects/timestretch_dummy.c index deef2186..2c1b0a50 100644 --- a/src/effects/timestretch_dummy.c +++ b/src/effects/timestretch_dummy.c @@ -65,6 +65,10 @@ uint_t aubio_timestretch_set_pitchscale (aubio_timestretch_t * o UNUSED, smpl_t return AUBIO_FAIL; } +uint_t aubio_timestretch_get_samplerate (aubio_timestretch_t * o UNUSED) { + return 0; +} + smpl_t aubio_timestretch_get_pitchscale (aubio_timestretch_t * o UNUSED) { return 1.; diff --git a/src/effects/timestretch_rubberband.c b/src/effects/timestretch_rubberband.c index ec6ed13b..5f4b0a66 100644 --- a/src/effects/timestretch_rubberband.c +++ b/src/effects/timestretch_rubberband.c @@ -118,6 +118,12 @@ del_aubio_timestretch (aubio_timestretch_t * p) AUBIO_FREE (p); } +uint_t +aubio_timestretch_get_samplerate (aubio_timestretch_t * p) +{ + return p->samplerate; +} + uint_t aubio_timestretch_get_latency (aubio_timestretch_t * p) { return rubberband_get_latency(p->rb); }