2 Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
4 This file is part of aubio.
6 aubio is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 aubio is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with aubio. If not, see <http://www.gnu.org/licenses/>.
32 This file specifies the cvec_t buffer type, which is used throughout aubio to
33 store complex data. Complex values are stored in terms of phase and
34 norm, within size/2+1 long vectors.
38 /** Buffer for complex data */
40 uint_t length; /**< length of buffer = (requested length)/2 + 1 */
41 smpl_t *norm; /**< norm array of size [length] */
42 smpl_t *phas; /**< phase array of size [length] */
45 /** cvec_t buffer creation function
47 This function creates a cvec_t structure holding two arrays of size
48 [length/2+1], corresponding to the norm and phase values of the
49 spectral frame. The length stored in the structure is the actual size of both
50 arrays, not the length of the complex and symetrical vector, specified as
53 \param length the length of the buffer to create
56 cvec_t * new_cvec(uint_t length);
57 /** cvec_t buffer deletion function
59 \param s buffer to delete as returned by new_cvec()
62 void del_cvec(cvec_t *s);
63 /** write norm value in a complex buffer
65 Note that this function is not used in the aubio library, since the same
66 result can be obtained by assigning vec->norm[position]. Its purpose
67 is to access these values from wrappers, as created by swig.
69 \param s vector to write to
70 \param data norm value to write in s->norm[position]
71 \param position sample position to write to
74 void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position);
75 /** write phase value in a complex buffer
77 Note that this function is not used in the aubio library, since the same
78 result can be obtained by assigning vec->phas[position]. Its purpose
79 is to access these values from wrappers, as created by swig.
81 \param s vector to write to
82 \param data phase value to write in s->phas[position]
83 \param position sample position to write to
86 void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position);
87 /** read norm value from a complex buffer
89 Note that this function is not used in the aubio library, since the same
90 result can be obtained with vec->norm[position]. Its purpose is to
91 access these values from wrappers, as created by swig.
93 \param s vector to read from
94 \param position sample position to read from
97 smpl_t cvec_read_norm(cvec_t *s, uint_t position);
98 /** read phase value from a complex buffer
100 Note that this function is not used in the aubio library, since the same
101 result can be obtained with vec->phas[position]. Its purpose is to
102 access these values from wrappers, as created by swig.
104 \param s vector to read from
105 \param position sample position to read from
108 smpl_t cvec_read_phas(cvec_t *s, uint_t position);
109 /** read norm data from a complex buffer
111 Note that this function is not used in the aubio library, since the same
112 result can be obtained with vec->norm. Its purpose is to access these values
113 from wrappers, as created by swig.
115 \param s vector to read from
118 smpl_t * cvec_get_norm(cvec_t *s);
119 /** read phase data from a complex buffer
121 Note that this function is not used in the aubio library, since the same
122 result can be obtained with vec->phas. Its purpose is to access these values
123 from wrappers, as created by swig.
125 \param s vector to read from
128 smpl_t * cvec_get_phas(cvec_t *s);
130 /** print out cvec data
132 \param s vector to print out
135 void cvec_print(cvec_t *s);
137 /** set all elements to a given value
139 \param s vector to modify
140 \param val value to set elements to
143 void cvec_set(cvec_t *s, smpl_t val);
145 /** set all elements to zero
147 \param s vector to modify
150 void cvec_zeros(cvec_t *s);
152 /** set all elements to ones
154 \param s vector to modify
157 void cvec_ones(cvec_t *s);