6. DONE Step Monome Display

CLOSED: [2019-02-24 Sun 14:17] Drawing and redrawing of certain regions of the monome are done with the a handful of drawing functions. In additional to lighting up the physical monome, they will also save the state in the provided monolith state file, so that it can be saved and recalled later.

6.1. DONE Step Monome Draw Note

CLOSED: [2019-02-17 Sun 14:54] A note is visualized on the drawing layer via the function page_step_draw_note. This requires the note to be decomposed into its octave and note beforehand.

<<step_function_declarations>>=
static void page_step_draw_note(page_step_d *step, int note, int oct);
<<step_functions>>=
static void page_step_draw_note(page_step_d *step, int note, int oct)
{
    unsigned short out;
    out = (1 << note) + ((1 << oct) << 12);
    monolith_page_mstate_led_row16(step->mstate, 4, out);
}

Often, the draw function will be needed to updated based on the current playhead. This is done with the function page_step_draw_current_note.

<<step_function_declarations>>=
static void page_step_draw_current_note(page_step_d *step);
<<step_functions>>=
static void page_step_draw_current_note(page_step_d *step)
{
    int pitch;
    int oct;
    to_pitchoct(get_current_note(step), &pitch, &oct);
    page_step_draw_note(step, pitch, oct);
}

6.2. DONE Step Monome Draw Gate

CLOSED: [2019-02-18 Mon 18:32] The gate at the current playhead position is updated with the function page_step_draw_gate.

<<step_function_declarations>>=
static void page_step_draw_gate(page_step_d *step);
<<step_functions>>=
static void page_step_draw_gate(page_step_d *step)
{
    int x, y, s;
    int pos;
    pos = page_step_editpos_get(step);
    if(pos > 15) y = 3;
    else y = 1;
    x = pos % 16;
    s = step_pattern_gate_get(&step->pat[step->curpat], pos);
    monolith_page_mstate_led_set(step->mstate, x, y, s);
}

6.3. DONE Step Monome Draw Playhead

CLOSED: [2019-02-17 Sun 15:48] The playhead position is drawn with the function page_step_draw_playhead.

<<step_function_declarations>>=
static void page_step_draw_playhead(page_step_d *step);
<<step_functions>>=
static void page_step_draw_playhead(page_step_d *step)
{
    int pos;
    unsigned short r1, r2;
    pos = page_step_editpos_get(step);
    r1 = 0;
    r2 = 0;

    if(pos > 15) {
        r2 = 1 << (pos - 16);
    } else {
        r1 = 1 << pos;
    }

    monolith_page_mstate_led_row16(step->mstate, 0, r1);
    monolith_page_mstate_led_row16(step->mstate, 2, r2);
}

6.4. DONE Step Monome Draw Toolbar

CLOSED: [2019-02-24 Sun 14:17] Right now, the thing needed for the toolbar is to be able to toggle things on and off. What is provided is a position and a state.

<<step_function_declarations>>=
static void page_step_draw_toolbar(page_step_d *step, int pos, int state);
<<step_functions>>=
static void page_step_draw_toolbar(page_step_d *step, int pos, int state)
{
    monolith_page_mstate_led_set(step->mstate, pos, 7, state);
}

6.5. TODO Step Monome Draw Pattern

Draws a pattern onto a monome screen. Useful when loading patches from disk.

<<step_function_declarations>>=
static void page_step_draw_pattern(page_step_d *step,
                                   step_pattern *pat);
<<step_functions>>=
static void page_step_draw_pattern(page_step_d *step,
                                   step_pattern *pat)
{
    int p;
    int y;
    for(p = 0; p < pat->size; p++) {
        y = (p < 16) ? 1 : 3;
        if(pat->gates[p]) {
            monolith_page_mstate_led_set(step->mstate,
                                         p % 16, y,
                                         1);
        } else {
            monolith_page_mstate_led_set(step->mstate,
                                         p % 16, y,
                                         0);
        }
    }
}



prev | home | next