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 _LVEC_H |
---|
22 | #define _LVEC_H |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | /** \file |
---|
29 | |
---|
30 | Real buffers |
---|
31 | |
---|
32 | This file specifies the lvec_t buffer type, which is used in aubio to store |
---|
33 | double precision real data. Note that the lvec_t data type is mostly used for |
---|
34 | IIR filters (see temporal/filter.h). |
---|
35 | |
---|
36 | */ |
---|
37 | |
---|
38 | /** Buffer for real data in double precision */ |
---|
39 | typedef struct { |
---|
40 | uint_t length; /**< length of buffer */ |
---|
41 | lsmp_t *data; /**< data array of size [length] */ |
---|
42 | } lvec_t; |
---|
43 | |
---|
44 | /** lvec_t buffer creation function |
---|
45 | |
---|
46 | \param length the length of the buffer to create |
---|
47 | |
---|
48 | */ |
---|
49 | lvec_t * new_lvec(uint_t length); |
---|
50 | /** lvec_t buffer deletion function |
---|
51 | |
---|
52 | \param s buffer to delete as returned by new_lvec() |
---|
53 | |
---|
54 | */ |
---|
55 | void del_lvec(lvec_t *s); |
---|
56 | /** read sample value in a buffer |
---|
57 | |
---|
58 | Note that this function is not used in the aubio library, since the same |
---|
59 | result can be obtained using vec->data[position]. Its purpose is to |
---|
60 | access these values from wrappers, as created by swig. |
---|
61 | |
---|
62 | \param s vector to read from |
---|
63 | \param position sample position to read from |
---|
64 | |
---|
65 | */ |
---|
66 | lsmp_t lvec_read_sample(lvec_t *s, uint_t position); |
---|
67 | /** write sample value in a buffer |
---|
68 | |
---|
69 | Note that this function is not used in the aubio library, since the same |
---|
70 | result can be obtained by assigning vec->data[position]. Its purpose |
---|
71 | is to access these values from wrappers, as created by swig. |
---|
72 | |
---|
73 | \param s vector to write to |
---|
74 | \param data value to write in s->data[position] |
---|
75 | \param position sample position to write to |
---|
76 | |
---|
77 | */ |
---|
78 | void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position); |
---|
79 | |
---|
80 | /** read data from a buffer |
---|
81 | |
---|
82 | Note that this function is not used in the aubio library, since the same |
---|
83 | result can be obtained with vec->data. Its purpose is to access these values |
---|
84 | from wrappers, as created by swig. |
---|
85 | |
---|
86 | \param s vector to read from |
---|
87 | |
---|
88 | */ |
---|
89 | lsmp_t * lvec_get_data(lvec_t *s); |
---|
90 | |
---|
91 | /** print out lvec data |
---|
92 | |
---|
93 | \param s vector to print out |
---|
94 | |
---|
95 | */ |
---|
96 | void lvec_print(lvec_t *s); |
---|
97 | |
---|
98 | /** set all elements to a given value |
---|
99 | |
---|
100 | \param s vector to modify |
---|
101 | \param val value to set elements to |
---|
102 | |
---|
103 | */ |
---|
104 | void lvec_set(lvec_t *s, smpl_t val); |
---|
105 | |
---|
106 | /** set all elements to zero |
---|
107 | |
---|
108 | \param s vector to modify |
---|
109 | |
---|
110 | */ |
---|
111 | void lvec_zeros(lvec_t *s); |
---|
112 | |
---|
113 | /** set all elements to ones |
---|
114 | |
---|
115 | \param s vector to modify |
---|
116 | |
---|
117 | */ |
---|
118 | void lvec_ones(lvec_t *s); |
---|
119 | |
---|
120 | #ifdef __cplusplus |
---|
121 | } |
---|
122 | #endif |
---|
123 | |
---|
124 | #endif /* _LVEC_H */ |
---|