[650cae3] | 1 | #include <aubio.h> |
---|
| 2 | #include "utils_tests.h" |
---|
| 3 | |
---|
[0546c1f3] | 4 | void get_some_steps ( aubio_parameter_t * param ); |
---|
| 5 | |
---|
[650cae3] | 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 | |
---|
[158e031] | 25 | int main (void) |
---|
[650cae3] | 26 | { |
---|
| 27 | smpl_t max_value = 100.; |
---|
| 28 | smpl_t min_value = 0.; |
---|
| 29 | uint_t steps = 10; |
---|
| 30 | |
---|
| 31 | aubio_parameter_t * param = new_aubio_parameter ( min_value, max_value, steps ); |
---|
| 32 | |
---|
| 33 | PRINT_MSG("initial value: %f, steps: %d\n", aubio_parameter_get_current_value |
---|
| 34 | (param) , aubio_parameter_get_steps (param) ); |
---|
| 35 | |
---|
| 36 | PRINT_MSG("target: max_value / 2\n"); |
---|
| 37 | aubio_parameter_set_target_value ( param, max_value ); |
---|
| 38 | get_some_steps ( param ); |
---|
| 39 | |
---|
| 40 | PRINT_MSG("target: max_value / 2\n"); |
---|
| 41 | aubio_parameter_set_target_value ( param, max_value / 2 ); |
---|
| 42 | get_some_steps ( param ); |
---|
| 43 | |
---|
| 44 | PRINT_MSG("target: max_value * 2\n"); |
---|
| 45 | aubio_parameter_set_target_value ( param, max_value * 2); |
---|
| 46 | get_some_steps ( param ); |
---|
| 47 | |
---|
| 48 | PRINT_MSG("steps: 1, target: -max\n"); |
---|
| 49 | aubio_parameter_set_steps ( param, 1); |
---|
| 50 | aubio_parameter_set_target_value ( param, - max_value); |
---|
| 51 | get_some_steps ( param ); |
---|
| 52 | |
---|
| 53 | PRINT_MSG("steps: 30, current value: max, target: min\n"); |
---|
| 54 | aubio_parameter_set_current_value ( param, max_value ); |
---|
| 55 | aubio_parameter_set_target_value ( param, min_value ); |
---|
| 56 | aubio_parameter_set_steps ( param, 7 ); |
---|
| 57 | get_some_steps ( param ); |
---|
| 58 | |
---|
| 59 | PRINT_MSG("steps: 30, max value: max * 2, min value: -max, current value: -max, target: max\n"); |
---|
| 60 | aubio_parameter_set_min_value ( param, - max_value ); |
---|
| 61 | aubio_parameter_set_max_value ( param, 2. * max_value ); |
---|
| 62 | aubio_parameter_set_current_value ( param, - max_value ); |
---|
| 63 | aubio_parameter_set_target_value ( param, max_value ); |
---|
| 64 | aubio_parameter_set_steps ( param, 10 ); |
---|
| 65 | get_some_steps ( param ); |
---|
| 66 | |
---|
| 67 | del_aubio_parameter (param); |
---|
| 68 | |
---|
| 69 | return 0; |
---|
| 70 | } |
---|