src/effects/timestretch.h: add get_samplerate method
authorPaul Brossier <piem@piem.org>
Thu, 29 Sep 2016 11:22:22 +0000 (13:22 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 29 Sep 2016 11:22:22 +0000 (13:22 +0200)
src/effects/timestretch.h
src/effects/timestretch_dummy.c
src/effects/timestretch_rubberband.c

index 9ae6ce7..2728dc6 100644 (file)
@@ -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()
index deef218..2c1b0a5 100644 (file)
@@ -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.;
index ec6ed13..5f4b0a6 100644 (file)
@@ -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);
 }