smthRotator4

Smooth input rotator. Smoothly rotates all the inputs along the 8 outputs. This new version has a linear and exponential output-jump size, skipping outputs and so generating different patterns
Author: Remco van der Most
License: BSD
Github: sss/mux/smthRotator4.axo

Inlets

frac32 input 0

frac32 input 1

frac32 input 2

frac32 input 3

frac32.positive s

Outlets

frac32 output

frac32 o1

frac32 o2

frac32 o3

Parameters

int32 jump

Control Rate
int32_t a1;
int32_t b1;
int32_t c1;
int32_t d1;

int32_t a2;
int32_t b2;
int32_t c2;
int32_t d2;

int32_t x;
int32_t y;

int32_t selectbase;
int32_t select1;
int32_t select2;
selectbase = ((inlet_s >> 25));
select1 = (selectbase * param_jump) & 3;
select2 = ((selectbase + 1) * param_jump) & 3;

switch (int(select1) > 0 ? select1 : 0) {
case 0:
  a1 = inlet_i0, b1 = inlet_i1, c1 = inlet_i2, d1 = inlet_i3;
  break;
case 1:
  a1 = inlet_i1, b1 = inlet_i2, c1 = inlet_i3, d1 = inlet_i0;
  break;
case 2:
  a1 = inlet_i2, b1 = inlet_i3, c1 = inlet_i0, d1 = inlet_i1;
  break;
case 3:
  a1 = inlet_i3, b1 = inlet_i0, c1 = inlet_i1, d1 = inlet_i2;
  break;
default:
  a1 = inlet_i0, b1 = inlet_i1, c1 = inlet_i2, d1 = inlet_i3;
  break;
}

switch (int(select2) > 0 ? select2 : 0) {
case 0:
  a2 = inlet_i0, b2 = inlet_i1, c2 = inlet_i2, d2 = inlet_i3;
  break;
case 1:
  a2 = inlet_i1, b2 = inlet_i2, c2 = inlet_i3, d2 = inlet_i0;
  break;
case 2:
  a2 = inlet_i2, b2 = inlet_i3, c2 = inlet_i0, d2 = inlet_i1;
  break;
case 3:
  a2 = inlet_i3, b2 = inlet_i0, c2 = inlet_i1, d2 = inlet_i2;
  break;

default:
  a2 = inlet_i0, b2 = inlet_i1, c2 = inlet_i2, d2 = inlet_i3;
  break;
}

x = inlet_s - ((inlet_s >> 25) << 25);
y = (1 << 25) - x;

outlet_o0 = ___SMMUL(y << 3, a1 << 4) + ___SMMUL(x << 3, a2 << 4);
outlet_o1 = ___SMMUL(y << 3, b1 << 4) + ___SMMUL(x << 3, b2 << 4);
outlet_o2 = ___SMMUL(y << 3, c1 << 4) + ___SMMUL(x << 3, c2 << 4);
outlet_o3 = ___SMMUL(y << 3, d1 << 4) + ___SMMUL(x << 3, d2 << 4);

Privacy

© 2024 Zrna Research