Make slider smoothing more configurable, and configure trace sliders to be much faster

pull/277/head
DJLevel3 2025-01-17 09:59:33 -05:00
rodzic 2099b8591a
commit ff0b69cc6d
4 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -77,7 +77,7 @@ public:
"Trace Length", "Trace Length",
"Defines how much of the frame is drawn per cycle. This has the effect of 'tracing' out the image from a single dot when animated. By default, we draw the whole frame, corresponding to a value of 1.0.", "Defines how much of the frame is drawn per cycle. This has the effect of 'tracing' out the image from a single dot when animated. By default, we draw the whole frame, corresponding to a value of 1.0.",
"traceLength", "traceLength",
VERSION_HINT, 1.0, 0.0, 1.0 VERSION_HINT, 1.0, 0.0, 1.0, 0.01f, 0.005
) )
); );
std::shared_ptr<Effect> traceStart = std::make_shared<Effect>( std::shared_ptr<Effect> traceStart = std::make_shared<Effect>(
@ -85,7 +85,7 @@ public:
"Trace Start", "Trace Start",
"Defines how far into the frame the drawing is started at. This has the effect of 'tracing' out the image from a single dot when animated. By default, we start drawing from the beginning of the frame, so this value is 0.0.", "Defines how far into the frame the drawing is started at. This has the effect of 'tracing' out the image from a single dot when animated. By default, we start drawing from the beginning of the frame, so this value is 0.0.",
"traceStart", "traceStart",
VERSION_HINT, 0.0, 0.0, 1.0 VERSION_HINT, 0.0, 0.0, 1.0, 0.01f, 0.005
) )
); );

Wyświetl plik

@ -69,7 +69,7 @@ void Effect::animateValues(double volume) {
actualValues[i] = ((float)rand() / RAND_MAX) * (maxValue - minValue) + minValue; actualValues[i] = ((float)rand() / RAND_MAX) * (maxValue - minValue) + minValue;
break; break;
default: default:
double weight = parameter->smoothValueChange ? SMOOTHING_SPEED_CONSTANT : 1.0; double weight = (parameter->smoothValueChange > 1.0 || parameter->smoothValueChange < SMOOTHING_SPEED_MIN) ? (1.0) : (parameter->smoothValueChange.load());
double newValue; double newValue;
if (parameter->sidechain != nullptr && parameter->sidechain->getBoolValue()) { if (parameter->sidechain != nullptr && parameter->sidechain->getBoolValue()) {
newValue = volume * (maxValue - minValue) + minValue; newValue = volume * (maxValue - minValue) + minValue;

Wyświetl plik

@ -5,8 +5,6 @@
#include "EffectParameter.h" #include "EffectParameter.h"
#include "BooleanParameter.h" #include "BooleanParameter.h"
#define SMOOTHING_SPEED_CONSTANT 0.0005
typedef std::function<OsciPoint(int index, OsciPoint input, const std::vector<std::atomic<double>>& values, double sampleRate)> EffectApplicationType; typedef std::function<OsciPoint(int index, OsciPoint input, const std::vector<std::atomic<double>>& values, double sampleRate)> EffectApplicationType;
class Effect { class Effect {

Wyświetl plik

@ -3,6 +3,9 @@
#include <JuceHeader.h> #include <JuceHeader.h>
#include "BooleanParameter.h" #include "BooleanParameter.h"
#define SMOOTHING_SPEED_CONSTANT 0.0005
#define SMOOTHING_SPEED_MIN 0.0001
class FloatParameter : public juce::AudioProcessorParameterWithID { class FloatParameter : public juce::AudioProcessorParameterWithID {
public: public:
std::atomic<float> min = 0.0; std::atomic<float> min = 0.0;
@ -326,7 +329,7 @@ public:
class EffectParameter : public FloatParameter { class EffectParameter : public FloatParameter {
public: public:
std::atomic<bool> smoothValueChange = true; std::atomic<double> smoothValueChange = SMOOTHING_SPEED_CONSTANT;
LfoTypeParameter* lfo = new LfoTypeParameter(name + " LFO", paramID + "Lfo", getVersionHint(), 1); LfoTypeParameter* lfo = new LfoTypeParameter(name + " LFO", paramID + "Lfo", getVersionHint(), 1);
FloatParameter* lfoRate = new FloatParameter(name + " LFO Rate", paramID + "LfoRate", getVersionHint(), 1.0f, 0.0f, 10000.0f, 0.01f, "Hz"); FloatParameter* lfoRate = new FloatParameter(name + " LFO Rate", paramID + "LfoRate", getVersionHint(), 1.0f, 0.0f, 10000.0f, 0.01f, "Hz");
BooleanParameter* sidechain = new BooleanParameter(name + " Sidechain Enabled", paramID + "Sidechain", getVersionHint(), false, "Toggles " + name + " Sidechain."); BooleanParameter* sidechain = new BooleanParameter(name + " Sidechain Enabled", paramID + "Sidechain", getVersionHint(), false, "Toggles " + name + " Sidechain.");
@ -399,5 +402,5 @@ public:
} }
} }
EffectParameter(juce::String name, juce::String description, juce::String id, int versionHint, float value, float min, float max, float step = 0.01, bool smoothValueChange = true) : FloatParameter(name, id, versionHint, value, min, max, step), smoothValueChange(smoothValueChange), description(description) {} EffectParameter(juce::String name, juce::String description, juce::String id, int versionHint, float value, float min, float max, float step = 0.01, double smoothValueChange = SMOOTHING_SPEED_CONSTANT) : FloatParameter(name, id, versionHint, value, min, max, step), smoothValueChange(smoothValueChange), description(description) {}
}; };