source: src/cvec.h @ f9d5346

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since f9d5346 was 621f1ff, checked in by Paul Brossier <piem@piem.org>, 11 years ago

src/: improve documentation

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
3
4  This file is part of aubio.
5
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.
10
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.
15
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/>.
18
19*/
20
21#ifndef _CVEC_H
22#define _CVEC_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/** \file
29
30  Vector of complex-valued data
31
32  This file specifies the ::cvec_t buffer type, which is used throughout aubio
33  to store complex data. Complex values are stored in terms of ::cvec_t.phas
34  and norm, within size/2+1 long vectors of ::smpl_t.
35
36  \example test-cvec.c
37
38*/
39
40/** Buffer for complex data */
41typedef struct {
42  uint_t length;  /**< length of buffer = (requested length)/2 + 1 */
43  smpl_t *norm;   /**< norm array of size ::cvec_t.length */
44  smpl_t *phas;   /**< phase array of size ::cvec_t.length */
45} cvec_t;
46
47/** cvec_t buffer creation function
48
49  This function creates a cvec_t structure holding two arrays of size
50  [length/2+1], corresponding to the norm and phase values of the
51  spectral frame. The length stored in the structure is the actual size of both
52  arrays, not the length of the complex and symmetrical vector, specified as
53  creation argument.
54
55  \param length the length of the buffer to create
56
57*/
58cvec_t * new_cvec(uint_t length);
59/** cvec_t buffer deletion function
60
61  \param s buffer to delete as returned by new_cvec()
62
63*/
64void del_cvec(cvec_t *s);
65/** write norm value in a complex buffer
66
67  Note that this function is not used in the aubio library, since the same
68  result can be obtained by assigning vec->norm[position]. Its purpose
69  is to access these values from wrappers, as created by swig.
70
71  \param s vector to write to
72  \param data norm value to write in s->norm[position]
73  \param position sample position to write to
74
75*/
76void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position);
77/** write phase value in a complex buffer
78
79  Note that this function is not used in the aubio library, since the same
80  result can be obtained by assigning vec->phas[position]. Its purpose
81  is to access these values from wrappers, as created by swig.
82
83  \param s vector to write to
84  \param data phase value to write in s->phas[position]
85  \param position sample position to write to
86
87*/
88void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position);
89/** read norm value from a complex buffer
90
91  Note that this function is not used in the aubio library, since the same
92  result can be obtained with vec->norm[position]. Its purpose is to
93  access these values from wrappers, as created by swig.
94
95  \param s vector to read from
96  \param position sample position to read from
97
98*/
99smpl_t cvec_read_norm(cvec_t *s, uint_t position);
100/** read phase value from a complex buffer
101
102  Note that this function is not used in the aubio library, since the same
103  result can be obtained with vec->phas[position]. Its purpose is to
104  access these values from wrappers, as created by swig.
105
106  \param s vector to read from
107  \param position sample position to read from
108
109*/
110smpl_t cvec_read_phas(cvec_t *s, uint_t position);
111/** read norm data from a complex buffer
112
113  Note that this function is not used in the aubio library, since the same
114  result can be obtained with vec->norm. Its purpose is to access these values
115  from wrappers, as created by swig.
116
117  \param s vector to read from
118
119*/
120smpl_t * cvec_get_norm(cvec_t *s);
121/** read phase data from a complex buffer
122
123  Note that this function is not used in the aubio library, since the same
124  result can be obtained with vec->phas. Its purpose is to access these values
125  from wrappers, as created by swig.
126
127  \param s vector to read from
128
129*/
130smpl_t * cvec_get_phas(cvec_t *s);
131
132/** print out cvec data
133
134  \param s vector to print out
135
136*/
137void cvec_print(cvec_t *s);
138
139/** set all elements to a given value
140
141  \param s vector to modify
142  \param val value to set elements to
143
144*/
145void cvec_set(cvec_t *s, smpl_t val);
146
147/** set all elements to zero
148
149  \param s vector to modify
150
151*/
152void cvec_zeros(cvec_t *s);
153
154/** set all elements to ones
155
156  \param s vector to modify
157
158*/
159void cvec_ones(cvec_t *s);
160
161#ifdef __cplusplus
162}
163#endif
164
165#endif /* _CVEC_H */
166
Note: See TracBrowser for help on using the repository browser.