hi there,
trying to use simd and read params/inputs for x4 osc, on 16 voices. here’s my actual code for a single param (freq offset):
// freq offset
{
const rack::simd::float_4 v0 = 0.0f;
const rack::simd::float_4 v1 = 1.0f;
const rack::simd::float_4 v10 = 10.0f;
const rack::simd::float_4 vMinFreq = kMinFreqOffset;
const rack::simd::float_4 vMaxFreq = kMaxFreqOffset;
rack::simd::float_4 paramKnob;
for (int oscIndex = 0; oscIndex < kNumOscs; oscIndex++) {
paramKnob[oscIndex] = params[FREQ_OFFSET_PARAM + oscIndex].getValue();
}
for (int voiceIndex = 0; voiceIndex < kMaxNumVoices; voiceIndex++) {
rack::simd::float_4 paramInput;
for (int oscIndex = 0; oscIndex < kNumOscs; oscIndex++) {
paramInput[oscIndex] = inputs[FREQ_OFFSET_INPUT + oscIndex].getPolyVoltage(voiceIndex);
}
rack::simd::float_4 value = paramKnob + paramInput / v10;
value = clamp(value, v0, v1);
value = rescale(value, v0, v1, vMinFreq, vMaxFreq);
mFreqOffset[voiceIndex] = value;
}
}
that’s the only code i have on process(), but it takes +1% of CPU (for a “single” pair param/input). this means that for 6-7 params, its +7 or more on CPU (in the extreme case, of course).
do you see any improvements (expect putting a control-rate settings, which id like to avoid)? i think the main problem is this:
paramInput[oscIndex] = inputs[FREQ_OFFSET_INPUT + oscIndex].getPolyVoltage(voiceIndex);
it will have lots of cache miss i guess; not sure how to process them consecutively and add them on _4 variable for params.
note: i need mod per voice, of course
thanks