sendMatrix

control send module, fractional type to be used with my receive module and a 32b (sd)ram module (enter it's name in the box!) you can use the internal knob and control it by midi-CC or connect an external signal to the CV inlet (eg analogue controls). These last ones will update the internal CV knob like the "hook" control module. The "select" selector selects which output of the receiving module will be controlled The "destiny" selector selects which receiver is being controlled. These controls can be controlled externally by (analogue) button-presses to step through the menu. extra inlets: "update" updates the knob to the table value. eg when you load a new table (double trigger/press is needed though!) "maxdestinations" should be the same as the amount of receiving modules you are using. The less receiving modules, the more presets you can make. "preset" shifts the table-write/readout to select a new part to save/load presets.
Author: Remco van der Most
License: BSD
Github: sss/patch/sendMatrix.axo

Inlets

bool32 update

bool32 selectUp

bool32 selectDown

bool32 destinationUp

bool32 destinationDown

int32 maxdestinations

int32 preset

frac32 CV

Outlets

None

Parameters

frac32.s.map CV

int32 select

int32 destiny

Attributes

objref table

Declaration
int32_t nhooked;
int32_t param_cache;
int32_t CV;
int32_t prevsel;
int32_t select;
uint32_t count;
int32_t selact;
int32_t destiny;
int32_t destyny;
int32_t prevCV;
int utrig;
int ytrig;
int32_t preset;
int sUtrig;
int sDtrig;
int dUtrig;
int dDtrig;
Init
utrig = 0;
nhooked = 4;
Control Rate
if (nhooked) {
  CV = param_CV;
  if (param_CV > inlet_CV) {
    nhooked |= 1;
    if (nhooked == 7) {
      nhooked = 0;
      param_cache = param_CV;
    }
  } else {
    nhooked |= 2;
    if (nhooked == 7) {
      nhooked = 0;
      param_cache = param_CV;
    }
  }
} else {
  CV = inlet_CV;
  if (param_cache != param_CV)
    nhooked = 4;
  else
    PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_CV], inlet_CV,
                       0xFFFD);
  param_cache = inlet_CV;
}

if ((inlet_selectUp > 0) && (!(sUtrig == 1))) {
  sUtrig = 1;
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_select],
                     (selact + 1) & 7, 0xFFFD);
} else if (!(inlet_selectUp > 0)) {
  sUtrig = 0;
}

if ((inlet_selectDown > 0) && (!(sDtrig == 1))) {
  sDtrig = 1;
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_select],
                     (selact - 1) & 7, 0xFFFD);
} else if (!(inlet_selectDown > 0)) {
  sDtrig = 0;
}

if ((inlet_destinationUp > 0) && (!(dUtrig == 1))) {
  dUtrig = 1;
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_destiny],
                     (destiny + 1) - ((destiny + 1) / inlet_maxdestinations) *
                                         inlet_maxdestinations,
                     0xFFFD);
} else if (!(inlet_destinationUp > 0)) {
  dUtrig = 0;
}

if ((inlet_destinationDown > 0) && (!(dDtrig == 1))) {
  dDtrig = 1;
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_destiny],
                     (destiny - 1) - ((destiny - 1) / inlet_maxdestinations) *
                                         inlet_maxdestinations,
                     0xFFFD);
} else if (!(inlet_destinationDown > 0)) {
  dDtrig = 0;
}

preset = inlet_preset * 8 * inlet_maxdestinations;
destyny = param_destiny > inlet_maxdestinations ? inlet_maxdestinations
                                                : param_destiny;
destyny = destyny * 8;
if ((!(param_select + param_destiny == prevsel)) ||
    ((inlet_update > 0) && (!(utrig == 1)))) {
  utrig = 1;

  switch (param_select > 0 ? param_select : 0) {
  case 0:
    select = attr_table.array[__USAT(destyny + preset, attr_table.LENGTHPOW)]
             << attr_table.GAIN;
    break;
  case 1:
    select =
        attr_table.array[__USAT(destyny + 1 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 2:
    select =
        attr_table.array[__USAT(destyny + 2 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 3:
    select =
        attr_table.array[__USAT(destyny + 3 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 4:
    select =
        attr_table.array[__USAT(destyny + 4 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 5:
    select =
        attr_table.array[__USAT(destyny + 5 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 6:
    select =
        attr_table.array[__USAT(destyny + 6 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  case 7:
    select =
        attr_table.array[__USAT(destyny + 7 + preset, attr_table.LENGTHPOW)]
        << attr_table.GAIN;
    break;
  }
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_CV], select,
                     0xFFFD);
}
if (!(prevCV == CV)) {
  switch (param_select > 0 ? param_select : 0) {
  case 0:
    attr_table.array[destyny + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 1:
    attr_table.array[destyny + 1 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 2:
    attr_table.array[destyny + 2 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 3:
    attr_table.array[destyny + 3 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 4:
    attr_table.array[destyny + 4 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 5:
    attr_table.array[destyny + 5 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 6:
    attr_table.array[destyny + 6 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  case 7:
    attr_table.array[destyny + 7 + preset] = __SSAT(CV, 28) >> attr_table.GAIN;
    break;
  }
}
if (!(inlet_update > 0)) {
  utrig = 0;
}
prevsel = param_select + param_destiny;
prevCV = CV;
selact = param_select;
destiny = param_destiny;

Privacy

© 2024 Zrna Research