[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 | |
---|
[78429de] | 38 | /** Buffer for real data in double precision */ |
---|
| 39 | typedef struct { |
---|
[a3a01e1] | 40 | uint_t length; /**< length of buffer */ |
---|
[c7860af] | 41 | lsmp_t *data; /**< data array of size [length] */ |
---|
[78429de] | 42 | } lvec_t; |
---|
| 43 | |
---|
[a3a01e1] | 44 | /** lvec_t buffer creation function |
---|
| 45 | |
---|
| 46 | \param length the length of the buffer to create |
---|
| 47 | |
---|
| 48 | */ |
---|
[c7860af] | 49 | lvec_t * new_lvec(uint_t length); |
---|
[a3a01e1] | 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 |
---|
[c7860af] | 59 | result can be obtained using vec->data[position]. Its purpose is to |
---|
[a3a01e1] | 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 | */ |
---|
[c7860af] | 66 | lsmp_t lvec_read_sample(lvec_t *s, uint_t position); |
---|
[a3a01e1] | 67 | /** write sample value in a buffer |
---|
| 68 | |
---|
| 69 | Note that this function is not used in the aubio library, since the same |
---|
[c7860af] | 70 | result can be obtained by assigning vec->data[position]. Its purpose |
---|
[a3a01e1] | 71 | is to access these values from wrappers, as created by swig. |
---|
| 72 | |
---|
| 73 | \param s vector to write to |
---|
[c7860af] | 74 | \param data value to write in s->data[position] |
---|
[a3a01e1] | 75 | \param position sample position to write to |
---|
| 76 | |
---|
| 77 | */ |
---|
[c7860af] | 78 | void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position); |
---|
[a3a01e1] | 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 | */ |
---|
[c7860af] | 89 | lsmp_t * lvec_get_data(lvec_t *s); |
---|
[a3a01e1] | 90 | |
---|
[79a01c5] | 91 | /** print out lvec data |
---|
| 92 | |
---|
| 93 | \param s vector to print out |
---|
| 94 | |
---|
| 95 | */ |
---|
| 96 | void lvec_print(lvec_t *s); |
---|
| 97 | |
---|
[b849106] | 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 | |
---|
[a3a01e1] | 120 | #ifdef __cplusplus |
---|
| 121 | } |
---|
| 122 | #endif |
---|
| 123 | |
---|
| 124 | #endif /* _LVEC_H */ |
---|