From 00819aa659a5a804e8d6c33525f7bc2da814e839 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 21 Apr 2016 19:38:24 +0200 Subject: [PATCH] src/onset/: add const qualifiers --- src/onset/onset.c | 30 +++++++++++++++--------------- src/onset/onset.h | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/onset/onset.c b/src/onset/onset.c index ae300471..4bb2844e 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -45,7 +45,7 @@ struct _aubio_onset_t { }; /* execute onset detection function on iput buffer */ -void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset) +void aubio_onset_do (aubio_onset_t *o, const fvec_t * input, fvec_t * onset) { smpl_t isonset = 0; aubio_pvoc_do (o->pv,input, o->fftgrain); @@ -84,17 +84,17 @@ void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset) return; } -uint_t aubio_onset_get_last (aubio_onset_t *o) +uint_t aubio_onset_get_last (const aubio_onset_t *o) { return o->last_onset - o->delay; } -smpl_t aubio_onset_get_last_s (aubio_onset_t *o) +smpl_t aubio_onset_get_last_s (const aubio_onset_t *o) { return aubio_onset_get_last (o) / (smpl_t) (o->samplerate); } -smpl_t aubio_onset_get_last_ms (aubio_onset_t *o) +smpl_t aubio_onset_get_last_ms (const aubio_onset_t *o) { return aubio_onset_get_last_s (o) * 1000.; } @@ -104,7 +104,7 @@ uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) { return AUBIO_OK; } -smpl_t aubio_onset_get_silence(aubio_onset_t * o) { +smpl_t aubio_onset_get_silence(const aubio_onset_t * o) { return o->silence; } @@ -113,7 +113,7 @@ uint_t aubio_onset_set_threshold(aubio_onset_t * o, smpl_t threshold) { return AUBIO_OK; } -smpl_t aubio_onset_get_threshold(aubio_onset_t * o) { +smpl_t aubio_onset_get_threshold(const aubio_onset_t * o) { return aubio_peakpicker_get_threshold(o->pp); } @@ -122,7 +122,7 @@ uint_t aubio_onset_set_minioi(aubio_onset_t * o, uint_t minioi) { return AUBIO_OK; } -uint_t aubio_onset_get_minioi(aubio_onset_t * o) { +uint_t aubio_onset_get_minioi(const aubio_onset_t * o) { return o->minioi; } @@ -130,7 +130,7 @@ uint_t aubio_onset_set_minioi_s(aubio_onset_t * o, smpl_t minioi) { return aubio_onset_set_minioi (o, minioi * o->samplerate); } -smpl_t aubio_onset_get_minioi_s(aubio_onset_t * o) { +smpl_t aubio_onset_get_minioi_s(const aubio_onset_t * o) { return aubio_onset_get_minioi (o) / (smpl_t) o->samplerate; } @@ -138,7 +138,7 @@ uint_t aubio_onset_set_minioi_ms(aubio_onset_t * o, smpl_t minioi) { return aubio_onset_set_minioi_s (o, minioi / 1000.); } -smpl_t aubio_onset_get_minioi_ms(aubio_onset_t * o) { +smpl_t aubio_onset_get_minioi_ms(const aubio_onset_t * o) { return aubio_onset_get_minioi_s (o) * 1000.; } @@ -147,7 +147,7 @@ uint_t aubio_onset_set_delay(aubio_onset_t * o, uint_t delay) { return AUBIO_OK; } -uint_t aubio_onset_get_delay(aubio_onset_t * o) { +uint_t aubio_onset_get_delay(const aubio_onset_t * o) { return o->delay; } @@ -155,7 +155,7 @@ uint_t aubio_onset_set_delay_s(aubio_onset_t * o, smpl_t delay) { return aubio_onset_set_delay (o, delay * o->samplerate); } -smpl_t aubio_onset_get_delay_s(aubio_onset_t * o) { +smpl_t aubio_onset_get_delay_s(const aubio_onset_t * o) { return aubio_onset_get_delay (o) / (smpl_t) o->samplerate; } @@ -163,21 +163,21 @@ uint_t aubio_onset_set_delay_ms(aubio_onset_t * o, smpl_t delay) { return aubio_onset_set_delay_s (o, delay / 1000.); } -smpl_t aubio_onset_get_delay_ms(aubio_onset_t * o) { +smpl_t aubio_onset_get_delay_ms(const aubio_onset_t * o) { return aubio_onset_get_delay_s (o) * 1000.; } -smpl_t aubio_onset_get_descriptor(aubio_onset_t * o) { +smpl_t aubio_onset_get_descriptor(const aubio_onset_t * o) { return o->desc->data[0]; } -smpl_t aubio_onset_get_thresholded_descriptor(aubio_onset_t * o) { +smpl_t aubio_onset_get_thresholded_descriptor(const aubio_onset_t * o) { fvec_t * thresholded = aubio_peakpicker_get_thresholded_input(o->pp); return thresholded->data[0]; } /* Allocate memory for an onset detection */ -aubio_onset_t * new_aubio_onset (char_t * onset_mode, +aubio_onset_t * new_aubio_onset (const char_t * onset_mode, uint_t buf_size, uint_t hop_size, uint_t samplerate) { aubio_onset_t * o = AUBIO_NEW(aubio_onset_t); diff --git a/src/onset/onset.h b/src/onset/onset.h index cda8d9ab..6dae36f7 100644 --- a/src/onset/onset.h +++ b/src/onset/onset.h @@ -59,7 +59,7 @@ typedef struct _aubio_onset_t aubio_onset_t; \return newly created ::aubio_onset_t */ -aubio_onset_t * new_aubio_onset (char_t * method, +aubio_onset_t * new_aubio_onset (const char_t * method, uint_t buf_size, uint_t hop_size, uint_t samplerate); /** execute onset detection @@ -88,7 +88,7 @@ aubio_onset_t * new_aubio_onset (char_t * method, aubio_onset_get_delay(). */ -void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset); +void aubio_onset_do (aubio_onset_t *o, const fvec_t * input, fvec_t * onset); /** get the time of the latest onset detected, in samples @@ -97,7 +97,7 @@ void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset); \return onset detection timestamps (in samples) */ -uint_t aubio_onset_get_last (aubio_onset_t *o); +uint_t aubio_onset_get_last (const aubio_onset_t *o); /** get the time of the latest onset detected, in seconds @@ -106,7 +106,7 @@ uint_t aubio_onset_get_last (aubio_onset_t *o); \return onset detection timestamps (in seconds) */ -smpl_t aubio_onset_get_last_s (aubio_onset_t *o); +smpl_t aubio_onset_get_last_s (const aubio_onset_t *o); /** get the time of the latest onset detected, in milliseconds @@ -115,7 +115,7 @@ smpl_t aubio_onset_get_last_s (aubio_onset_t *o); \return onset detection timestamps (in milliseconds) */ -smpl_t aubio_onset_get_last_ms (aubio_onset_t *o); +smpl_t aubio_onset_get_last_ms (const aubio_onset_t *o); /** set onset detection silence threshold @@ -132,7 +132,7 @@ uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence); \return current silence threshold */ -smpl_t aubio_onset_get_silence(aubio_onset_t * o); +smpl_t aubio_onset_get_silence(const aubio_onset_t * o); /** get onset detection function @@ -140,7 +140,7 @@ smpl_t aubio_onset_get_silence(aubio_onset_t * o); \return the current value of the descriptor */ -smpl_t aubio_onset_get_descriptor ( aubio_onset_t *o); +smpl_t aubio_onset_get_descriptor (const aubio_onset_t *o); /** get thresholded onset detection function @@ -148,7 +148,7 @@ smpl_t aubio_onset_get_descriptor ( aubio_onset_t *o); \return the value of the thresholded descriptor */ -smpl_t aubio_onset_get_thresholded_descriptor ( aubio_onset_t *o); +smpl_t aubio_onset_get_thresholded_descriptor (const aubio_onset_t *o); /** set onset detection peak picking threshold @@ -219,7 +219,7 @@ uint_t aubio_onset_set_delay_ms(aubio_onset_t * o, smpl_t delay); samples) */ -uint_t aubio_onset_get_minioi(aubio_onset_t * o); +uint_t aubio_onset_get_minioi(const aubio_onset_t * o); /** get minimum inter onset interval in seconds @@ -228,7 +228,7 @@ uint_t aubio_onset_get_minioi(aubio_onset_t * o); seconds) */ -smpl_t aubio_onset_get_minioi_s(aubio_onset_t * o); +smpl_t aubio_onset_get_minioi_s(const aubio_onset_t * o); /** get minimum inter onset interval in milliseconds @@ -237,7 +237,7 @@ smpl_t aubio_onset_get_minioi_s(aubio_onset_t * o); milliseconds) */ -smpl_t aubio_onset_get_minioi_ms(aubio_onset_t * o); +smpl_t aubio_onset_get_minioi_ms(const aubio_onset_t * o); /** get delay in samples @@ -246,7 +246,7 @@ smpl_t aubio_onset_get_minioi_ms(aubio_onset_t * o); (in samples) */ -uint_t aubio_onset_get_delay(aubio_onset_t * o); +uint_t aubio_onset_get_delay(const aubio_onset_t * o); /** get delay in seconds @@ -255,7 +255,7 @@ uint_t aubio_onset_get_delay(aubio_onset_t * o); (in seconds) */ -smpl_t aubio_onset_get_delay_s(aubio_onset_t * o); +smpl_t aubio_onset_get_delay_s(const aubio_onset_t * o); /** get delay in milliseconds @@ -264,7 +264,7 @@ smpl_t aubio_onset_get_delay_s(aubio_onset_t * o); (in milliseconds) */ -smpl_t aubio_onset_get_delay_ms(aubio_onset_t * o); +smpl_t aubio_onset_get_delay_ms(const aubio_onset_t * o); /** get onset peak picking threshold @@ -272,7 +272,7 @@ smpl_t aubio_onset_get_delay_ms(aubio_onset_t * o); \return current onset detection threshold */ -smpl_t aubio_onset_get_threshold(aubio_onset_t * o); +smpl_t aubio_onset_get_threshold(const aubio_onset_t * o); /** delete onset detection object -- 2.11.0