2. Trig Data

2.1. WIP Trig Data Contents

2.1.1. Trig Monome State Data

<<page_trig_contents>>=
monolith_page_mstate *mstate;
<<trig_init>>=
monolith_page_mstate_new(pg, &trig->mstate);
<<trig_cleanup>>=
monolith_page_mstate_free(&trig->mstate);

2.1.2. Trig VM

The actual virtual machine (VM) for trig.

<<page_trig_contents>>=
trig_vm tvm;
<<trig_init>>=
trig_vm_init(&trig->tvm);
<<trig_wire_setter>>

2.1.3. Last Selected cell

The last selected. Used to quickly turn it off.

<<page_trig_contents>>=
int last_x;
int last_y;
<<trig_init>>=
trig->last_x = 0;
trig->last_y = 0;

2.1.4. Selected Cell

<<page_trig_contents>>=
int curcell;
<<trig_init>>=
trig->curcell = 0;

2.1.5. Wire Event Stacks

For 8 wires. See the <> section for more on this.

<<page_trig_contents>>=
wire_evstack wes[8];
<<trig_init>>=
{
    int w;
    for (w = 0; w < 8; w++) {
        trig->wes[w].nitems = 0;
        trig->wes[w].input = 0;
        trig->wes[w].ref = trig_vm_wire_ref(&trig->tvm, w);
        trig->wes[w].ces = &trig->ces;
        trig->wes[w].last = 0;
    }
}

2.1.6. Clock event stacks

See the <> section for more on this.

<<page_trig_contents>>=
clock_evstack ces;
<<trig_init>>=
trig->ces.nitems = 0;

2.1.7. Reset State

Holding the bottom left two keys down causes a reset. Their states are held in a variable called reset_state.

<<page_trig_contents>>=
uint8_t reset_state;
<<trig_init>>=
trig->reset_state = 0;

2.1.8. Please Reset

When a reset is requested, a flag is set. A reset will happen at the beginning of the next trigex and trigrexblock.

It gets cleared at the end of the trigex block.

<<page_trig_contents>>=
uint8_t please_reset;
<<trig_init>>=
trig->please_reset = 0;

2.1.9. Drawing States

Drawing states for the program visualizer, stored in a 32-bit integer. A current and previous state is stored to determine when to update.

<<page_trig_contents>>=
uint32_t dstate;
uint32_t dstate_prev;
<<trig_init>>=
trig->dstate = 0;
trig->dstate_prev = 0;

2.2. DONE Trig Typedef Declaration

CLOSED: [2020-04-19 Sun 14:35] All trig page data is contained in a struct called page_trig_d.

<<trig_typedefs>>=
typedef struct page_trig_d page_trig_d;
<<trig_struct>>=
struct page_trig_d {
<<page_trig_contents>>
};

2.3. DONE Trig Data Allocation/Initialization

CLOSED: [2020-04-19 Sun 14:35] Trig data is initiatlized with the function page_trig_init.

<<trig_function_declarations>>=
static void page_trig_init(monolith_page *pg, page_trig_d *trig);
<<trig_functions>>=
static void page_trig_init(monolith_page *pg, page_trig_d *trig)
{
<<trig_init>>
}

2.4. DONE Trig Data Cleanup

CLOSED: [2020-04-19 Sun 14:35] Trig data is freed with the funciton page_trig_free.

<<trig_function_declarations>>=
static void page_trig_cleanup(page_trig_d *trig);
<<trig_functions>>=
static void page_trig_cleanup(page_trig_d *trig)
{
<<trig_cleanup>>
}



prev | home | next