[a3a01e1] | 1 | /* |
---|
[a6db140] | 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> |
---|
[a3a01e1] | 3 | |
---|
[a6db140] | 4 | This file is part of aubio. |
---|
[a3a01e1] | 5 | |
---|
[a6db140] | 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. |
---|
[a3a01e1] | 10 | |
---|
[a6db140] | 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/>. |
---|
[a3a01e1] | 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 | |
---|
[c698d1b] | 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). |
---|
[a3a01e1] | 35 | |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | /** Sample buffer type */ |
---|
| 39 | typedef struct _lvec_t lvec_t; |
---|
| 40 | /** Buffer for real values */ |
---|
| 41 | struct _lvec_t { |
---|
| 42 | uint_t length; /**< length of buffer */ |
---|
| 43 | uint_t channels; /**< number of channels */ |
---|
| 44 | lsmp_t **data; /**< data array of size [length] * [channels] */ |
---|
| 45 | }; |
---|
| 46 | /** lvec_t buffer creation function |
---|
| 47 | |
---|
| 48 | \param length the length of the buffer to create |
---|
| 49 | \param channels the number of channels in the buffer |
---|
| 50 | |
---|
| 51 | */ |
---|
| 52 | lvec_t * new_lvec(uint_t length, uint_t channels); |
---|
| 53 | /** lvec_t buffer deletion function |
---|
| 54 | |
---|
| 55 | \param s buffer to delete as returned by new_lvec() |
---|
| 56 | |
---|
| 57 | */ |
---|
| 58 | void del_lvec(lvec_t *s); |
---|
| 59 | /** read sample value in a buffer |
---|
| 60 | |
---|
| 61 | Note that this function is not used in the aubio library, since the same |
---|
| 62 | result can be obtained using vec->data[channel][position]. Its purpose is to |
---|
| 63 | access these values from wrappers, as created by swig. |
---|
| 64 | |
---|
| 65 | \param s vector to read from |
---|
| 66 | \param channel channel to read from |
---|
| 67 | \param position sample position to read from |
---|
| 68 | |
---|
| 69 | */ |
---|
| 70 | lsmp_t lvec_read_sample(lvec_t *s, uint_t channel, uint_t position); |
---|
| 71 | /** write sample value in a buffer |
---|
| 72 | |
---|
| 73 | Note that this function is not used in the aubio library, since the same |
---|
| 74 | result can be obtained by assigning vec->data[channel][position]. Its purpose |
---|
| 75 | is to access these values from wrappers, as created by swig. |
---|
| 76 | |
---|
| 77 | \param s vector to write to |
---|
| 78 | \param data value to write in s->data[channel][position] |
---|
| 79 | \param channel channel to write to |
---|
| 80 | \param position sample position to write to |
---|
| 81 | |
---|
| 82 | */ |
---|
| 83 | void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t channel, uint_t position); |
---|
| 84 | /** read channel vector from a buffer |
---|
| 85 | |
---|
| 86 | Note that this function is not used in the aubio library, since the same |
---|
| 87 | result can be obtained with vec->data[channel]. Its purpose is to access |
---|
| 88 | these values from wrappers, as created by swig. |
---|
| 89 | |
---|
| 90 | \param s vector to read from |
---|
| 91 | \param channel channel to read from |
---|
| 92 | |
---|
| 93 | */ |
---|
| 94 | lsmp_t * lvec_get_channel(lvec_t *s, uint_t channel); |
---|
| 95 | /** write channel vector into a buffer |
---|
| 96 | |
---|
| 97 | Note that this function is not used in the aubio library, since the same |
---|
| 98 | result can be obtained by assigning vec->data[channel]. Its purpose is to |
---|
| 99 | access these values from wrappers, as created by swig. |
---|
| 100 | |
---|
| 101 | \param s vector to write to |
---|
| 102 | \param data vector of [length] values to write |
---|
| 103 | \param channel channel to write to |
---|
| 104 | |
---|
| 105 | */ |
---|
| 106 | void lvec_put_channel(lvec_t *s, lsmp_t * data, uint_t channel); |
---|
| 107 | /** read data from a buffer |
---|
| 108 | |
---|
| 109 | Note that this function is not used in the aubio library, since the same |
---|
| 110 | result can be obtained with vec->data. Its purpose is to access these values |
---|
| 111 | from wrappers, as created by swig. |
---|
| 112 | |
---|
| 113 | \param s vector to read from |
---|
| 114 | |
---|
| 115 | */ |
---|
| 116 | lsmp_t ** lvec_get_data(lvec_t *s); |
---|
| 117 | |
---|
[79a01c5] | 118 | /** print out lvec data |
---|
| 119 | |
---|
| 120 | \param s vector to print out |
---|
| 121 | |
---|
| 122 | */ |
---|
| 123 | void lvec_print(lvec_t *s); |
---|
| 124 | |
---|
[b849106] | 125 | /** set all elements to a given value |
---|
| 126 | |
---|
| 127 | \param s vector to modify |
---|
| 128 | \param val value to set elements to |
---|
| 129 | |
---|
| 130 | */ |
---|
| 131 | void lvec_set(lvec_t *s, smpl_t val); |
---|
| 132 | |
---|
| 133 | /** set all elements to zero |
---|
| 134 | |
---|
| 135 | \param s vector to modify |
---|
| 136 | |
---|
| 137 | */ |
---|
| 138 | void lvec_zeros(lvec_t *s); |
---|
| 139 | |
---|
| 140 | /** set all elements to ones |
---|
| 141 | |
---|
| 142 | \param s vector to modify |
---|
| 143 | |
---|
| 144 | */ |
---|
| 145 | void lvec_ones(lvec_t *s); |
---|
| 146 | |
---|
[a3a01e1] | 147 | #ifdef __cplusplus |
---|
| 148 | } |
---|
| 149 | #endif |
---|
| 150 | |
---|
| 151 | #endif /* _LVEC_H */ |
---|