source: src/fvec.h @ 75be651

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 75be651 was 78429de, checked in by Paul Brossier <piem@piem.org>, 15 years ago

src/*vec.h: strip down _*vec_t

  • Property mode set to 100644
File size: 4.4 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 _FVEC_H
22#define _FVEC_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/** \file
29
30  Real buffers
31
32  This file specifies the fvec_t buffer type, which is used throughout aubio to
33  store real data.
34
35*/
36
37/** Buffer for real data */
38typedef struct {
39  uint_t length;   /**< length of buffer */
40  uint_t channels; /**< number of channels */
41  smpl_t **data;   /**< data array of size [length] * [channels] */
42} fvec_t;
43
44/** fvec_t buffer creation function
45
46  \param length the length of the buffer to create
47  \param channels the number of channels in the buffer
48
49*/
50fvec_t * new_fvec(uint_t length, uint_t channels);
51/** fvec_t buffer deletion function
52
53  \param s buffer to delete as returned by new_fvec()
54
55*/
56void del_fvec(fvec_t *s);
57/** read sample value in a buffer
58
59  Note that this function is not used in the aubio library, since the same
60  result can be obtained using vec->data[channel][position]. Its purpose is to
61  access these values from wrappers, as created by swig.
62
63  \param s vector to read from
64  \param channel channel to read from
65  \param position sample position to read from
66
67*/
68smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position);
69/** write sample value in a buffer
70
71  Note that this function is not used in the aubio library, since the same
72  result can be obtained by assigning vec->data[channel][position]. Its purpose
73  is to access these values from wrappers, as created by swig.
74
75  \param s vector to write to
76  \param data value to write in s->data[channel][position]
77  \param channel channel to write to
78  \param position sample position to write to
79
80*/
81void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position);
82/** read channel vector from a buffer
83
84  Note that this function is not used in the aubio library, since the same
85  result can be obtained with vec->data[channel]. Its purpose is to access
86  these values from wrappers, as created by swig.
87
88  \param s vector to read from
89  \param channel channel to read from
90
91*/
92smpl_t * fvec_get_channel(fvec_t *s, uint_t channel);
93/** write channel vector into a buffer
94
95  Note that this function is not used in the aubio library, since the same
96  result can be obtained by assigning vec->data[channel]. Its purpose is to
97  access these values from wrappers, as created by swig.
98
99  \param s vector to write to
100  \param data vector of [length] values to write
101  \param channel channel to write to
102
103*/
104void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel);
105/** read data from a buffer
106
107  Note that this function is not used in the aubio library, since the same
108  result can be obtained with vec->data. Its purpose is to access these values
109  from wrappers, as created by swig.
110
111  \param s vector to read from
112
113*/
114smpl_t ** fvec_get_data(fvec_t *s);
115
116/** print out fvec data
117
118  \param s vector to print out
119
120*/
121void fvec_print(fvec_t *s);
122
123/** set all elements to a given value
124
125  \param s vector to modify
126  \param val value to set elements to
127
128*/
129void fvec_set(fvec_t *s, smpl_t val);
130
131/** set all elements to zero
132
133  \param s vector to modify
134
135*/
136void fvec_zeros(fvec_t *s);
137
138/** set all elements to ones
139
140  \param s vector to modify
141
142*/
143void fvec_ones(fvec_t *s);
144
145/** revert order of vector elements
146
147  \param s vector to revert
148
149*/
150void fvec_rev(fvec_t *s);
151
152/** apply weight to vector
153
154  If the weight vector is longer than s, only the first elements are used. If
155  the weight vector is shorter than s, the last elements of s are not weighted.
156
157  \param s vector to weight
158  \param weight weighting coefficients
159
160*/
161void fvec_weight(fvec_t *s, fvec_t *weight);
162
163/** make a copy of a vector
164
165  \param s source vector
166  \param t vector to copy to
167
168*/
169void fvec_copy(fvec_t *s, fvec_t *t);
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* _FVEC_H */
Note: See TracBrowser for help on using the repository browser.