2023-03-28 14:52:51 +00:00
|
|
|
#include "SmoothEffect.h"
|
|
|
|
|
2023-07-11 21:28:54 +00:00
|
|
|
SmoothEffect::SmoothEffect() {}
|
2023-03-28 14:52:51 +00:00
|
|
|
|
|
|
|
SmoothEffect::~SmoothEffect() {}
|
|
|
|
|
2024-10-23 11:44:31 +00:00
|
|
|
OsciPoint SmoothEffect::apply(int index, OsciPoint input, const std::vector<std::atomic<double>>& values, double sampleRate) {
|
2024-08-26 17:09:29 +00:00
|
|
|
double weight = juce::jmax(values[0].load(), 0.00001);
|
2023-07-11 21:28:54 +00:00
|
|
|
weight *= 0.95;
|
2023-07-14 14:34:24 +00:00
|
|
|
double strength = 10;
|
2023-07-11 21:28:54 +00:00
|
|
|
weight = std::log(strength * weight + 1) / std::log(strength + 1);
|
2023-07-13 19:11:24 +00:00
|
|
|
// TODO: This doesn't consider the sample rate!
|
2024-02-12 20:34:00 +00:00
|
|
|
avg = weight * avg + (1 - weight) * input;
|
|
|
|
|
|
|
|
return avg;
|
2023-03-28 14:52:51 +00:00
|
|
|
}
|