kopia lustrzana https://github.com/jameshball/osci-render
Rename sliders and variables appropriately
rodzic
7d3a1f491b
commit
4874f3ff1f
|
@ -121,8 +121,8 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() {
|
|||
}
|
||||
));
|
||||
toggleableEffects.push_back(custom);
|
||||
toggleableEffects.push_back(traceMax);
|
||||
toggleableEffects.push_back(traceMin);
|
||||
toggleableEffects.push_back(traceLength);
|
||||
toggleableEffects.push_back(traceStart);
|
||||
|
||||
for (int i = 0; i < toggleableEffects.size(); i++) {
|
||||
auto effect = toggleableEffects[i];
|
||||
|
|
|
@ -72,20 +72,20 @@ public:
|
|||
)
|
||||
);
|
||||
|
||||
std::shared_ptr<Effect> traceMax = std::make_shared<Effect>(
|
||||
std::shared_ptr<Effect> traceLength = std::make_shared<Effect>(
|
||||
new EffectParameter(
|
||||
"Trace max",
|
||||
"Defines the maximum proportion of the image that is drawn before skipping to the next frame. This has the effect of 'tracing' out the image from a single dot when animated. By default, we draw until the end of the frame, so this value is 1.0.",
|
||||
"traceMax",
|
||||
VERSION_HINT, 0.75, 0.0, 1.0
|
||||
"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
|
||||
)
|
||||
);
|
||||
std::shared_ptr<Effect> traceMin = std::make_shared<Effect>(
|
||||
std::shared_ptr<Effect> traceStart = std::make_shared<Effect>(
|
||||
new EffectParameter(
|
||||
"Trace min",
|
||||
"Defines the proportion of the image that drawing starts from. 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.",
|
||||
"traceMin",
|
||||
VERSION_HINT, 0.25, 0.0, 1.0
|
||||
"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
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "../PluginProcessor.h"
|
||||
|
||||
ShapeVoice::ShapeVoice(OscirenderAudioProcessor& p) : audioProcessor(p) {
|
||||
actualTraceMin = audioProcessor.traceMin->getValue();
|
||||
actualTraceMax = audioProcessor.traceMax->getValue();
|
||||
actualTraceStart = audioProcessor.traceStart->getValue();
|
||||
actualTraceLength = audioProcessor.traceLength->getValue();
|
||||
}
|
||||
|
||||
bool ShapeVoice::canPlaySound(juce::SynthesiserSound* sound) {
|
||||
|
@ -86,13 +86,13 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
|||
}
|
||||
|
||||
for (auto sample = startSample; sample < startSample + numSamples; ++sample) {
|
||||
bool traceMinEnabled = audioProcessor.traceMin->enabled->getBoolValue();
|
||||
bool traceMaxEnabled = audioProcessor.traceMax->enabled->getBoolValue();
|
||||
bool traceStartEnabled = audioProcessor.traceStart->enabled->getBoolValue();
|
||||
bool traceLengthEnabled = audioProcessor.traceLength->enabled->getBoolValue();
|
||||
|
||||
// update length increment
|
||||
double traceMax = traceMaxEnabled ? actualTraceMax : 1.0;
|
||||
double traceMin = traceMinEnabled ? actualTraceMin : 0.0;
|
||||
double proportionalLength = (traceMax) * frameLength;
|
||||
double traceLen = traceLengthEnabled ? actualTraceLength : 1.0;
|
||||
double traceMin = traceStartEnabled ? actualTraceStart : 0.0;
|
||||
double proportionalLength = traceLen * frameLength;
|
||||
lengthIncrement = juce::jmax(proportionalLength / (audioProcessor.currentSampleRate / actualFrequency), MIN_LENGTH_INCREMENT);
|
||||
|
||||
OsciPoint channels;
|
||||
|
@ -147,14 +147,14 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
|||
outputBuffer.addSample(0, sample, x * gain);
|
||||
}
|
||||
|
||||
double traceMinValue = audioProcessor.traceMin->getActualValue();
|
||||
double traceMaxValue = audioProcessor.traceMax->getActualValue();
|
||||
traceMaxValue = traceMaxEnabled ? traceMaxValue : 1.0;
|
||||
traceMinValue = traceMinEnabled ? traceMinValue : 0.0;
|
||||
actualTraceMax = traceMaxValue;
|
||||
actualTraceMin = traceMinValue;
|
||||
if (actualTraceMin < 0) {
|
||||
actualTraceMin = 0;
|
||||
double traceStartValue = audioProcessor.traceStart->getActualValue();
|
||||
double traceLengthValue = audioProcessor.traceLength->getActualValue();
|
||||
traceLengthValue = traceLengthEnabled ? traceLengthValue : 1.0;
|
||||
traceStartValue = traceStartEnabled ? traceStartValue : 0.0;
|
||||
actualTraceLength = traceLengthValue;
|
||||
actualTraceStart = traceStartValue;
|
||||
if (actualTraceStart < 0) {
|
||||
actualTraceStart = 0;
|
||||
}
|
||||
|
||||
if (!renderingSample) {
|
||||
|
@ -163,8 +163,8 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
|||
|
||||
double drawnFrameLength = frameLength;
|
||||
bool willLoopOver = false;
|
||||
if (traceMaxEnabled || traceMinEnabled) {
|
||||
drawnFrameLength *= actualTraceMax + actualTraceMin;
|
||||
if (traceLengthEnabled || traceStartEnabled) {
|
||||
drawnFrameLength *= actualTraceLength + actualTraceStart;
|
||||
}
|
||||
|
||||
if (!renderingSample && frameDrawn >= drawnFrameLength) {
|
||||
|
@ -178,11 +178,11 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
|||
|
||||
// TODO: updateFrame already iterates over all the shapes,
|
||||
// so we can improve performance by calculating frameDrawn
|
||||
// and shapeDrawn directly. frameDrawn is simply actualTraceMin * frameLength
|
||||
// and shapeDrawn directly. frameDrawn is simply actualTraceStart * frameLength
|
||||
// but shapeDrawn is the amount of the current shape that has been drawn so
|
||||
// we need to iterate over all the shapes to calculate it.
|
||||
if (traceMinEnabled) {
|
||||
while (frameDrawn < actualTraceMin * frameLength) {
|
||||
if (traceStartEnabled) {
|
||||
while (frameDrawn < actualTraceStart * frameLength) {
|
||||
incrementShapeDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ private:
|
|||
OscirenderAudioProcessor& audioProcessor;
|
||||
std::vector<std::unique_ptr<Shape>> frame;
|
||||
std::atomic<ShapeSound*> sound = nullptr;
|
||||
double actualTraceMin;
|
||||
double actualTraceMax;
|
||||
double actualTraceStart;
|
||||
double actualTraceLength;
|
||||
|
||||
double frameLength = 0.0;
|
||||
int currentShape = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue