3. Data

Stored in a struct called tdelay_d.

<<typedefs>>=
typedef struct tdelay_d tdelay_d;
<<structs>>=
struct tdelay_d {
<<tdelay_d>>
};

A tdelay most notably has a bank of trigger loops.

<<tdelay_d>>=
tdelay_loop *bank;
int nloops;

The number of active loops is used to make lookup faster (return quickly if there are no free loops).

<<tdelay_d>>=
int nactive;

Also used to help speed up loop claiming faster, the last freed loop is used. A negative value means there is no last free loop quickly available, and a linear search must be in place instead.

<<tdelay_d>>=
int last_free;

Any loop that is put into FIRE mode must immediately be shut off in the next block, otherwise the loop node will tick every block until the next tick. A flag is used to keep track of this state.

<<tdelay_d>>=
int ticked_last_block;

Epsilon is the threshold for when to turn off the node.

<<tdelay_d>>=
double eps;
<<funcdefs>>=
void tdelay_eps(tdelay_d *td, double eps);
<<funcs>>=
void tdelay_eps(tdelay_d *td, double eps)
{
    td->eps = eps;
}



prev | home | next