smux4_1dis

Smooth multiplexer. Works like multiple cross fades. dis0 to dis3 can be used to disable unused objects (CPU optimisation).
Author: Smashed Transistors
License: LGPL
Github: tiar/mux/smux4_1dis.axo

Inlets

frac32buffer input 0

frac32buffer input 1

frac32buffer input 2

frac32buffer input 3

frac32.positive s

Outlets

frac32buffer output

bool32 output

bool32 output

bool32 output

bool32 output

Control Rate
int32_t sel = (inlet_s)&0x07FFFFFF;

const int32_t *s0, *s1;
switch (sel >> (27 - 2)) {
case 0:
  s0 = inlet_i0;
  s1 = inlet_i1;
  outlet_dis0 = false;
  outlet_dis1 = false;
  outlet_dis2 = true;
  outlet_dis3 = true;
  break;
case 1:
  s0 = inlet_i1;
  s1 = inlet_i2;
  outlet_dis0 = true;
  outlet_dis1 = false;
  outlet_dis2 = false;
  outlet_dis3 = true;
  break;
case 2:
  s0 = inlet_i2;
  s1 = inlet_i3;
  outlet_dis0 = true;
  outlet_dis1 = true;
  outlet_dis2 = false;
  outlet_dis3 = false;
  break;
case 3:
  s0 = inlet_i3;
  s1 = inlet_i0;
  outlet_dis0 = false;
  outlet_dis1 = true;
  outlet_dis2 = true;
  outlet_dis3 = false;
  break;
}
int32_t a = (sel << 2) & 0x07FFFFFF;
for (int i = 0; i < BUFSIZE; i++) {
  int32_t _s0 = s0[i];
  outlet_o[i] = ___SMMLA(a, s1[i] - _s0, _s0 >> 5) << 5;
}

Privacy

© 2024 Zrna Research