aubio: utils/test-parameter.c

aubio 0.4.9

Loading...
Searching...
No Matches
utils/test-parameter.c
#include <aubio.h>
#include "utils_tests.h"
void get_some_steps ( aubio_parameter_t * param );
void get_some_steps ( aubio_parameter_t * param )
{
uint_t i = 0;
uint_t steps = aubio_parameter_get_steps ( param );
PRINT_MSG("next steps (%d) values:", steps );
for (i = 0; i < steps; i ++ ) {
PRINT_MSG(" %f", aubio_parameter_get_next_value (param) );
}
PRINT_MSG("\n");
PRINT_MSG("next 3 values:");
for (i = 0; i < 3; i ++ ) {
PRINT_MSG(" %f", aubio_parameter_get_next_value (param) );
}
PRINT_MSG("\n");
}
int main (void)
{
smpl_t max_value = 100.;
smpl_t min_value = 0.;
uint_t steps = 10;
aubio_parameter_t * param = new_aubio_parameter ( min_value, max_value, steps );
PRINT_MSG("initial value: %f, steps: %d\n", aubio_parameter_get_current_value
(param) , aubio_parameter_get_steps (param) );
PRINT_MSG("target: max_value / 2\n");
aubio_parameter_set_target_value ( param, max_value );
get_some_steps ( param );
PRINT_MSG("target: max_value / 2\n");
aubio_parameter_set_target_value ( param, max_value / 2 );
get_some_steps ( param );
PRINT_MSG("target: max_value * 2\n");
aubio_parameter_set_target_value ( param, max_value * 2);
get_some_steps ( param );
PRINT_MSG("steps: 1, target: -max\n");
aubio_parameter_set_steps ( param, 1);
aubio_parameter_set_target_value ( param, - max_value);
get_some_steps ( param );
PRINT_MSG("steps: 30, current value: max, target: min\n");
aubio_parameter_set_current_value ( param, max_value );
aubio_parameter_set_target_value ( param, min_value );
aubio_parameter_set_steps ( param, 7 );
get_some_steps ( param );
PRINT_MSG("steps: 30, max value: max * 2, min value: -max, current value: -max, target: max\n");
aubio_parameter_set_min_value ( param, - max_value );
aubio_parameter_set_max_value ( param, 2. * max_value );
aubio_parameter_set_current_value ( param, - max_value );
aubio_parameter_set_target_value ( param, max_value );
aubio_parameter_set_steps ( param, 10 );
get_some_steps ( param );
del_aubio_parameter (param);
return 0;
}
aubio.h
Global aubio include file.
aubio_parameter_set_steps
uint_t aubio_parameter_set_steps(aubio_parameter_t *param, uint_t steps)
set number of steps used for interpolation
aubio_parameter_get_steps
uint_t aubio_parameter_get_steps(const aubio_parameter_t *param)
get number of steps of this parameter
aubio_parameter_set_target_value
uint_t aubio_parameter_set_target_value(aubio_parameter_t *param, smpl_t value)
set target value of the parameter
aubio_parameter_get_current_value
smpl_t aubio_parameter_get_current_value(const aubio_parameter_t *param)
get current parameter value, without interpolation
aubio_parameter_set_current_value
uint_t aubio_parameter_set_current_value(aubio_parameter_t *param, smpl_t value)
set current parameter value, skipping interpolation
aubio_parameter_set_min_value
uint_t aubio_parameter_set_min_value(aubio_parameter_t *param, smpl_t min_value)
set minimum value of this parameter
new_aubio_parameter
aubio_parameter_t * new_aubio_parameter(smpl_t min_value, smpl_t max_value, uint_t steps)
create new parameter object
aubio_parameter_set_max_value
uint_t aubio_parameter_set_max_value(aubio_parameter_t *param, smpl_t max_value)
set maximum value of this parameter
aubio_parameter_get_next_value
smpl_t aubio_parameter_get_next_value(aubio_parameter_t *param)
get next parameter
aubio_parameter_t
struct _aubio_parameter_t aubio_parameter_t
parameter object
Definition: parameter.h:40
del_aubio_parameter
void del_aubio_parameter(aubio_parameter_t *param)
destroy aubio_parameter_t object
uint_t
unsigned int uint_t
unsigned integer
Definition: types.h:60
smpl_t
float smpl_t
short sample format (32 or 64 bits)
Definition: types.h:41