12. TODO Step Scheme Functions

12.1. DONE Step Scheme Loader

CLOSED: [2019-06-04 Tue 18:14] The top-level scheme loader is called s9_load_step.

<<step_function_declarations>>=
void s9_load_step(void);
<<step_functions>>=
<<step_scheme_functions>>
static S9_PRIM step_primitives[] = {
<<step_scheme_entries>>
    {NULL}
};
void s9_load_step(void)
{
    add_primitives("monolith", step_primitives);
}

12.2. DONE Create New Step Page

CLOSED: [2019-04-13 Sat 22:26] A new step page is created with monolith:step-new.

<<step_scheme_entries>>=
{"monolith:step-new", pp_step_new, 1, 1, {STR, ___, ___}},
<<step_scheme_functions>>=
static cell pp_step_new(cell x)
{
    const char *str;
    monolith_d *m;
    monolith_dict *dict;
    monolith_page *pg;
    int rc;

    m = monolith_data_get();
    dict = monolith_dict_get(m);

    str = string(car(x));

    rc = monolith_dict_newpage(dict, &pg, str, strlen(str));
    if(!rc) {
        return error(
            "Could not create step page (maybe it already exists?)",
            car(x));
    }

    page_step(pg);
    return UNSPECIFIC;
}

12.3. DONE Step Set Playhead Position

CLOSED: [2019-08-18 Sun 05:23]

<<step_scheme_entries>>=
{"monolith:step-playpos-set", pp_step_playpos_set, 2, 2, {STR, INT, ___}},
<<step_scheme_functions>>=
static cell pp_step_playpos_set(cell x)
{
    const char *str;
    monolith_d *m;
    monolith_dict *dict;
    monolith_page *pg;
    int rc;
    int pos;
    page_step_d *step;

    m = monolith_data_get();
    dict = monolith_dict_get(m);

    str = string(car(x));

    x = cdr(x);

    pos = integer_value("monolith:step-pos", car(x));

    rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
    if(!rc) {
        return error(
            "Could not find step page",
            car(x));
    }

    step = monolith_page_data_get(pg);

    page_step_playpos_set(step, pos);
    page_step_draw_playhead(step);
    return UNSPECIFIC;
}

12.4. TODO Step Set Note/Gate

12.5. TODO Step Set Playback

12.6. TODO Wait and Reset

<<step_scheme_entries>>=
{
    "monolith:step-wait-and-reset",
    pp_step_wait_and_reset,
    1, 1,
    {STR, ___, ___}
},
<<step_scheme_functions>>=
static cell pp_step_wait_and_reset(cell x)
{
    const char *str;
    monolith_d *m;
    monolith_dict *dict;
    monolith_page *pg;
    int rc;
    page_step_d *step;

    m = monolith_data_get();
    dict = monolith_dict_get(m);

    str = string(car(x));

    x = cdr(x);

    rc = monolith_dict_lookup(dict, &pg, str, strlen(str));
    if (!rc) {
        return error(
            "Could not find step page",
            car(x));
    }

    step = monolith_page_data_get(pg);

    step_wait_and_reset(step);
    return UNSPECIFIC;
}



prev | home | next