ser_swap_2

Stereo swappable serial routing switch
Author: Are Leistad
License: BSD
Github: drj/switch/ser_swap_switch.axo

IO Variants: 2


Variant: 1

Inlets

frac32buffer L input

frac32buffer R input

frac32buffer Device 1 L input

frac32buffer Device 1 R input

frac32buffer Device 2 L input

frac32buffer Device 2 R input

bool32 Swap device 1 and 2 order

Outlets

frac32buffer L output

frac32buffer R output

frac32buffer Device 1 L output

frac32buffer Device 1 R output

frac32buffer Device 2 L output

frac32buffer Device 2 R output

Parameters

frac32.u.map.squaregain Device 1 volume

frac32.u.map.squaregain Device 2 volume

Control Rate
int32_t j, outl, outr;
if (inlet_swap) {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 2
    outlet_o2l[j] = inlet_il[j];
    outlet_o2r[j] = inlet_ir[j];

    // Feed device 2 to device 1
    outlet_o1l[j] = ___SMMUL(inlet_i2l[j] << 3, param_dev2vol << 2);
    outlet_o1r[j] = ___SMMUL(inlet_i2r[j] << 3, param_dev2vol << 2);

    // Feed device 1 to the output
    outl = ___SMMUL(inlet_i1l[j] << 3, param_dev1vol << 2);
    outr = ___SMMUL(inlet_i1r[j] << 3, param_dev1vol << 2);

    outlet_ol[j] = __SSAT(outl, 28);
    outlet_or[j] = __SSAT(outr, 28);
  }
} else {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 1
    outlet_o1l[j] = inlet_il[j];
    outlet_o1r[j] = inlet_ir[j];

    // Feed device 1 to device 2
    outlet_o2l[j] = ___SMMUL(inlet_i1l[j] << 3, param_dev1vol << 2);
    outlet_o2r[j] = ___SMMUL(inlet_i1r[j] << 3, param_dev1vol << 2);

    // Feed device 2 to the output
    outl = ___SMMUL(inlet_i2l[j] << 3, param_dev2vol << 2);
    outr = ___SMMUL(inlet_i2r[j] << 3, param_dev2vol << 2);

    outlet_ol[j] = __SSAT(outl, 28);
    outlet_or[j] = __SSAT(outr, 28);
  }
}

Variant: 2

Inlets

bool32 Swap device 1 and 2 order

frac32buffer Input

frac32buffer Device 1 input

frac32buffer Device 2 input

Outlets

frac32buffer Output

frac32buffer Device 1 output

frac32buffer Device 2 output

Parameters

frac32.u.map.squaregain Device 1 volume

frac32.u.map.squaregain Device 2 volume

Control Rate
int32_t j, out;
if (inlet_swap) {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 2
    outlet_o2[j] = inlet_i[j];

    // Feed device 2 to device 1
    outlet_o1[j] = ___SMMUL(inlet_i2[j] << 3, param_dev2vol << 2);

    // Feed device 1 to the output
    out = ___SMMUL(inlet_i1[j] << 3, param_dev1vol << 2);

    outlet_o[j] = __SSAT(out, 28);
  }
} else {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 1
    outlet_o1[j] = inlet_i[j];

    // Feed device 1 to device 2
    outlet_o2[j] = ___SMMUL(inlet_i1[j] << 3, param_dev1vol << 2);

    // Feed device 2 to the output
    out = ___SMMUL(inlet_i2[j] << 3, param_dev2vol << 2);

    outlet_o[j] = __SSAT(out, 28);
  }
}

Privacy

© 2024 Zrna Research