ESP  0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
tuneable.cpp File Reference
#include "tuneable.h"
#include <cmath>
#include "ofApp.h"

Functions

void registerTuneable (int &value, int min, int max, const string &title, const string &description, std::function< void(int)> cb)
 
void registerTuneable (double &value, double min, double max, const string &title, const string &description, std::function< void(double)> cb)
 
void registerTuneable (bool &value, const string &title, const string &description, std::function< void(bool)> cb)
 

Function Documentation

void registerTuneable ( int &  value,
int  min,
int  max,
const string &  name,
const string &  description,
std::function< void(int)>  cb = nullptr 
)

Create a tuneable parameter of type int. This will generate a slider in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter.

Parameters
valuereference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value.
minthe minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
maxthe maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba callback function that is invoked when user input is received.
Examples:
user_accelerometer_gestures.cpp, user_accelerometer_gestures_osc.cpp, user_accelerometer_poses.cpp, user_accelerometer_walk_detection.cpp, user_color_sensor.cpp, and user_speaker.cpp.
void registerTuneable ( double &  value,
double  min,
double  max,
const string &  name,
const string &  description,
std::function< void(double)>  cb = nullptr 
)

Create a tuneable parameter of type double. This will generate a slider in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter.

Parameters
valuereference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value.
minthe minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
maxthe maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba callback function that is invoked when user input is received.
void registerTuneable ( bool &  value,
const string &  name,
const string &  description,
std::function< void(bool)>  cb = nullptr 
)

Create a tuneable parameter of type bool. This will generate a checkbox in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter. Checking the checkbox sets the variable to true; unchecking it sets it to false.

Parameters
valuereference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba callback function that is invoked when user input is received.