1 | /* |
---|
2 | Copyright (C) 2003-2007 Paul Brossier <piem@piem.org> |
---|
3 | |
---|
4 | This program is free software; you can redistribute it and/or modify |
---|
5 | it under the terms of the GNU General Public License as published by |
---|
6 | the Free Software Foundation; either version 2 of the License, or |
---|
7 | (at your option) any later version. |
---|
8 | |
---|
9 | This program is distributed in the hope that it will be useful, |
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | GNU General Public License for more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License |
---|
15 | along with this program; if not, write to the Free Software |
---|
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
17 | |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _LVEC_H |
---|
21 | #define _LVEC_H |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | /** \file |
---|
28 | |
---|
29 | Real buffers |
---|
30 | |
---|
31 | This file specifies the lvec_t buffer type, which is used in aubio to |
---|
32 | store double precision real data. |
---|
33 | |
---|
34 | */ |
---|
35 | |
---|
36 | /** Sample buffer type */ |
---|
37 | typedef struct _lvec_t lvec_t; |
---|
38 | /** Buffer for real values */ |
---|
39 | struct _lvec_t { |
---|
40 | uint_t length; /**< length of buffer */ |
---|
41 | uint_t channels; /**< number of channels */ |
---|
42 | lsmp_t **data; /**< data array of size [length] * [channels] */ |
---|
43 | }; |
---|
44 | /** lvec_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 | */ |
---|
50 | lvec_t * new_lvec(uint_t length, uint_t channels); |
---|
51 | /** lvec_t buffer deletion function |
---|
52 | |
---|
53 | \param s buffer to delete as returned by new_lvec() |
---|
54 | |
---|
55 | */ |
---|
56 | void del_lvec(lvec_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 | */ |
---|
68 | lsmp_t lvec_read_sample(lvec_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 | */ |
---|
81 | void lvec_write_sample(lvec_t *s, lsmp_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 | */ |
---|
92 | lsmp_t * lvec_get_channel(lvec_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 | */ |
---|
104 | void lvec_put_channel(lvec_t *s, lsmp_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 | */ |
---|
114 | lsmp_t ** lvec_get_data(lvec_t *s); |
---|
115 | |
---|
116 | /** print out lvec data |
---|
117 | |
---|
118 | \param s vector to print out |
---|
119 | |
---|
120 | */ |
---|
121 | void lvec_print(lvec_t *s); |
---|
122 | |
---|
123 | #ifdef __cplusplus |
---|
124 | } |
---|
125 | #endif |
---|
126 | |
---|
127 | #endif /* _LVEC_H */ |
---|