1 | /* |
---|
2 | Copyright (C) 2003-2013 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_PARAMETER_H |
---|
22 | #define AUBIO_PARAMETER_H |
---|
23 | |
---|
24 | /** \file |
---|
25 | |
---|
26 | Parameter with linear interpolation |
---|
27 | |
---|
28 | This object manages a parameter, with minimum and maximum values, and a |
---|
29 | number of steps to compute linear interpolation between two values. |
---|
30 | |
---|
31 | \example utils/test-parameter.c |
---|
32 | |
---|
33 | */ |
---|
34 | |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | /** parameter object */ |
---|
40 | typedef struct _aubio_parameter_t aubio_parameter_t; |
---|
41 | |
---|
42 | /** create new parameter object |
---|
43 | |
---|
44 | \param min_value the minimum value of the new parameter |
---|
45 | \param max_value the maximum value of the new parameter |
---|
46 | \param steps the number of steps to interpolate from the old value to the target value |
---|
47 | |
---|
48 | \return the newly created ::aubio_parameter_t |
---|
49 | |
---|
50 | */ |
---|
51 | aubio_parameter_t * new_aubio_parameter(smpl_t min_value, smpl_t max_value, uint_t steps); |
---|
52 | |
---|
53 | /** set target value of the parameter |
---|
54 | |
---|
55 | \param param parameter, created by ::new_aubio_parameter |
---|
56 | \param value new target value |
---|
57 | |
---|
58 | \return 0 if successful, 1 otherwise |
---|
59 | |
---|
60 | */ |
---|
61 | uint_t aubio_parameter_set_target_value ( aubio_parameter_t * param, smpl_t value ); |
---|
62 | |
---|
63 | /** get next parameter |
---|
64 | |
---|
65 | \param param parameter, created by ::new_aubio_parameter |
---|
66 | |
---|
67 | \return new interpolated parameter value |
---|
68 | |
---|
69 | */ |
---|
70 | smpl_t aubio_parameter_get_next_value ( aubio_parameter_t * param ); |
---|
71 | |
---|
72 | /** get current parameter value, without interpolation |
---|
73 | |
---|
74 | \param param parameter, created by ::new_aubio_parameter |
---|
75 | |
---|
76 | \return current value |
---|
77 | |
---|
78 | */ |
---|
79 | smpl_t aubio_parameter_get_current_value ( const aubio_parameter_t * param ); |
---|
80 | |
---|
81 | /** set current parameter value, skipping interpolation |
---|
82 | |
---|
83 | \param param parameter, created by ::new_aubio_parameter |
---|
84 | \param value new parameter value |
---|
85 | |
---|
86 | \return 0 if successful, 1 otherwise |
---|
87 | |
---|
88 | */ |
---|
89 | uint_t aubio_parameter_set_current_value ( aubio_parameter_t * param, smpl_t value ); |
---|
90 | |
---|
91 | /** set number of steps used for interpolation |
---|
92 | |
---|
93 | \param param parameter, created by ::new_aubio_parameter |
---|
94 | \param steps new number of steps |
---|
95 | |
---|
96 | \return 0 if successful, 1 otherwise |
---|
97 | |
---|
98 | */ |
---|
99 | uint_t aubio_parameter_set_steps ( aubio_parameter_t * param, uint_t steps ); |
---|
100 | |
---|
101 | /** get number of steps of this parameter |
---|
102 | |
---|
103 | \param param parameter, created by ::new_aubio_parameter |
---|
104 | |
---|
105 | \return number of steps |
---|
106 | |
---|
107 | */ |
---|
108 | uint_t aubio_parameter_get_steps ( const aubio_parameter_t * param); |
---|
109 | |
---|
110 | /** set minimum value of this parameter |
---|
111 | |
---|
112 | \param param parameter, created by ::new_aubio_parameter |
---|
113 | \param min_value new minimum value |
---|
114 | |
---|
115 | \return 0 if successful, 1 otherwise |
---|
116 | |
---|
117 | */ |
---|
118 | uint_t aubio_parameter_set_min_value ( aubio_parameter_t * param, smpl_t min_value ); |
---|
119 | |
---|
120 | /** get minimum value of this parameter |
---|
121 | |
---|
122 | \param param parameter, created by ::new_aubio_parameter |
---|
123 | |
---|
124 | \return minimum value |
---|
125 | |
---|
126 | */ |
---|
127 | smpl_t aubio_parameter_get_min_value ( const aubio_parameter_t * param ); |
---|
128 | |
---|
129 | /** set maximum value of this parameter |
---|
130 | |
---|
131 | \param param parameter, created by ::new_aubio_parameter |
---|
132 | \param max_value new maximum value |
---|
133 | |
---|
134 | \return 0 if successful, 1 otherwise |
---|
135 | |
---|
136 | */ |
---|
137 | uint_t aubio_parameter_set_max_value ( aubio_parameter_t * param, smpl_t max_value ); |
---|
138 | |
---|
139 | /** get maximum value of this parameter |
---|
140 | |
---|
141 | \param param parameter, created by ::new_aubio_parameter |
---|
142 | |
---|
143 | \return maximum value |
---|
144 | |
---|
145 | */ |
---|
146 | smpl_t aubio_parameter_get_max_value ( const aubio_parameter_t * param ); |
---|
147 | |
---|
148 | /** destroy ::aubio_parameter_t object |
---|
149 | |
---|
150 | \param param parameter, created by ::new_aubio_parameter |
---|
151 | |
---|
152 | */ |
---|
153 | void del_aubio_parameter( aubio_parameter_t * param ); |
---|
154 | |
---|
155 | #ifdef __cplusplus |
---|
156 | } |
---|
157 | #endif |
---|
158 | |
---|
159 | #endif /* AUBIO_PARAMETER_H */ |
---|