2. Sliders Data
2.1. Sliders Data Declaration
All sliders page data is contained in a struct called page_sliders_d
.
typedef struct page_sliders_d page_sliders_d;
struct page_sliders_d {
<<page_sliders_contents>>
};
2.2. Sliders Data Initialization
Sliders data is initiatlized with the function page_sliders_init
.
static void page_sliders_init(monolith_page *pg, page_sliders_d *sl);
static void page_sliders_init(monolith_page *pg, page_sliders_d *sl)
{
int i;
<<sliders_init>>
}
2.3. Sliders Data Cleanup
Sliders data is freed with the funciton page_sliders_free
.
static void page_sliders_cleanup(page_sliders_d *sl);
static void page_sliders_cleanup(page_sliders_d *sl)
{
<<sliders_cleanup>>
}
2.4. Sliders Data Contents
2.4.1. Monome State Data
monolith_page_mstate *mstate;
monolith_page_mstate_new(pg, &sl->mstate);
monolith_page_mstate_free(&sl->mstate);
2.4.2. Arc State Data
monolith_page_arcstate *arcstate;
monolith_page_arcstate_new(pg, &sl->arcstate);
monolith_page_arcstate_free(&sl->arcstate);
2.4.3. Sliders Values
Slider values are stored as uniform (0-1) floating point (GFFLT) values in an array. There are 8 slider values, each corresponding to a row on the monome. At runtime, they are all explicitely set to be 0.
GFFLT vals[8];
for(i = 0; i < 8; i++) {
sl->vals[i] = 0;
}
2.4.4. Soundpipe f-table
To make it easier to talk to other nodes, the slider values are wrapped inside of a soundpipe ftable.
sp_ftbl ft;
sl->ft.tbl = sl->vals;
sl->ft.size = 8;
The sliders can be retrieved with page_sliders_ftbl
.
sp_ftbl * page_sliders_ftable(page_sliders_d *sl);
sp_ftbl * page_sliders_ftable(page_sliders_d *sl)
{
return &sl->ft;
}
2.4.5. Increment Amounts
The increment value is how much to increase or decrease a slider value when a knob is turned. There are two different kinds of knobs, thus two increment types.
2.4.5.1. Griffin Increment
The increment amount anytime the griffin knob is turned. By default, it is set to be 0.01.
GFFLT inc;
sl->inc = 0.01;
The increment can be set using the function
page_sliders_increment_set
#+NAME: slidersdeclarations
static void page_sliders_increment_set(page_sliders_d *slide, GFFLT inc);
static void page_sliders_increment_set(page_sliders_d *slide, GFFLT inc)
{
slide->inc = inc;
}
2.4.5.2. Arc Increment
The Arc was introduced later on in the development of the sliders page. It initially used the griffin increment amount, but it was found to move too quickly. For this reason, the Arc uses a separate (and smaller) increment value.
GFFLT arc_inc;
The default value used for the increment amount is 0.001, This was emperically found to be a value that has an approximate 1:1 relationship to the turn of the encoder.
sl->arc_inc = 0.001;
The arc increment value can be set using the function
page_sliders_arc_increment_set
.
static void page_sliders_arc_increment_set(page_sliders_d *slide,
GFFLT inc);
static void page_sliders_arc_increment_set(page_sliders_d *slide,
GFFLT inc)
{
slide->arc_inc = inc;
}
2.4.6. Previous Position
The previous XY location is stored. This logic is used in order to get a slider to zero (pressing the left-most row twice). It is initialized to negative values.
int px, py;
sl->px = -1;
sl->py = -1;
2.4.7. Selected Slider
The currently selected slider value is stored as an integer curslider
.
It is automatically set when
you control a particular slider from the monome. This value tells the griffin
knob which slider to adjust.
int curslider;
The sliders value is set to be a negative value to indicate that no slider has been selected.
sl->curslider = -1;
2.4.8. Internal Gate
When the griffin knob is pushed down, the internal state data is stored inside
of a value called gate
.
int gate;
sl->gate = 0;
2.4.9. Griffin Lock
An integer boolean value that locks the griffin to the currently selected slider. By default, this is disabled.
int griffin_lock;
sl->griffin_lock = 0;
It is set using page_sliders_griffin_lock
.
static void page_sliders_griffin_lock(page_sliders_d *slide,
int state);
static void page_sliders_griffin_lock(page_sliders_d *slide,
int state)
{
slide->griffin_lock = state;
}
2.4.10. Arc Slider Positions
These store which sliders the Arc is controlling. By default, it is the first 4 sliders.
int arc_slider[4];
sl->arc_slider[0] = 0;
sl->arc_slider[1] = 1;
sl->arc_slider[2] = 2;
sl->arc_slider[3] = 3;
An arc value can be assigned using
page_sliders_arc_set
.
static void page_sliders_arc_set(page_sliders_d *slide,
int arc,
int slider);
Bounds checking is done here so it doesn't have to be done anywhere else.
static void page_sliders_arc_set(page_sliders_d *slide,
int arc,
int slider)
{
if(arc < 0 || arc >= 4) return;
if(slider < 0 || slider >= 8) return;
slide->arc_slider[arc] = slider;
}
prev | home | next