From 93177fa4624ece0d108932472b7edcfdddb14f23 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 15 Oct 2009 21:06:56 +0200 Subject: [PATCH] src/pitch/pitchdetection.{c,h}: update documentation, return ints in set methods --- src/pitch/pitchdetection.c | 5 +++-- src/pitch/pitchdetection.h | 33 +++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/pitch/pitchdetection.c b/src/pitch/pitchdetection.c index 9c85b311..70ed9bbf 100644 --- a/src/pitch/pitchdetection.c +++ b/src/pitch/pitchdetection.c @@ -241,10 +241,10 @@ uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t *p, char_t * pitch_ default: break; } - return 0; + return AUBIO_OK; } -void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol) { +uint_t aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol) { switch(p->type) { case aubio_pitch_yin: aubio_pitchyin_set_tolerance (p->yin, tol); @@ -255,6 +255,7 @@ void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol) { default: break; } + return AUBIO_OK; } void aubio_pitchdetection_do (aubio_pitchdetection_t *p, fvec_t * ibuf, fvec_t *obuf) { diff --git a/src/pitch/pitchdetection.h b/src/pitch/pitchdetection.h index e2c9bfdf..e84c5702 100644 --- a/src/pitch/pitchdetection.h +++ b/src/pitch/pitchdetection.h @@ -37,41 +37,50 @@ typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t; /** execute pitch detection on an input signal frame - \param p pitch detection object as returned by new_aubio_pitchdetection - \param ibuf input signal of length hopsize + \param o pitch detection object as returned by new_aubio_pitchdetection() + \param in input signal of size [hopsize x channels] + \param out output pitch candidates of size [1 x channes] */ -void aubio_pitchdetection_do (aubio_pitchdetection_t * p, fvec_t * ibuf, fvec_t * obuf); +void aubio_pitchdetection_do (aubio_pitchdetection_t * o, fvec_t * in, + fvec_t * out); /** change yin or yinfft tolerance threshold - default is 0.15 for yin and 0.85 for yinfft + \param o pitch detection object as returned by new_aubio_pitchdetection() + \param tol tolerance default is 0.15 for yin and 0.85 for yinfft */ -void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol); +uint_t aubio_pitchdetection_set_tolerance (aubio_pitchdetection_t * o, + smpl_t tol); /** deletion of the pitch detection object - \param p pitch detection object as returned by new_aubio_pitchdetection + \param o pitch detection object as returned by new_aubio_pitchdetection() */ -void del_aubio_pitchdetection(aubio_pitchdetection_t * p); +void del_aubio_pitchdetection (aubio_pitchdetection_t * o); /** creation of the pitch detection object + \param mode set pitch detection algorithm \param bufsize size of the input buffer to analyse \param hopsize step size between two consecutive analysis instant \param channels number of channels to analyse \param samplerate sampling rate of the signal - \param type set pitch detection algorithm - \param mode set pitch units for output */ -aubio_pitchdetection_t *new_aubio_pitchdetection (char_t * pitch_mode, +aubio_pitchdetection_t *new_aubio_pitchdetection (char_t * mode, uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate); -/** set the output unit of the pitch detection object */ -uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t *p, char_t * pitch_unit); +/** set the output unit of the pitch detection object + + \param o pitch detection object as returned by new_aubio_pitchdetection() + \param mode set pitch units for output + +*/ +uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t * o, + char_t * mode); #ifdef __cplusplus } -- 2.26.2