ser_par_2

Stereo serial/parallel routing switch
Author: Are Leistad
License: BSD
Github: drj/switch/ser_par_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 False/true => serial/parallel

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_parallel) {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 1 and 2
    outlet_o1l[j] = inlet_il[j];
    outlet_o1r[j] = inlet_ir[j];
    outlet_o2l[j] = inlet_il[j];
    outlet_o2r[j] = inlet_ir[j];

    // Mix the outputs from device 1 and 2
    outl = ___SMMUL(inlet_i1l[j] << 3, param_dev1vol << 2);
    outl = ___SMMLA(inlet_i2l[j] << 3, param_dev2vol << 2, outl);
    outr = ___SMMUL(inlet_i1r[j] << 3, param_dev1vol << 2);
    outr = ___SMMLA(inlet_i2r[j] << 3, param_dev2vol << 2, outr);

    // Feed the mix to the output
    outlet_ol[j] = __SSAT(outl, 28);
    outlet_or[j] = __SSAT(outr, 28);
  }
} else // serial
{
  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 device2 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

frac32buffer Input

frac32buffer Device 1 input

frac32buffer Device 2 input

bool32 False/true => serial/parallel

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_parallel) {
  for (j = 0; j < BUFSIZE; ++j) {
    // Feed the input to device 1 and 2
    outlet_o1[j] = inlet_i[j];
    outlet_o2[j] = inlet_i[j];

    // Mix the outputs from device 1 and 2
    out = ___SMMUL(inlet_i1[j] << 3, param_dev1vol << 2);
    out = ___SMMLA(inlet_i2[j] << 3, param_dev2vol << 2, out);

    // Feed the mix to the output
    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 device2 to the output
    out = ___SMMUL(inlet_i2[j] << 3, param_dev2vol << 2);

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

Privacy

© 2024 Zrna Research