3 ms·
A typically pattern is: float freq = getParameter(FILTER_FREQUENCY); float coeff; if (freq != mFreq) { coeff = calculateCoeffFromFrequency(freq); //
by spacechild1 3y ago
A typically pattern is:
float freq = getParameter(FILTER_FREQUENCY);
float coeff;
if (freq != mFreq) {
coeff = calculateCoeffFromFrequency(freq); // expensive
mFreq = freq;
mCoeff = coeff;
} else {
coeff = mCoeff; // use cached value
}
// use coeff
- bee_rider 3y agoCould you do some threshold-based comparison? What if freq is changed only a little tiny bit?
- spacechild1 3y agoI can certainly imagine cases where this would make sense.