kopia lustrzana https://github.com/jameshball/osci-render
Make slider smoothing more configurable, and configure trace sliders to be much faster
rodzic
2099b8591a
commit
ff0b69cc6d
|
@ -77,7 +77,7 @@ public:
|
|||
"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.",
|
||||
"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>(
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
"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.",
|
||||
"traceStart",
|
||||
VERSION_HINT, 0.0, 0.0, 1.0
|
||||
VERSION_HINT, 0.0, 0.0, 1.0, 0.01f, 0.005
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ void Effect::animateValues(double volume) {
|
|||
actualValues[i] = ((float)rand() / RAND_MAX) * (maxValue - minValue) + minValue;
|
||||
break;
|
||||
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;
|
||||
if (parameter->sidechain != nullptr && parameter->sidechain->getBoolValue()) {
|
||||
newValue = volume * (maxValue - minValue) + minValue;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include "EffectParameter.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;
|
||||
|
||||
class Effect {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <JuceHeader.h>
|
||||
#include "BooleanParameter.h"
|
||||
|
||||
#define SMOOTHING_SPEED_CONSTANT 0.0005
|
||||
#define SMOOTHING_SPEED_MIN 0.0001
|
||||
|
||||
class FloatParameter : public juce::AudioProcessorParameterWithID {
|
||||
public:
|
||||
std::atomic<float> min = 0.0;
|
||||
|
@ -326,7 +329,7 @@ public:
|
|||
|
||||
class EffectParameter : public FloatParameter {
|
||||
public:
|
||||
std::atomic<bool> smoothValueChange = true;
|
||||
std::atomic<double> smoothValueChange = SMOOTHING_SPEED_CONSTANT;
|
||||
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");
|
||||
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) {}
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue