From 16965d502c8b5dc7ef387de42c8c960b87e08a22 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 29 Sep 2016 13:22:22 +0200 Subject: [PATCH] src/effects/timestretch.h: add get_samplerate method --- src/effects/timestretch.h | 12 ++++++++++++ src/effects/timestretch_dummy.c | 4 ++++ src/effects/timestretch_rubberband.c | 6 ++++++ 3 files changed, 22 insertions(+) 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); } -- 2.11.0