shithub: aubio

Download patch

ref: f72364db4c34eac3550cf98dca20641e9aca81f7
parent: f9d5346f86526759d5018836c1a8d8e9b24bcf7b
author: Paul Brossier <piem@piem.org>
date: Sat Mar 2 17:29:36 EST 2013

src/*.h: improve documentation

--- a/src/cvec.h
+++ b/src/cvec.h
@@ -37,7 +37,29 @@
 
 */
 
-/** Buffer for complex data */
+/** Buffer for complex data
+
+  \code
+
+  uint_t buffer_size = 1024;
+
+  // create a complex vector of 512 values
+  cvec_t * input = new_cvec (buffer_size);
+
+  // set some values of the vector
+  input->norm[23] = 2.;
+  input->phas[23] = M_PI;
+  // ..
+
+  // compute the mean of the vector
+  mean = cvec_mean(input);
+
+  // destroy the vector
+  del_cvec (input);
+
+  \endcode
+
+ */
 typedef struct {
   uint_t length;  /**< length of buffer = (requested length)/2 + 1 */
   smpl_t *norm;   /**< norm array of size ::cvec_t.length */
@@ -68,7 +90,7 @@
   result can be obtained by assigning vec->norm[position]. Its purpose
   is to access these values from wrappers, as created by swig.
 
-  \param s vector to write to 
+  \param s vector to write to
   \param data norm value to write in s->norm[position]
   \param position sample position to write to
 
@@ -129,9 +151,9 @@
 */
 smpl_t * cvec_get_phas(cvec_t *s);
 
-/** print out cvec data 
+/** print out cvec data
 
-  \param s vector to print out 
+  \param s vector to print out
 
 */
 void cvec_print(cvec_t *s);
@@ -144,7 +166,7 @@
 */
 void cvec_set(cvec_t *s, smpl_t val);
 
-/** set all elements to zero 
+/** set all elements to zero
 
   \param s vector to modify
 
@@ -151,7 +173,7 @@
 */
 void cvec_zeros(cvec_t *s);
 
-/** set all elements to ones 
+/** set all elements to ones
 
   \param s vector to modify
 
--- a/src/fmat.h
+++ b/src/fmat.h
@@ -27,18 +27,20 @@
 
 /** \file
 
-  Real buffers
+  Matrix of real valued data
 
-  This file specifies the fmat_t type, which is used in aubio to store real
-  valued arrays.
+  This file specifies the fmat_t type, which is used in aubio to store arrays
+  of floating point values.
 
+  \example test-fmat.c
+
 */
 
 /** Buffer for real data */
 typedef struct {
-  uint_t length;   /**< length of buffer */
-  uint_t height; /**< number of channels */
-  smpl_t **data;   /**< data array of size [length] * [channels] */
+  uint_t length; /**< length of matrix */
+  uint_t height; /**< height of matrix */
+  smpl_t **data; /**< data array of size [length] * [height] */
 } fmat_t;
 
 /** fmat_t buffer creation function
--- a/src/fvec.h
+++ b/src/fvec.h
@@ -27,17 +27,46 @@
 
 /** \file
 
-  Real buffers
+  Vector of real-valued data
 
-  This file specifies the fvec_t buffer type, which is used throughout aubio to
-  store real data.
+  This file specifies the ::fvec_t buffer type, which is used throughout aubio
+  to store vector of real-valued ::smpl_t.
 
+  \example test-fvec.c
+
 */
 
-/** Buffer for real data */
+/** Buffer for real data
+
+  Vector of real-valued data
+
+  ::fvec_t is is the structure used to store vector of real-valued data, ::smpl_t .
+
+  \code
+
+  uint_t buffer_size = 1024;
+
+  // create a vector of 512 values
+  fvec_t * input = new_fvec (buffer_size);
+
+  // set some values of the vector
+  input->data[23] = 2.;
+  // ..
+
+  // compute the mean of the vector
+  mean = fvec_mean(a_vector);
+
+  // destroy the vector
+  del_fvec(a_vector);
+
+  \endcode
+
+  See `examples/` and `tests/src` directories for more examples.
+
+ */
 typedef struct {
-  uint_t length;   /**< length of buffer */
-  smpl_t *data;   /**< data array of size [length] */
+  uint_t length;  /**< length of buffer */
+  smpl_t *data;   /**< data vector of length ::fvec_t.length */
 } fvec_t;
 
 /** fvec_t buffer creation function
--- a/src/lvec.h
+++ b/src/lvec.h
@@ -27,18 +27,22 @@
 
 /** \file
 
-  Real buffers
+  Vector of real-valued data in double precision
 
-  This file specifies the lvec_t buffer type, which is used in aubio to store
-  double precision real data. Note that the lvec_t data type is mostly used for
-  IIR filters (see temporal/filter.h).
+  This file specifies the ::lvec_t buffer type, which is used in some places in
+  aubio to store a vector of ::lsmp_t.
 
+  Note: the lvec_t data type is required in some algorithms such as IIR filters
+  (see temporal/filter.h).
+
+  \example test-lvec.c
+
 */
 
 /** Buffer for real data in double precision */
 typedef struct {
-  uint_t length;   /**< length of buffer */
-  lsmp_t *data;   /**< data array of size [length] */
+  uint_t length; /**< length of buffer */
+  lsmp_t *data;  /**< data array of size [length] */
 } lvec_t;
 
 /** lvec_t buffer creation function
--- a/src/mathutils.h
+++ b/src/mathutils.h
@@ -23,6 +23,7 @@
   Various math functions
 
   \example test-mathutils.c
+  \example test-mathutils-window.c
 
  */