scope 128 b trig

bipolar audio rate signal oscilloscope (time domain), showing 128 consecutive samples after the signal becomes positive.
Author: Johannes Taelman
License: BSD
Github: disp/scope 128 b trig.axo

Inlets

frac32buffer.bipolar input

bool32 hold

Outlets

None

Displays

int8array128.vbar scope

Declaration
int8_t t[128];
int index;
int32_t pval;
Init
int i;
for (i = 0; i < 128; i++)
  t[i] = 0;
index = 0;
pval = 0;
Control Rate
int i;
if (index < 0) {
  for (i = 0; i < 16; i++) {
    int32_t val = (inlet_in[i]) > (1 << 19);
    if (val && (!pval)) {
      index = 0;
      break;
    }
    pval = val;
  }
  if (index == 0) {
    for (; i < 16; i++) {
      t[index++] = (uint8_t)(inlet_in[i] >> 21);
    }
  }
} else {
  for (i = 0; i < 16; i++) {
    if (index == 128) {
      index = -1;
      break;
    }
    t[index++] = (uint8_t)(inlet_in[i] >> 21);
  }
  if ((index == -1) && (!inlet_hold)) {
    for (i = 0; i < 128; i++)
      disp_scope[i] = t[i];
    pval = (inlet_in[BUFSIZE - 1]) > (1 << 19);
  }
}

Privacy

© 2024 Zrna Research