checkall

Sends out a pulse only if all the inputs have gone high for the amount of times set by the repeat selector. If you want to use less inputs, just connect the last used one to the remaining inputs.
Author: Remco van der Most
License: BSD
Github: sss/logic/checkall.axo

Inlets

bool32 i1

bool32 i2

bool32 i3

bool32 i4

bool32 i5

bool32 i6

bool32 i7

bool32 i8

Outlets

bool32.pulse trg

Parameters

int32 repeat

Declaration
int trg[8];
int cnt, i, repeat;
Init
for (i = 0; i < 8; i++) {
  trg[i] = 0;
}
Control Rate
int in[8];
outlet_trg = 0;
in[0] = inlet_i1;
in[1] = inlet_i2;
in[2] = inlet_i3;
in[3] = inlet_i4;
in[4] = inlet_i5;
in[5] = inlet_i6;
in[6] = inlet_i7;
in[7] = inlet_i8;
int sum = 0;
for (i = 0; i < 8; i++) {
  if (in[i] > 0) {
    trg[i] = 1;
  }
  sum += trg[i];
}

if (sum > 7) {
  repeat += 1;
  if (repeat == param_repeat) {
    repeat = 0;
    for (i = 0; i < 8; i++) {
      trg[i] = 0;
    }
    outlet_trg = 1;
  }
}

Privacy

© 2024 Zrna Research