(Teletype) State Clearing Operators

#21

Yay, found what I was looking for in the code:

INIT.TR.ALL will clear all triggers

4 Likes

#22

Re: INIT.P x

I only know of Patter 0 - 3 and yet I can execute INIT.P 5 and not get an error. Are there other patterns possible beyond the four?

0 Likes

#23

Teletype does not produce an error for an out-of-bounds parameter (yet). Try:

CV 1000 V 5

No error.

So, no, there are no patterns beyond 3. If we want to know what actually happens in out-of-bounds circumstances, we have to look at the code.

static void op_INIT_P_get(const void *NOTUSED(data), scene_state_t *ss,
                          exec_state_t *NOTUSED(es), command_state_t *cs) {
    int16_t v = cs_pop(cs);
    if (v >= 0 && v < 4) ss_pattern_init(ss, v);
}

Here we can see that nothing happens when the parameter is out-of-bounds.

2 Likes

#24

I understand INIT.P to clear Pattern Data, so what is INIT.DATA clearing and in the code where the line reads

static void op_INIT_DATA_get

Does that “_get” necessarily imply there is a variable value following the op, such as INIT.DATA x

0 Likes

#25

The _get portion is an implementation custom and does not define that there is an argument. If you want to know how many arguments an operator takes, you have to look for instances of:

cs_pop(cs)

This is how an operator acquires an argument. INIT.DATA does not call this, so it has no argument!

0 Likes

#26

So what does INIT.DATA clear?

0 Likes

#27

It calls this function:

void ss_variables_init(scene_state_t *ss) {
    const scene_variables_t default_variables = {
        // variables that haven't been explicitly initialised, will be set to 0
        // TODO: verify no missing
        .a = 1,
        .b = 2,
        .c = 3,
        .cv_slew = { 1, 1, 1, 1 },
        .d = 4,
        .drunk_min = 0,
        .drunk_max = 255,
        .m = 1000,
        .m_act = 1,
        .o_inc = 1,
        .o_min = 0,
        .o_max = 63,
        .o_wrap = 1,
        .q_n = 1,
        .r_min = 0,
        .r_max = 16383,
        .time_act = 1,
        .tr_pol = { 1, 1, 1, 1 },
        .tr_time = { 100, 100, 100, 100 },
        .in_range = { 0, 16383 },
        .param_range = { 0, 16383 },
    };

    memcpy(&ss->variables, &default_variables, sizeof(default_variables));
    ss_update_param_scale(ss);
    ss_update_in_scale(ss);
}

It basically sets all the variables to start-up state.

There are other variables in scene_variables_t and they are zeroed by this function. You can see all the variables affected by looking at the definition of this type in src/state.h

1 Like

#28

potential visual bug, can anyone verify on other releases? I’m on 2.3 beta B537759

when in the tracker view, running INIT.P x in a scene from a hotkey doesn’t visually clear the pattern. pushing new data will clear it, as will tabbing away and back. not a crazy deal breaker, but I like hanging in tracker when I’m doing grid ops stuff.

0 Likes

#29

the fix is in, will be included in the next 2.3 beta.

2 Likes