shithub: aubio

Download patch

ref: ce3ff2bd7f533f9b7d3f511bd842160347fc8d99
parent: eaee767f05f103638540fdd3bd31887a1aab47d6
author: Paul Brossier <piem@piem.org>
date: Thu Apr 21 15:32:58 EDT 2016

src/pitch/: add const qualifiers, filter_do_outplace to avoid modifying input

--- a/src/pitch/pitch.c
+++ b/src/pitch/pitch.c
@@ -61,7 +61,7 @@
 } aubio_pitch_mode;
 
 /** callback to get pitch candidate, defined below */
-typedef void (*aubio_pitch_detect_t) (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
+typedef void (*aubio_pitch_detect_t) (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
 
 /** callback to convert pitch from one unit to another, defined below */
 typedef smpl_t(*aubio_pitch_convert_t) (smpl_t value, uint_t samplerate, uint_t bufsize);
@@ -78,6 +78,7 @@
   uint_t bufsize;                 /**< buffer size */
   void *p_object;                 /**< pointer to pitch object */
   aubio_filter_t *filter;         /**< filter */
+  fvec_t *filtered;               /**< filtered input */
   aubio_pvoc_t *pv;               /**< phase vocoder for mcomb */
   cvec_t *fftgrain;               /**< spectral frame for mcomb */
   fvec_t *buf;                    /**< temporary buffer for yin */
@@ -88,12 +89,12 @@
 };
 
 /* callback functions for pitch detection */
-static void aubio_pitch_do_mcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
-static void aubio_pitch_do_yin (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
-static void aubio_pitch_do_schmitt (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
-static void aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
-static void aubio_pitch_do_yinfft (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
-static void aubio_pitch_do_specacf (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_mcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_yin (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_schmitt (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
+static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
 
 /* conversion functions for frequency conversions */
 smpl_t freqconvbin (smpl_t f, uint_t samplerate, uint_t bufsize);
@@ -101,11 +102,11 @@
 smpl_t freqconvpass (smpl_t f, uint_t samplerate, uint_t bufsize);
 
 /* adapter to stack ibuf new samples at the end of buf, and trim `buf` to `bufsize` */
-void aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf);
+void aubio_pitch_slideblock (aubio_pitch_t * p, const fvec_t * ibuf);
 
 
 aubio_pitch_t *
-new_aubio_pitch (char_t * pitch_mode,
+new_aubio_pitch (const char_t * pitch_mode,
     uint_t bufsize, uint_t hopsize, uint_t samplerate)
 {
   aubio_pitch_t *p = AUBIO_NEW (aubio_pitch_t);
@@ -160,6 +161,7 @@
       aubio_pitchyin_set_tolerance (p->p_object, 0.15);
       break;
     case aubio_pitcht_mcomb:
+      p->filtered = new_fvec (hopsize);
       p->pv = new_aubio_pvoc (bufsize, hopsize);
       p->fftgrain = new_cvec (bufsize);
       p->p_object = new_aubio_pitchmcomb (bufsize, hopsize);
@@ -209,6 +211,7 @@
       del_aubio_pitchyin (p->p_object);
       break;
     case aubio_pitcht_mcomb:
+      del_fvec (p->filtered);
       del_aubio_pvoc (p->pv);
       del_cvec (p->fftgrain);
       del_aubio_filter (p->filter);
@@ -237,7 +240,7 @@
 }
 
 void
-aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf)
+aubio_pitch_slideblock (aubio_pitch_t * p, const fvec_t * ibuf)
 {
   uint_t overlap_size = p->buf->length - ibuf->length;
 #if 1 //!HAVE_MEMCPY_HACKS
@@ -257,7 +260,7 @@
 }
 
 uint_t
-aubio_pitch_set_unit (aubio_pitch_t * p, char_t * pitch_unit)
+aubio_pitch_set_unit (aubio_pitch_t * p, const char_t * pitch_unit)
 {
   uint_t err = AUBIO_OK;
   aubio_pitch_mode pitch_mode;
@@ -342,7 +345,7 @@
 
 /* do method, calling the detection callback, then the conversion callback */
 void
-aubio_pitch_do (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf)
+aubio_pitch_do (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
 {
   p->detect_cb (p, ibuf, obuf);
   if (aubio_silence_detection(ibuf, p->silence) == 1) {
@@ -353,9 +356,9 @@
 
 /* do method for each algorithm */
 void
-aubio_pitch_do_mcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf)
+aubio_pitch_do_mcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
 {
-  aubio_filter_do (p->filter, ibuf);
+  aubio_filter_do_outplace (p->filter, ibuf, p->filtered);
   aubio_pvoc_do (p->pv, ibuf, p->fftgrain);
   aubio_pitchmcomb_do (p->p_object, p->fftgrain, obuf);
   obuf->data[0] = aubio_bintofreq (obuf->data[0], p->samplerate, p->bufsize);
@@ -362,7 +365,7 @@
 }
 
 void
-aubio_pitch_do_yin (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf)
+aubio_pitch_do_yin (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
 {
   smpl_t pitch = 0.;
   aubio_pitch_slideblock (p, ibuf);
@@ -378,7 +381,7 @@
 
 
 void
-aubio_pitch_do_yinfft (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf)
+aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
 {
   smpl_t pitch = 0.;
   aubio_pitch_slideblock (p, ibuf);
@@ -393,7 +396,7 @@
 }
 
 void
-aubio_pitch_do_specacf (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * out)
+aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
 {
   smpl_t pitch = 0., period;
   aubio_pitch_slideblock (p, ibuf);
@@ -409,7 +412,7 @@
 }
 
 void
-aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * out)
+aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
 {
   aubio_pitch_slideblock (p, ibuf);
   aubio_pitchfcomb_do (p->p_object, p->buf, out);
@@ -417,7 +420,7 @@
 }
 
 void
-aubio_pitch_do_schmitt (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * out)
+aubio_pitch_do_schmitt (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
 {
   smpl_t period, pitch = 0.;
   aubio_pitch_slideblock (p, ibuf);
--- a/src/pitch/pitch.h
+++ b/src/pitch/pitch.h
@@ -107,7 +107,7 @@
   \param out output pitch candidates of size [1]
 
 */
-void aubio_pitch_do (aubio_pitch_t * o, fvec_t * in, fvec_t * out);
+void aubio_pitch_do (aubio_pitch_t * o, const fvec_t * in, fvec_t * out);
 
 /** change yin or yinfft tolerance threshold
 
@@ -134,7 +134,7 @@
   \return newly created ::aubio_pitch_t
 
 */
-aubio_pitch_t *new_aubio_pitch (char_t * method,
+aubio_pitch_t *new_aubio_pitch (const char_t * method,
     uint_t buf_size, uint_t hop_size, uint_t samplerate);
 
 /** set the output unit of the pitch detection object
@@ -145,7 +145,7 @@
   \return 0 if successfull, non-zero otherwise
 
 */
-uint_t aubio_pitch_set_unit (aubio_pitch_t * o, char_t * mode);
+uint_t aubio_pitch_set_unit (aubio_pitch_t * o, const char_t * mode);
 
 /** set the silence threshold of the pitch detection object
 
--- a/src/pitch/pitchfcomb.c
+++ b/src/pitch/pitchfcomb.c
@@ -63,7 +63,7 @@
 
 /* input must be stepsize long */
 void
-aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, fvec_t * input, fvec_t * output)
+aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, const fvec_t * input, fvec_t * output)
 {
   uint_t k, l, maxharm = 0;
   smpl_t phaseDifference = TWO_PI * (smpl_t) p->stepSize / (smpl_t) p->fftSize;
--- a/src/pitch/pitchfcomb.h
+++ b/src/pitch/pitchfcomb.h
@@ -51,7 +51,7 @@
   \param output pitch candidates in bins
 
 */
-void aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, fvec_t * input,
+void aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, const fvec_t * input,
     fvec_t * output);
 
 /** creation of the pitch detection object
--- a/src/pitch/pitchmcomb.c
+++ b/src/pitch/pitchmcomb.c
@@ -31,9 +31,9 @@
 uint_t aubio_pitchmcomb_get_root_peak (aubio_spectralpeak_t * peaks,
     uint_t length);
 uint_t aubio_pitchmcomb_quadpick (aubio_spectralpeak_t * spectral_peaks,
-    fvec_t * X);
-void aubio_pitchmcomb_spectral_pp (aubio_pitchmcomb_t * p, fvec_t * oldmag);
-void aubio_pitchmcomb_combdet (aubio_pitchmcomb_t * p, fvec_t * newmag);
+    const fvec_t * X);
+void aubio_pitchmcomb_spectral_pp (aubio_pitchmcomb_t * p, const fvec_t * oldmag);
+void aubio_pitchmcomb_combdet (aubio_pitchmcomb_t * p, const fvec_t * newmag);
 /* not used but useful : sort by amplitudes (or anything else)
  * sort_pitchpeak(peaks, length);
  */
@@ -42,7 +42,7 @@
 /** sort spectral_peak against their mag */
 void aubio_pitchmcomb_sort_peak (aubio_spectralpeak_t * peaks, uint_t nbins);
 /** select the best candidates */
-uint_t aubio_pitch_cands (aubio_pitchmcomb_t * p, cvec_t * fftgrain,
+uint_t aubio_pitch_cands (aubio_pitchmcomb_t * p, const cvec_t * fftgrain,
     smpl_t * cands);
 
 /** sort spectral_candidate against their comb ene */
@@ -101,7 +101,7 @@
 
 
 void
-aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, fvec_t * output)
+aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, const cvec_t * fftgrain, fvec_t * output)
 {
   uint_t j;
   smpl_t instfreq;
@@ -134,7 +134,7 @@
 }
 
 uint_t
-aubio_pitch_cands (aubio_pitchmcomb_t * p, cvec_t * fftgrain, smpl_t * cands)
+aubio_pitch_cands (aubio_pitchmcomb_t * p, const cvec_t * fftgrain, smpl_t * cands)
 {
   uint_t j;
   uint_t k;
@@ -165,7 +165,7 @@
 }
 
 void
-aubio_pitchmcomb_spectral_pp (aubio_pitchmcomb_t * p, fvec_t * newmag)
+aubio_pitchmcomb_spectral_pp (aubio_pitchmcomb_t * p, const fvec_t * newmag)
 {
   fvec_t *mag = (fvec_t *) p->scratch;
   fvec_t *tmp = (fvec_t *) p->scratch2;
@@ -197,7 +197,7 @@
 }
 
 void
-aubio_pitchmcomb_combdet (aubio_pitchmcomb_t * p, fvec_t * newmag)
+aubio_pitchmcomb_combdet (aubio_pitchmcomb_t * p, const fvec_t * newmag)
 {
   aubio_spectralpeak_t *peaks = (aubio_spectralpeak_t *) p->peaks;
   aubio_spectralcandidate_t **candidate =
@@ -285,7 +285,7 @@
  * \bug peak-picking too picky, sometimes counts too many peaks ?
  */
 uint_t
-aubio_pitchmcomb_quadpick (aubio_spectralpeak_t * spectral_peaks, fvec_t * X)
+aubio_pitchmcomb_quadpick (aubio_spectralpeak_t * spectral_peaks, const fvec_t * X)
 {
   uint_t j, ispeak, count = 0;
   for (j = 1; j < X->length - 1; j++) {
--- a/src/pitch/pitchmcomb.h
+++ b/src/pitch/pitchmcomb.h
@@ -52,7 +52,7 @@
   \param out_cands pitch candidate frequenciess, in bins
 
 */
-void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * in_fftgrain,
+void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, const cvec_t * in_fftgrain,
     fvec_t * out_cands);
 
 /** creation of the pitch detection object
--- a/src/pitch/pitchschmitt.c
+++ b/src/pitch/pitchschmitt.c
@@ -47,7 +47,7 @@
 }
 
 void
-aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * input,
+aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, const fvec_t * input,
     fvec_t * output)
 {
   uint_t j;
--- a/src/pitch/pitchschmitt.h
+++ b/src/pitch/pitchschmitt.h
@@ -51,7 +51,7 @@
   \param cands_out pitch period estimates, in samples
 
 */
-void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * samples_in,
+void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, const fvec_t * samples_in,
     fvec_t * cands_out);
 
 /** creation of the pitch detection object
--- a/src/pitch/pitchspecacf.c
+++ b/src/pitch/pitchspecacf.c
@@ -54,7 +54,7 @@
 }
 
 void
-aubio_pitchspecacf_do (aubio_pitchspecacf_t * p, fvec_t * input, fvec_t * output)
+aubio_pitchspecacf_do (aubio_pitchspecacf_t * p, const fvec_t * input, fvec_t * output)
 {
   uint_t l, tau;
   fvec_t *fftout = p->fftout;
@@ -91,7 +91,7 @@
 }
 
 smpl_t
-aubio_pitchspecacf_get_confidence (aubio_pitchspecacf_t * o) {
+aubio_pitchspecacf_get_confidence (const aubio_pitchspecacf_t * o) {
   // no confidence for now
   return o->confidence;
 }
@@ -104,7 +104,7 @@
 }
 
 smpl_t
-aubio_pitchspecacf_get_tolerance (aubio_pitchspecacf_t * p)
+aubio_pitchspecacf_get_tolerance (const aubio_pitchspecacf_t * p)
 {
   return p->tol;
 }
--- a/src/pitch/pitchspecacf.h
+++ b/src/pitch/pitchspecacf.h
@@ -55,7 +55,7 @@
   \param cands_out pitch period candidates, in samples
 
 */
-void aubio_pitchspecacf_do (aubio_pitchspecacf_t * o, fvec_t * samples_in, fvec_t * cands_out);
+void aubio_pitchspecacf_do (aubio_pitchspecacf_t * o, const fvec_t * samples_in, fvec_t * cands_out);
 /** creation of the pitch detection object
 
   \param buf_size size of the input buffer to analyse
@@ -76,7 +76,7 @@
   \return tolerance parameter for minima selection [default 1.]
 
 */
-smpl_t aubio_pitchspecacf_get_tolerance (aubio_pitchspecacf_t * o);
+smpl_t aubio_pitchspecacf_get_tolerance (const aubio_pitchspecacf_t * o);
 
 /** set tolerance parameter for `specacf` pitch detection object
 
@@ -94,7 +94,7 @@
   \return confidence parameter
 
 */
-smpl_t aubio_pitchspecacf_get_confidence (aubio_pitchspecacf_t * o);
+smpl_t aubio_pitchspecacf_get_confidence (const aubio_pitchspecacf_t * o);
 
 #ifdef __cplusplus
 }
--- a/src/pitch/pitchyin.c
+++ b/src/pitch/pitchyin.c
@@ -40,26 +40,26 @@
 };
 
 /** compute difference function
-  
-  \param input input signal 
+
+  \param input input signal
   \param yinbuf output buffer to store difference function (half shorter than input)
 
 */
 void aubio_pitchyin_diff (fvec_t * input, fvec_t * yinbuf);
 
-/** in place computation of the YIN cumulative normalised function 
-  
-  \param yinbuf input signal (a square difference function), also used to store function 
+/** in place computation of the YIN cumulative normalised function
 
+  \param yinbuf input signal (a square difference function), also used to store function
+
 */
 void aubio_pitchyin_getcum (fvec_t * yinbuf);
 
 /** detect pitch in a YIN function
-  
+
   \param yinbuf input buffer as computed by aubio_pitchyin_getcum
 
 */
-uint_t aubio_pitchyin_getpitch (fvec_t * yinbuf);
+uint_t aubio_pitchyin_getpitch (const fvec_t * yinbuf);
 
 aubio_pitchyin_t *
 new_aubio_pitchyin (uint_t bufsize)
@@ -111,7 +111,7 @@
 }
 
 uint_t
-aubio_pitchyin_getpitch (fvec_t * yin)
+aubio_pitchyin_getpitch (const fvec_t * yin)
 {
   uint_t tau = 1;
   do {
@@ -130,7 +130,7 @@
 
 /* all the above in one */
 void
-aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * input, fvec_t * out)
+aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * input, fvec_t * out)
 {
   smpl_t tol = o->tol;
   fvec_t *yin = o->yin;
--- a/src/pitch/pitchyin.h
+++ b/src/pitch/pitchyin.h
@@ -66,7 +66,7 @@
   \param cands_out pitch period candidates, in samples
 
 */
-void aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * samples_in, fvec_t * cands_out);
+void aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * samples_in, fvec_t * cands_out);
 
 
 /** set tolerance parameter for YIN algorithm
--- a/src/pitch/pitchyinfft.c
+++ b/src/pitch/pitchyinfft.c
@@ -98,7 +98,7 @@
 }
 
 void
-aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * input, fvec_t * output)
+aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, const fvec_t * input, fvec_t * output)
 {
   uint_t tau, l;
   uint_t length = p->fftout->length;
--- a/src/pitch/pitchyinfft.h
+++ b/src/pitch/pitchyinfft.h
@@ -52,7 +52,7 @@
   \param cands_out pitch period candidates, in samples
 
 */
-void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, fvec_t * samples_in, fvec_t * cands_out);
+void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, const fvec_t * samples_in, fvec_t * cands_out);
 /** creation of the pitch detection object
 
   \param samplerate samplerate of the input signal
--- a/src/synth/sampler.h
+++ b/src/synth/sampler.h
@@ -59,7 +59,7 @@
   \return 0 if successful, non-zero otherwise
 
 */
-uint_t aubio_sampler_load( aubio_sampler_t * o, char_t * uri );
+uint_t aubio_sampler_load( aubio_sampler_t * o, const char_t * uri );
 
 /** process sampler function
 
@@ -73,7 +73,7 @@
 are added to the output.
 
 */
-void aubio_sampler_do ( aubio_sampler_t * o, fvec_t * input, fvec_t * output);
+void aubio_sampler_do ( aubio_sampler_t * o, const fvec_t * input, fvec_t * output);
 
 /** process sampler function, multiple channels
 
@@ -87,7 +87,7 @@
 are added to the output.
 
 */
-void aubio_sampler_do_multi ( aubio_sampler_t * o, fmat_t * input, fmat_t * output);
+void aubio_sampler_do_multi ( aubio_sampler_t * o, const fmat_t * input, fmat_t * output);
 
 /** get current playing state
 
@@ -96,7 +96,7 @@
   \return 0 if not playing, 1 if playing
 
 */
-uint_t aubio_sampler_get_playing ( aubio_sampler_t * o );
+uint_t aubio_sampler_get_playing ( const aubio_sampler_t * o );
 
 /** set current playing state
 
--- a/src/synth/wavetable.c
+++ b/src/synth/wavetable.c
@@ -68,7 +68,7 @@
   return NULL;
 }
 
-static smpl_t interp_2(fvec_t *input, smpl_t pos) {
+static smpl_t interp_2(const fvec_t *input, smpl_t pos) {
   uint_t idx = (uint_t)FLOOR(pos);
   smpl_t frac = pos - (smpl_t)idx;
   smpl_t a = input->data[idx];
@@ -76,7 +76,7 @@
   return a + frac * ( b - a );
 }
 
-void aubio_wavetable_do ( aubio_wavetable_t * s, fvec_t * input, fvec_t * output)
+void aubio_wavetable_do ( aubio_wavetable_t * s, const fvec_t * input, fvec_t * output)
 {
   uint_t i;
   if (s->playing) {
@@ -107,7 +107,7 @@
   }
 }
 
-void aubio_wavetable_do_multi ( aubio_wavetable_t * s, fmat_t * input, fmat_t * output)
+void aubio_wavetable_do_multi ( aubio_wavetable_t * s, const fmat_t * input, fmat_t * output)
 {
   uint_t i, j;
   if (s->playing) {
@@ -142,7 +142,7 @@
   }
 }
 
-uint_t aubio_wavetable_get_playing ( aubio_wavetable_t * s )
+uint_t aubio_wavetable_get_playing ( const aubio_wavetable_t * s )
 {
   return s->playing;
 }
@@ -172,7 +172,7 @@
   return aubio_parameter_set_target_value ( s->freq, freq );
 }
 
-smpl_t aubio_wavetable_get_freq ( aubio_wavetable_t * s) {
+smpl_t aubio_wavetable_get_freq ( const aubio_wavetable_t * s) {
   return aubio_parameter_get_current_value ( s->freq);
 }
 
@@ -181,7 +181,7 @@
   return aubio_parameter_set_target_value ( s->amp, amp );
 }
 
-smpl_t aubio_wavetable_get_amp ( aubio_wavetable_t * s) {
+smpl_t aubio_wavetable_get_amp ( const aubio_wavetable_t * s) {
   return aubio_parameter_get_current_value ( s->amp );
 }
 
--- a/src/synth/wavetable.h
+++ b/src/synth/wavetable.h
@@ -59,7 +59,7 @@
   \return 0 if successful, non-zero otherwise
 
 */
-uint_t aubio_wavetable_load( aubio_wavetable_t * o, char_t * uri );
+uint_t aubio_wavetable_load( aubio_wavetable_t * o, const char_t * uri );
 
 /** process wavetable function
 
@@ -73,7 +73,7 @@
 are added to the output.
 
 */
-void aubio_wavetable_do ( aubio_wavetable_t * o, fvec_t * input, fvec_t * output);
+void aubio_wavetable_do ( aubio_wavetable_t * o, const fvec_t * input, fvec_t * output);
 
 /** process wavetable function, multiple channels
 
@@ -87,7 +87,7 @@
 are added to the output.
 
 */
-void aubio_wavetable_do_multi ( aubio_wavetable_t * o, fmat_t * input, fmat_t * output);
+void aubio_wavetable_do_multi ( aubio_wavetable_t * o, const fmat_t * input, fmat_t * output);
 
 /** get current playing state
 
@@ -96,7 +96,7 @@
   \return 0 if not playing, 1 if playing
 
 */
-uint_t aubio_wavetable_get_playing ( aubio_wavetable_t * o );
+uint_t aubio_wavetable_get_playing ( const aubio_wavetable_t * o );
 
 /** set current playing state
 
@@ -143,7 +143,7 @@
   \return current frequency, in Hz
 
 */
-smpl_t aubio_wavetable_get_freq ( aubio_wavetable_t * o);
+smpl_t aubio_wavetable_get_freq ( const aubio_wavetable_t * o);
 
 /** set wavetable amplitude
 
@@ -162,7 +162,7 @@
   \return current amplitude
 
 */
-smpl_t aubio_wavetable_get_amp ( aubio_wavetable_t * o);
+smpl_t aubio_wavetable_get_amp ( const aubio_wavetable_t * o);
 
 /** destroy aubio_wavetable_t object