automux b 8

input collector.outputs an input's value if it changes.
Author: Robert Schirmer
License: BSD
Github: rbrt/patching/automux b 8.axo

Inlets

bool32 i0

bool32 i1

bool32 i2

bool32 i3

bool32 i4

bool32 i5

bool32 i6

bool32 i7

Outlets

bool32 o

Declaration
int32_t prev0;
int32_t prev1;
int32_t prev2;
int32_t prev3;
int32_t prev4;
int32_t prev5;
int32_t prev6;
int32_t prev7;

int src;
Control Rate
if (inlet_i0 != prev0) {
  src = 0;
  prev0 = inlet_i0;
}
if (inlet_i1 != prev1) {
  src = 1;
  prev1 = inlet_i1;
}
if (inlet_i2 != prev2) {
  src = 2;
  prev2 = inlet_i2;
}
if (inlet_i3 != prev3) {
  src = 3;
  prev3 = inlet_i3;
}
if (inlet_i4 != prev4) {
  src = 4;
  prev4 = inlet_i4;
}
if (inlet_i5 != prev5) {
  src = 5;
  prev5 = inlet_i5;
}
if (inlet_i6 != prev6) {
  src = 6;
  prev6 = inlet_i6;
}
if (inlet_i7 != prev7) {
  src = 7;
  prev7 = inlet_i7;
}

switch (src) {
case 0:
  outlet_o = inlet_i0;
  break;
case 1:
  outlet_o = inlet_i1;
  break;
case 2:
  outlet_o = inlet_i2;
  break;
case 3:
  outlet_o = inlet_i3;
  break;
case 4:
  outlet_o = inlet_i4;
  break;
case 5:
  outlet_o = inlet_i5;
  break;
case 6:
  outlet_o = inlet_i6;
  break;
case 7:
  outlet_o = inlet_i7;
  break;
default:
  outlet_o = inlet_i0;
  break;
}

Privacy

© 2024 Zrna Research