source: src/fvec.h @ 18c6b20

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

modified fvec and lvec to be mono, added fmat

  • Property mode set to 100644
File size: 3.3 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  smpl_t *data;   /**< data array of size [length] */
41} fvec_t;
42
43/** fvec_t buffer creation function
44
45  \param length the length of the buffer to create
46
47*/
48fvec_t * new_fvec(uint_t length);
49/** fvec_t buffer deletion function
50
51  \param s buffer to delete as returned by new_fvec()
52
53*/
54void del_fvec(fvec_t *s);
55/** read sample value in a buffer
56
57  Note that this function is not used in the aubio library, since the same
58  result can be obtained using vec->data[position]. Its purpose is to
59  access these values from wrappers, as created by swig.
60
61  \param s vector to read from
62  \param position sample position to read from
63
64*/
65smpl_t fvec_read_sample(fvec_t *s, uint_t position);
66/** write sample value in a buffer
67
68  Note that this function is not used in the aubio library, since the same
69  result can be obtained by assigning vec->data[position]. Its purpose
70  is to access these values from wrappers, as created by swig.
71
72  \param s vector to write to
73  \param data value to write in s->data[position]
74  \param position sample position to write to
75
76*/
77void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t position);
78
79/** read data from a buffer
80
81  Note that this function is not used in the aubio library, since the same
82  result can be obtained with vec->data. Its purpose is to access these values
83  from wrappers, as created by swig.
84
85  \param s vector to read from
86
87*/
88smpl_t * fvec_get_data(fvec_t *s);
89
90/** print out fvec data
91
92  \param s vector to print out
93
94*/
95void fvec_print(fvec_t *s);
96
97/** set all elements to a given value
98
99  \param s vector to modify
100  \param val value to set elements to
101
102*/
103void fvec_set(fvec_t *s, smpl_t val);
104
105/** set all elements to zero
106
107  \param s vector to modify
108
109*/
110void fvec_zeros(fvec_t *s);
111
112/** set all elements to ones
113
114  \param s vector to modify
115
116*/
117void fvec_ones(fvec_t *s);
118
119/** revert order of vector elements
120
121  \param s vector to revert
122
123*/
124void fvec_rev(fvec_t *s);
125
126/** apply weight to vector
127
128  If the weight vector is longer than s, only the first elements are used. If
129  the weight vector is shorter than s, the last elements of s are not weighted.
130
131  \param s vector to weight
132  \param weight weighting coefficients
133
134*/
135void fvec_weight(fvec_t *s, fvec_t *weight);
136
137/** make a copy of a vector
138
139  \param s source vector
140  \param t vector to copy to
141
142*/
143void fvec_copy(fvec_t *s, fvec_t *t);
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* _FVEC_H */
Note: See TracBrowser for help on using the repository browser.