multilist

control several lists with two parameters set the list size with the selectors
Author: Remco van der Most
License: BSD
Github: sss/ctrl/multilist.axo

Inlets

None

Outlets

int32 listA

int32 listB

int32 listC

int32 listD

int32 listE

int32 listF

int32 listG

int32 listH

Parameters

frac32.u.map.gain select

frac32.s.map fine

int32 listA

int32 listB

int32 listC

int32 listD

int32 listE

int32 listF

int32 listG

int32 listH

Displays

int32.label A___

int32.label B___

int32.label C___

int32.label D___

int32.label E___

int32.label F___

int32.label G___

int32.label H___

bool32 maxed

Declaration
uint64_t remainder[8];
int32_t prev;
int32_t listA;
int32_t listB;
int32_t listC;
int32_t listD;
int32_t listE;
int32_t listF;
int32_t listG;
int32_t listH;
Control Rate
int32_t all;
all = param_listA + param_listB + param_listC + param_listD + param_listE +
      param_listF + param_listG + param_listH + param_select + param_fine;

if (!(all == prev)) {
  int64_t length = param_listA * param_listB * param_listC;
  length = length * param_listD * param_listE * param_listF * param_listG *
           param_listH;
  disp_maxed = length >> 31;
  int64_t cv = param_select;
  int64_t CV = (param_fine >> 15);
  cv += CV;
  cv = cv > 0 ? cv : 0;
  cv = cv * length >> 31;
  cv = cv >= length ? length - 1 : cv;

  remainder[0] = cv / param_listA;
  listA = cv - remainder[0] * param_listA;

  remainder[1] = remainder[0] / param_listB;
  listB = remainder[0] - remainder[1] * param_listB;

  remainder[2] = remainder[1] / param_listC;
  listC = remainder[1] - remainder[2] * param_listC;

  remainder[3] = remainder[2] / param_listD;
  listD = remainder[2] - remainder[3] * param_listD;

  remainder[4] = remainder[3] / param_listE;
  listE = remainder[3] - remainder[4] * param_listE;

  remainder[5] = remainder[4] / param_listF;
  listF = remainder[4] - remainder[5] * param_listF;

  remainder[6] = remainder[5] / param_listG;
  listG = remainder[5] - remainder[6] * param_listG;

  remainder[7] = remainder[6] / param_listH;
  listH = remainder[6] - remainder[7] * param_listH;
}

disp_A___ = outlet_listA;
disp_B___ = outlet_listB;
disp_C___ = outlet_listC;
disp_D___ = outlet_listD;
disp_E___ = outlet_listE;
disp_F___ = outlet_listF;
disp_G___ = outlet_listG;
disp_H___ = outlet_listH;
outlet_listA = listA;
outlet_listB = listB;
outlet_listC = listC;
outlet_listD = listD;
outlet_listE = listE;
outlet_listF = listF;
outlet_listG = listG;
outlet_listH = listH;

prev = all;

Privacy

© 2024 Zrna Research