7. TODO Patchwerk Node

Bugz is implemented inside of a patchwerk node.

This means a few things:

it gets created with a function called node_bugz. What are the i-rate parameters?

It has cables, some for input, some for output. What are those cable names and parameters?

7 cables total:

0: Input 1: Record Gate 2: Decay Time 3: Delay Time 4: Density 5: Grain Duration 6: Output

<<funcdefs>>=
int node_bugz(pw_node *node, int maxbugz);
<<funcs>>=
int node_bugz(pw_node *node, int maxbugz)
{
    int rc;
    pw_patch *patch;
    void *ud;
    bugz_synth *bugz;

    rc = pw_node_get_patch(node, &patch);
    if (rc != PW_OK) return rc;

    rc = pw_memory_alloc(patch, sizeof(bugz_synth), &ud);
    if (rc != PW_OK) return rc;

    bugz = ud;

    /* TODO: init bugz */

    pw_node_cables_alloc(node, 7);
    pw_node_set_block(node, 6);

    /* TODO: bind cables? */

    pw_node_set_compute(node, compute);
    pw_node_set_destroy(node, destroy);
    pw_node_set_data(node, bugz);

    return PW_OK;
}
<<static_funcdefs>>=
static void compute(pw_node *node);
<<funcs>>=
static void compute(pw_node *node)
{
    /* TODO: implement */
}
<<static_funcdefs>>=
static void destroy(pw_node *node);
<<funcs>>=
static void destroy(pw_node *node)
{
    pw_patch *patch;
    int rc;
    void *ud;
    pw_node_cables_free(node);

    rc = pw_node_get_patch(node, &patch);

    if (rc != PW_OK) return;

    ud = pw_node_get_data(node);

    pw_memory_free(patch, &ud);
}



prev | home | next