36 for (
size_t i = 0; i <
length; ++i) {
37 float v = std::abs(samples[i]) * (1.0f/32768.0f);
38 peak = std::max(peak, v);
46 float riseFactor = 1.0f - std::exp(-
attackRate_ * dt);
49 float decayFactor = std::exp(-
decayRate_ * dt);
54 float outFactor = 1.0f - std::exp(-
outputRate_ * dt);
UISlider outputTimeSec("outputTimeSec",.17, 0, 2,.01)
MaxFadeTracker(float attackTimeSec, float decayTimeSec, float outputTimeSec, float sampleRate)
float operator()(const int16_t *samples, size_t length)
Process one 512-sample block; returns [0…1] with inertia.
void setAttackTime(float t)
void setOutputTime(float t)
void setDecayTime(float t)
UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)