11. DONE Step Runt Words

CLOSED: [2019-02-24 Sun 14:17]

11.1. DONE Step Runt Loader

CLOSED: [2019-02-23 Sat 12:22] All runt words are loaded with the function step_runt_loader. It is loaded at init time.

<<step_function_declarations>>=
static int step_runt_loader(monolith_d *m);
<<step_functions>>=
<<step_runt_functions>>
static int step_runt_loader(monolith_d *m)
{
<<step_runt_keywords>>
    monolith_runt_mark_set(m);
    return RUNT_OK;
}
<<step_runtime_init>>=
step_runt_loader(m);

11.2. DONE stepclk

CLOSED: [2019-02-23 Sat 11:46] The stepclk node is a special node that intends to be called exactly once in a signal chain. This node takes in a clock signal from a unit generator such as metro or clock, and then uses that as the clock source of the step generator.

<<step_runt_keywords>>=
monolith_runt_keyword(m, "stepclk", 7, rproc_stepclk, m);
<<step_runt_functions>>=
static int rproc_stepclk(runt_vm *vm, runt_ptr p)
{
    int rc;
    rgf_param in;
    gf_patch *patch;
    gf_node *node;
    const char *name;
    monolith_d *m;
    monolith_page *pg;
    runt_stacklet *s;
    page_step_d *step;

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = rgf_get_param(vm, &in);
    RUNT_ERROR_CHECK(rc);

    m = runt_to_cptr(p);
    patch = monolith_graforge_get(m);

    rc = runt_monolith_lookup_page(vm, m, name, "step", is_step, &pg);
    RUNT_ERROR_CHECK(rc);

    step = monolith_page_data_get(pg);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);
    node_stepclk(node, step);
    rgf_set_param(vm, node, &in, 0);
    return RUNT_OK;
}

11.3. DONE stepnt

CLOSED: [2019-02-23 Sat 12:48] stepnt is a node that outputs the current note signal based on the current clock position.

<<step_runt_keywords>>=
monolith_runt_keyword(m, "stepnt", 6, rproc_stepnt, m);
<<step_runt_functions>>=
static int rproc_stepnt(runt_vm *vm, runt_ptr p)
{
    int rc;
    gf_patch *patch;
    gf_node *node;
    const char *name;
    monolith_d *m;
    monolith_page *pg;
    runt_stacklet *s;
    page_step_d *step;
    runt_stacklet *out;

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = runt_ppush(vm, &out);
    RUNT_ERROR_CHECK(rc);

    m = runt_to_cptr(p);
    patch = monolith_graforge_get(m);

    rc = runt_monolith_lookup_page(vm, m, name, "step", is_step, &pg);
    RUNT_ERROR_CHECK(rc);

    step = monolith_page_data_get(pg);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);
    node_stepnt(node, step);
    rgf_push_output(vm, node, out, 0);
    return RUNT_OK;
}

11.4. DONE stepgt

CLOSED: [2019-02-23 Sat 13:11] stepgt is a node which outputs the current gate signal based on the current position.

<<step_runt_keywords>>=
monolith_runt_keyword(m, "stepgt", 6, rproc_stepgt, m);
<<step_runt_functions>>=
static int rproc_stepgt(runt_vm *vm, runt_ptr p)
{
    int rc;
    gf_patch *patch;
    gf_node *node;
    const char *name;
    monolith_d *m;
    monolith_page *pg;
    runt_stacklet *s;
    page_step_d *step;
    runt_stacklet *out;

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = runt_ppush(vm, &out);
    RUNT_ERROR_CHECK(rc);

    m = runt_to_cptr(p);
    patch = monolith_graforge_get(m);

    rc = monolith_lookup_page(m, &pg, name, strlen(name));

    if(!rc) {
        runt_print(vm, "Could not find page '%s'\n", name);
        return RUNT_NOT_OK;
    }

    if(!is_step(pg)) {
        runt_print(vm, "Page '%s' is not a step page\n", name);
        return RUNT_NOT_OK;
    }

    step = monolith_page_data_get(pg);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);
    node_stepgt(node, step);
    rgf_push_output(vm, node, out, 0);
    return RUNT_OK;
}

11.5. DONE stepplay

CLOSED: [2019-02-24 Sun 14:17] stepplay is a node which outputs a gate signal inidicating if the page is playing or not.

<<step_runt_keywords>>=
monolith_runt_keyword(m, "stepplay", 8, rproc_stepplay, m);
<<step_runt_functions>>=
static int rproc_stepplay(runt_vm *vm, runt_ptr p)
{
    int rc;
    gf_patch *patch;
    gf_node *node;
    const char *name;
    monolith_d *m;
    monolith_page *pg;
    runt_stacklet *s;
    page_step_d *step;
    runt_stacklet *out;

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = runt_ppush(vm, &out);
    RUNT_ERROR_CHECK(rc);

    m = runt_to_cptr(p);
    patch = monolith_graforge_get(m);

    rc = runt_monolith_lookup_page(vm, m, name, "step", is_step, &pg);
    RUNT_ERROR_CHECK(rc);

    step = monolith_page_data_get(pg);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);
    node_play(node, step);
    rgf_push_output(vm, node, out, 0);
    return RUNT_OK;
}

11.6. TODO stepstep

Sets the step size.

<<step_runt_keywords>>=
monolith_runt_keyword(m, "stepstep", 8, rproc_stepstep, m);
<<step_runt_functions>>=
static int rproc_stepstep(runt_vm *vm, runt_ptr p)
{
    int rc;
    gf_patch *patch;
    gf_node *node;
    const char *name;
    monolith_d *m;
    monolith_page *pg;
    runt_stacklet *s;
    page_step_d *step;
    rgf_param in;

    rc = runt_ppop(vm, &s);
    RUNT_ERROR_CHECK(rc);
    name = runt_to_string(s->p);

    rc = rgf_get_param(vm, &in);
    RUNT_ERROR_CHECK(rc);

    m = runt_to_cptr(p);
    patch = monolith_graforge_get(m);

    rc = monolith_lookup_page(m, &pg, name, strlen(name));

    if(!rc) {
        runt_print(vm, "Could not find page '%s'\n", name);
        return RUNT_NOT_OK;
    }

    if(!is_step(pg)) {
        runt_print(vm, "Page '%s' is not a step page\n", name);
        return RUNT_NOT_OK;
    }

    step = monolith_page_data_get(pg);

    rc = gf_patch_new_node(patch, &node);
    GF_RUNT_ERROR_CHECK(rc);
    node_step(node, step);
    rgf_set_param(vm, node, &in, 0);
    return RUNT_OK;
}



prev | home | next