1 | #include <aubio.h> |
---|
2 | #include "utils_tests.h" |
---|
3 | |
---|
4 | void get_some_steps ( aubio_parameter_t * param ); |
---|
5 | |
---|
6 | void get_some_steps ( aubio_parameter_t * param ) |
---|
7 | { |
---|
8 | uint_t i = 0; |
---|
9 | uint_t steps = aubio_parameter_get_steps ( param ); |
---|
10 | |
---|
11 | PRINT_MSG("next steps (%d) values:", steps ); |
---|
12 | for (i = 0; i < steps; i ++ ) { |
---|
13 | PRINT_MSG(" %f", aubio_parameter_get_next_value (param) ); |
---|
14 | } |
---|
15 | PRINT_MSG("\n"); |
---|
16 | |
---|
17 | PRINT_MSG("next 3 values:"); |
---|
18 | for (i = 0; i < 3; i ++ ) { |
---|
19 | PRINT_MSG(" %f", aubio_parameter_get_next_value (param) ); |
---|
20 | } |
---|
21 | PRINT_MSG("\n"); |
---|
22 | |
---|
23 | } |
---|
24 | |
---|
25 | int main (void) |
---|
26 | { |
---|
27 | aubio_init(); |
---|
28 | |
---|
29 | smpl_t max_value = 100.; |
---|
30 | smpl_t min_value = 0.; |
---|
31 | uint_t steps = 10; |
---|
32 | |
---|
33 | aubio_parameter_t * param = new_aubio_parameter ( min_value, max_value, steps ); |
---|
34 | |
---|
35 | PRINT_MSG("initial value: %f, steps: %d\n", aubio_parameter_get_current_value |
---|
36 | (param) , aubio_parameter_get_steps (param) ); |
---|
37 | |
---|
38 | PRINT_MSG("target: max_value / 2\n"); |
---|
39 | aubio_parameter_set_target_value ( param, max_value ); |
---|
40 | get_some_steps ( param ); |
---|
41 | |
---|
42 | PRINT_MSG("target: max_value / 2\n"); |
---|
43 | aubio_parameter_set_target_value ( param, max_value / 2 ); |
---|
44 | get_some_steps ( param ); |
---|
45 | |
---|
46 | PRINT_MSG("target: max_value * 2\n"); |
---|
47 | aubio_parameter_set_target_value ( param, max_value * 2); |
---|
48 | get_some_steps ( param ); |
---|
49 | |
---|
50 | PRINT_MSG("steps: 1, target: -max\n"); |
---|
51 | aubio_parameter_set_steps ( param, 1); |
---|
52 | aubio_parameter_set_target_value ( param, - max_value); |
---|
53 | get_some_steps ( param ); |
---|
54 | |
---|
55 | PRINT_MSG("steps: 30, current value: max, target: min\n"); |
---|
56 | aubio_parameter_set_current_value ( param, max_value ); |
---|
57 | aubio_parameter_set_target_value ( param, min_value ); |
---|
58 | aubio_parameter_set_steps ( param, 7 ); |
---|
59 | get_some_steps ( param ); |
---|
60 | |
---|
61 | PRINT_MSG("steps: 30, max value: max * 2, min value: -max, current value: -max, target: max\n"); |
---|
62 | aubio_parameter_set_min_value ( param, - max_value ); |
---|
63 | aubio_parameter_set_max_value ( param, 2. * max_value ); |
---|
64 | aubio_parameter_set_current_value ( param, - max_value ); |
---|
65 | aubio_parameter_set_target_value ( param, max_value ); |
---|
66 | aubio_parameter_set_steps ( param, 10 ); |
---|
67 | get_some_steps ( param ); |
---|
68 | |
---|
69 | del_aubio_parameter (param); |
---|
70 | |
---|
71 | aubio_cleanup(); |
---|
72 | |
---|
73 | return 0; |
---|
74 | } |
---|