fineknob

integer and fractional knobs, wrapping when either boundary is reached use DRJ's preset manager to save presets (or save all three knobs one by one manually...).
Author: Remco van der Most
License: BSD
Github: sss/ctrl/fineknob.axo

Inlets

None

Outlets

frac32.positive output

Parameters

frac32.u.map =value

frac32.s.map =mem2

frac32.s.map =mem1

Displays

int32.label int

int32.label frac

Declaration
int32_t mem;
int reset;
Init
reset = 1;
Control Rate
if (reset == 1) {

  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_int],
                     (param_mem >> 21) << 21, 0xFFFD);
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_frac],
                     (param_mem << 10) >> 4, 0xFFFD);
  //	mem=param_mem2;
  reset = 0;
}

if (param_frac == ((1 << 27) - 1)) {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_frac], 1,
                     0xFFFD);
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_int],
                     ((param_int >> 21) << 21) + (1 << 21), 0xFFFD);
  //	mem=param_mem2;
}
if (param_frac == 0) {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_frac],
                     ((1 << 27) - 2), 0xFFFD);
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_int],
                     ((param_int >> 21) << 21) - (1 << 21), 0xFFFD);
  //	mem=param_mem2;
}

PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_mem],
                   (param_frac >> 6) + ((param_int >> 21) << 21), 0xFFFD);
//	PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_mem2],mem,0xFFFD);
outlet_out = param_mem;

if (outlet_out > 0) {
  disp_int = outlet_out >> 21;
  disp_frac = (((((outlet_out - (disp_int << 21))) * 1000) >> 15) * 1000) >> 6;
} else {
  disp_int = (outlet_out >> 21) + 1;
  disp_frac = -(
      1000000 -
      ((((((outlet_out - ((disp_int - 1) << 21))) * 1000) >> 15) * 1000) >> 6));
}

Privacy

© 2024 Zrna Research