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