wf_16Steps

For use with 16Steps(Sync) Conveniently packs DISCONTINUOUS 16 steps in a "audio rate output".
Author: Thierry Smashed Transistors
License: LGPL
Github: tiar/osc/wf16/wf_16Steps.axo

Inlets

bool32 update

Outlets

frac32buffer.bipolar wf16

bool32 update

Parameters

frac32.s.mapvsl s0

frac32.s.mapvsl e0

frac32.s.mapvsl s1

frac32.s.mapvsl e1

frac32.s.mapvsl s2

frac32.s.mapvsl e2

frac32.s.mapvsl s3

frac32.s.mapvsl e3

frac32.s.mapvsl s4

frac32.s.mapvsl e4

frac32.s.mapvsl s5

frac32.s.mapvsl e5

frac32.s.mapvsl s6

frac32.s.mapvsl e6

frac32.s.mapvsl s7

frac32.s.mapvsl e7

frac32.s.mapvsl s8

frac32.s.mapvsl e8

frac32.s.mapvsl s9

frac32.s.mapvsl e9

frac32.s.mapvsl s10

frac32.s.mapvsl e10

frac32.s.mapvsl s11

frac32.s.mapvsl e11

frac32.s.mapvsl s12

frac32.s.mapvsl e12

frac32.s.mapvsl s13

frac32.s.mapvsl e13

frac32.s.mapvsl s14

frac32.s.mapvsl e14

frac32.s.mapvsl s15

frac32.s.mapvsl e15

Declaration
static const int16_t c(const int32_t x) {
  if (x > 0x07FFFFFF)
    return 32767;
  else
    return (int16_t)(x >> 12);
};
int16_t v[32];
bool firstTime;
Init
firstTime = true;
for (int i = 0; i < 32; i++)
  v[i] = 0;
Control Rate
// Note: send a trig on first exec or on param change.
if (firstTime || inlet_update) {
  firstTime = false;
  // 12 = 27 - 15 : q27 -> q15
  v[0] = c(param_s0);
  v[1] = c(param_e0);

  v[2] = c(param_s1);
  v[3] = c(param_e1);

  v[4] = c(param_s2);
  v[5] = c(param_e2);

  v[6] = c(param_s3);
  v[7] = c(param_e3);

  v[8] = c(param_s4);
  v[9] = c(param_e4);

  v[10] = c(param_s5);
  v[11] = c(param_e5);

  v[12] = c(param_s6);
  v[13] = c(param_e6);

  v[14] = c(param_s7);
  v[15] = c(param_e7);

  v[16] = c(param_s8);
  v[17] = c(param_e8);

  v[18] = c(param_s9);
  v[19] = c(param_e9);

  v[20] = c(param_s10);
  v[21] = c(param_e10);

  v[22] = c(param_s11);
  v[23] = c(param_e11);

  v[24] = c(param_s12);
  v[25] = c(param_e12);

  v[26] = c(param_s13);
  v[27] = c(param_e13);

  v[28] = c(param_s14);
  v[29] = c(param_e14);

  v[30] = c(param_s15);
  v[31] = c(param_e15);
  outlet_update = true;
} else {
  outlet_update = false;
}

int16_t *xStartEnd = (int16_t *)outlet_wf16;
for (int i = 0; i < 32; i++)
  xStartEnd[i] = v[i];

Privacy

© 2024 Zrna Research