SeaBoardSendMixer6OutSHScale

6 output send K-rate mixer for Seaboard with latch function and rescale of remaining "space" on the exit value.
Author: Albert van der Zee
License: GPL
Github: azaxo/ctrl/SeaBoardSendMixer6OutSHScale.axo

Inlets

frac32 In

frac32.positive GainTimbre

frac32.positive GainColor

frac32.positive GainFrequency

frac32.positive GainReso

frac32.positive GainVCA

frac32.positive GainLFO

bool32.rising Trigger

Outlets

frac32.bipolar OutTimbre

frac32.bipolar OutColor

frac32.bipolar OutFrequency

frac32.bipolar OutReso

frac32.bipolar OutVCA

frac32.bipolar OutLFO

Declaration
int ntrig;
int latch;
float speedup;
float speeddown;
float rangeup;
float rangedown;
float out;
Control Rate
if ((inlet_Trigger > 0) && !ntrig) {
  latch = inlet_In;
  ntrig = 1;
  rangeup = (0x07FFFFFF - latch);
  rangedown = (latch - 0);
  speedup =
      (float)(134217728 / (rangeup + 1)); // add one to prevent divide by zero
  speeddown =
      (float)(134217728 / (rangedown + 1)); // add one to prevent divide by zero
}
if (!(inlet_Trigger > 0)) {
  ntrig = 0;
}

float reduced = inlet_In - latch;
if (reduced > 0) {
  out = (float)(reduced * speedup);
}
if (!(reduced > 0)) {
  out = (float)(reduced * speeddown);
}

outlet_OutTimbre = ___SMMUL(out, inlet_GainTimbre) << 5;
outlet_OutColor = ___SMMUL(out, inlet_GainColor) << 5;
outlet_OutFrequency = ___SMMUL(out, inlet_GainFrequency) << 5;
outlet_OutReso = ___SMMUL(out, inlet_GainReso) << 5;
outlet_OutVCA = ___SMMUL(out, inlet_GainVCA) << 5;
outlet_OutLFO = ___SMMUL(out, inlet_GainLFO) << 5;

Privacy

© 2024 Zrna Research