2. Sliders Data

2.1. Sliders Data Declaration

All sliders page data is contained in a struct called page_sliders_d.

<<sliders_typedefs>>=
typedef struct page_sliders_d page_sliders_d;
<<sliders_struct>>=
struct page_sliders_d {
<<page_sliders_contents>>
};

2.2. Sliders Data Initialization

Sliders data is initiatlized with the function page_sliders_init.

<<sliders_function_declarations>>=
static void page_sliders_init(monolith_page *pg, page_sliders_d *sl);
<<sliders_functions>>=
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.

<<sliders_function_declarations>>=
static void page_sliders_cleanup(page_sliders_d *sl);
<<sliders_functions>>=
static void page_sliders_cleanup(page_sliders_d *sl)
{
<<sliders_cleanup>>
}

2.4. Sliders Data Contents

2.4.1. Monome State Data

<<page_sliders_contents>>=
monolith_page_mstate *mstate;
<<sliders_init>>=
monolith_page_mstate_new(pg, &sl->mstate);
<<sliders_cleanup>>=
monolith_page_mstate_free(&sl->mstate);

2.4.2. Arc State Data

<<page_sliders_contents>>=
monolith_page_arcstate *arcstate;
<<sliders_init>>=
monolith_page_arcstate_new(pg, &sl->arcstate);
<<sliders_cleanup>>=
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.

<<page_sliders_contents>>=
GFFLT vals[8];
<<sliders_init>>=
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.

<<page_sliders_contents>>=
sp_ftbl ft;


<<sliders_init>>=
sl->ft.tbl = sl->vals;
sl->ft.size = 8;

The sliders can be retrieved with page_sliders_ftbl.

<<sliders_function_declarations>>=
sp_ftbl * page_sliders_ftable(page_sliders_d *sl);
<<sliders_functions>>=
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.

<<page_sliders_contents>>=
GFFLT inc;
<<sliders_init>>=
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);
<<sliders_functions>>=
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.

<<page_sliders_contents>>=
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.

<<sliders_init>>=
sl->arc_inc = 0.001;

The arc increment value can be set using the function page_sliders_arc_increment_set.

<<sliders_function_declarations>>=
static void page_sliders_arc_increment_set(page_sliders_d *slide,
                                           GFFLT inc);
<<sliders_functions>>=
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.

<<page_sliders_contents>>=
int px, py;
<<sliders_init>>=
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.

<<page_sliders_contents>>=
int curslider;

The sliders value is set to be a negative value to indicate that no slider has been selected.

<<sliders_init>>=
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.

<<page_sliders_contents>>=
int gate;
<<sliders_init>>=
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.

<<page_sliders_contents>>=
int griffin_lock;
<<sliders_init>>=
sl->griffin_lock = 0;

It is set using page_sliders_griffin_lock.

<<sliders_function_declarations>>=
static void page_sliders_griffin_lock(page_sliders_d *slide,
                                      int state);
<<sliders_functions>>=
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.

<<page_sliders_contents>>=
int arc_slider[4];
<<sliders_init>>=
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.

<<sliders_function_declarations>>=
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.

<<sliders_functions>>=
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