source: src/utils/parameter.h @ 912f343

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 912f343 was 650cae3, checked in by Paul Brossier <piem@piem.org>, 11 years ago

src/utils/parameter.{c,h}: added simple parameter with linear interpolation

  • Property mode set to 100644
File size: 4.0 KB
Line 
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
36extern "C" {
37#endif
38
39/** parameter object */
40typedef 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*/
51aubio_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*/
61uint_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*/
70smpl_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*/
79smpl_t aubio_parameter_get_current_value ( 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*/
89uint_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*/
99uint_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*/
108uint_t aubio_parameter_get_steps ( 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*/
118uint_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*/
127smpl_t aubio_parameter_get_min_value ( 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*/
137uint_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*/
146smpl_t aubio_parameter_get_max_value ( aubio_parameter_t * param );
147
148/** destroy ::aubio_parameter_t object
149
150  \param param parameter, created by ::new_aubio_parameter
151
152*/
153void del_aubio_parameter( aubio_parameter_t * param );
154
155#ifdef __cplusplus
156}
157#endif
158
159#endif /* _AUBIO_PARAMETER_H */
160
Note: See TracBrowser for help on using the repository browser.