~pbatch/patchwerk

9896a10de32869a9113db33bb0dfc4bb4450e73c — paul 10 months ago 654f2fe
added gen_triangle

FossilOrigin-Name: 27f98bd2a36f044b8ace602022dfe69d87ef620c71cbe5af0e34abc4ccecabb1
4 files changed, 44 insertions(+), 2 deletions(-)

M runt/Makefile
A runt/ftbl/gen_triangle.c
M runt/nodes.c
M runt/runt_patchwerk.h
M runt/Makefile => runt/Makefile +1 -0
@@ 42,6 42,7 @@ OBJ += ftbl/gen_sinesum.o
OBJ += ftbl/tblsize.o
OBJ += ftbl/tbldur.o
OBJ += ftbl/gen_composite.o
OBJ += ftbl/gen_triangle.o

# Buffer Stack Operations
OBJ += bstack/bdup.o

A runt/ftbl/gen_triangle.c => runt/ftbl/gen_triangle.c +39 -0
@@ 0,0 1,39 @@
#include <stdio.h>
#include <runt.h>
#include <soundpipe.h>
#include "patchwerk.h"
#include "runt_patchwerk.h"
#include "runt_ftbl.h"
#include "ugen_enums.h"

static runt_int rproc_gen_triangle(runt_vm *vm, runt_ptr p)
{
    sp_ftbl *ft;
    runt_int rc;
    runt_stacklet *s;
    pw_patch *patch;
    sp_data *sp;

    rc = rpw_get_ftable(vm, &ft);
    RUNT_ERROR_CHECK(rc);

    patch = rpw_get_patch(p);
    sp = pw_patch_data_get(patch);

    sp_gen_triangle(sp, ft);

    rc = runt_ppush(vm, &s);
    RUNT_ERROR_CHECK(rc);
    rpw_stacklet_ftable(vm, s, ft);

    return RUNT_OK;
}


runt_int rpw_gen_triangle(runt_vm *vm, runt_ptr p)
{
    patchwerk_word_define(vm, p,
                          "gen_triangle", 12,
                          rproc_gen_triangle);
    return RUNT_OK;
}

M runt/nodes.c => runt/nodes.c +3 -2
@@ 29,10 29,11 @@ runt_int runt_load_nodes(runt_vm *vm, runt_ptr p)
    rpw_bdrop(vm, p);
    rpw_cable(vm, p);
    rpw_ftbl(vm, p);
    /* rpw_gen_sinesum(vm, p); */
    rpw_gen_sinesum(vm, p);
    rpw_tblsize(vm, p);
    rpw_tbldur(vm, p);
    /* rpw_gen_composite(vm, p); */
    rpw_gen_composite(vm, p);
    rpw_gen_triangle(vm, p);
    runt_mark_set(vm);
    return RUNT_OK;
}

M runt/runt_patchwerk.h => runt/runt_patchwerk.h +1 -0
@@ 76,6 76,7 @@ runt_int rpw_ftnew(runt_vm *vm, runt_ptr p);
runt_int rpw_tblsize(runt_vm *vm, runt_ptr p);
runt_int rpw_tbldur(runt_vm *vm, runt_ptr p);
runt_int rpw_gen_composite(runt_vm *vm, runt_ptr p);
runt_int rpw_gen_triangle(runt_vm *vm, runt_ptr p);

/* buffer stack operations */
runt_int rpw_bdup(runt_vm *vm, runt_ptr p);