source: src/lvec.h @ e406835

feature/autosinkfeature/constantqfeature/pitchshiftfeature/timestretch
Last change on this file since e406835 was 6f42c16, checked in by Paul Brossier <piem@piem.org>, 4 years ago

src/: change c header identifiers (see #35)

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2  Copyright (C) 2003-2015 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 AUBIO_LVEC_H
22#define AUBIO_LVEC_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/** \file
29
30  Vector of real-valued data in double precision
31
32  This file specifies the ::lvec_t buffer type, which is used in some places in
33  aubio to store a vector of ::lsmp_t.
34
35  Note: the lvec_t data type is required in some algorithms such as IIR filters
36  (see temporal/filter.h).
37
38  \example test-lvec.c
39
40*/
41
42/** Buffer for real data in double precision */
43typedef struct {
44  uint_t length; /**< length of buffer */
45  lsmp_t *data;  /**< data array of size [length] */
46} lvec_t;
47
48/** lvec_t buffer creation function
49
50  \param length the length of the buffer to create
51
52*/
53lvec_t * new_lvec(uint_t length);
54/** lvec_t buffer deletion function
55
56  \param s buffer to delete as returned by new_lvec()
57
58*/
59void del_lvec(lvec_t *s);
60
61/** read sample value in a buffer
62
63  \param s vector to read from
64  \param position sample position to read from
65
66*/
67lsmp_t lvec_get_sample(lvec_t *s, uint_t position);
68
69/** write sample value in a buffer
70
71  \param s vector to write to
72  \param data value to write in s->data[position]
73  \param position sample position to write to
74
75*/
76void  lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position);
77
78/** read data from a buffer
79
80  \param s vector to read from
81
82*/
83lsmp_t * lvec_get_data(const lvec_t *s);
84
85/** print out lvec data
86
87  \param s vector to print out
88
89*/
90void lvec_print(const lvec_t *s);
91
92/** set all elements to a given value
93
94  \param s vector to modify
95  \param val value to set elements to
96
97*/
98void lvec_set_all(lvec_t *s, smpl_t val);
99
100/** set all elements to zero
101
102  \param s vector to modify
103
104*/
105void lvec_zeros(lvec_t *s);
106
107/** set all elements to ones
108
109  \param s vector to modify
110
111*/
112void lvec_ones(lvec_t *s);
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* AUBIO_LVEC_H */
Note: See TracBrowser for help on using the repository browser.