shithub: aubio

Download patch

ref: fd99f0df666f9dccf3e07b4b7b7b14d7c001fb9b
parent: c41637b65677b5f81d5f99ba1743fbe1062b119c
author: Paul Brossier <piem@piem.org>
date: Thu Sep 29 09:22:22 EDT 2016

src/effects/timestretch.h: add get_samplerate method

--- a/src/effects/timestretch.h
+++ b/src/effects/timestretch.h
@@ -84,6 +84,18 @@
 */
 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()
--- a/src/effects/timestretch_dummy.c
+++ b/src/effects/timestretch_dummy.c
@@ -65,6 +65,10 @@
   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.;
--- a/src/effects/timestretch_rubberband.c
+++ b/src/effects/timestretch_rubberband.c
@@ -118,6 +118,12 @@
   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);
 }