frac32 pitch
int32 notes
frac32 note
frac32.s.map key
int32 notes
frac32.u.map use
frac32.u.map interval
int32.label use
int32.label interval
int32.label key
int array[64];
int i;
int j;
int32_t temp[64];
int32_t tamp[64];
int8_t count;
int32_t postnotes;
int32_t postuse;
int32_t postinterval;
int32_t use;
int32_t interval;
int32_t key;
use = ___SMMUL(param_use << 3, param_notes << 2);
interval = ___SMMUL(param_interval << 3, param_notes << 2);
key = ___SMMUL(param_key << 3, param_notes << 2) * interval;
key = (key) - (((key) / param_notes) * param_notes);
key = key >= 0 ? key : param_notes + key - 1;
disp_use = use;
disp_interval = interval;
disp_key = key;
int32_t render;
render = param_use == postuse ? 0 : 1;
render += param_interval == postinterval ? 0 : 1;
render += param_notes == postnotes ? 0 : 1;
int32_t pitch;
pitch = (inlet_pitch >> 21) + key;
int32_t patch;
patch = pitch / param_notes;
pitch = pitch - (patch * param_notes);
pitch = pitch >= 0 ? pitch : param_notes - 1 + pitch;
if (render > 0) {
for (i = 0; i < (use); i++) {
array[i] = (i * interval) - (((i * interval) / param_notes) * param_notes);
}
}
if (!(render > 0)) {
for (j = 0; j < (use - 1); j++) {
if (array[j] > array[j + 1]) {
temp[j] = array[j + 1];
tamp[j] = array[j];
array[j + 1] = tamp[j];
array[j] = temp[j];
}
}
}
outlet_note = (((array[pitch * use / param_notes] << 21) * 12) / param_notes) +
((12 * patch) << 21) - ((key << 21) * 12 / param_notes);
postnotes = param_notes;
postuse = param_use;
postinterval = param_interval;
outlet_notes = param_notes;