kopia lustrzana https://github.com/jameshball/osci-render
Add basic tooltips to effect component
rodzic
a7e7ea8122
commit
f310e98d6b
|
@ -58,6 +58,8 @@ private:
|
|||
juce::StretchableLayoutManager layout;
|
||||
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
||||
|
||||
juce::TooltipWindow tooltipWindow{this};
|
||||
|
||||
std::atomic<bool> updatingDocumentsWithParserLock = false;
|
||||
|
||||
void codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
||||
|
|
|
@ -36,46 +36,56 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
|||
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<BitCrushEffect>(),
|
||||
new EffectParameter("Bit Crush", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Bit Crush", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"bitCrush"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<BulgeEffect>(),
|
||||
new EffectParameter("Bulge", "bulge", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Bulge", "bulge", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"bulge"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<RotateEffect>(),
|
||||
new EffectParameter("2D Rotate", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("2D Rotate", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"2DRotate"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<VectorCancellingEffect>(),
|
||||
new EffectParameter("Vector Cancelling", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Vector Cancelling", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"vectorCancelling"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<DistortEffect>(false),
|
||||
new EffectParameter("Distort X", "distortX", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Distort X", "distortX", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"distortX"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<DistortEffect>(true),
|
||||
new EffectParameter("Distort Y", "distortY", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Distort Y", "distortY", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"distortY"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
input.x += values[0];
|
||||
input.y += values[1];
|
||||
return input;
|
||||
}, std::vector<EffectParameter*>{new EffectParameter("Translate X", "translateX", VERSION_HINT, 0.0, -1.0, 1.0), new EffectParameter("Translate Y", "translateY", VERSION_HINT, 0.0, -1.0, 1.0)}
|
||||
}, std::vector<EffectParameter*>{new EffectParameter("Translate X", "translateX", VERSION_HINT, 0.0, -1.0, 1.0), new EffectParameter("Translate Y", "translateY", VERSION_HINT, 0.0, -1.0, 1.0)},
|
||||
"translate"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<SmoothEffect>(),
|
||||
new EffectParameter("Smoothing", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Smoothing", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"smoothing"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
wobbleEffect,
|
||||
new EffectParameter("Wobble", "wobble", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
new EffectParameter("Wobble", "wobble", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"wobble"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
delayEffect,
|
||||
std::vector<EffectParameter*>{new EffectParameter("Delay Decay", "delayDecay", VERSION_HINT, 0.0, 0.0, 1.0), new EffectParameter("Delay Length", "delayLength", VERSION_HINT, 0.5, 0.0, 1.0)}
|
||||
std::vector<EffectParameter*>{new EffectParameter("Delay Decay", "delayDecay", VERSION_HINT, 0.0, 0.0, 1.0), new EffectParameter("Delay Length", "delayLength", VERSION_HINT, 0.5, 0.0, 1.0)},
|
||||
"delay"
|
||||
));
|
||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||
perspectiveEffect,
|
||||
|
@ -86,7 +96,8 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
|||
new EffectParameter("Rotate X", "perspectiveRotateX", VERSION_HINT, 1.0, -1.0, 1.0),
|
||||
new EffectParameter("Rotate Y", "perspectiveRotateY", VERSION_HINT, 1.0, -1.0, 1.0),
|
||||
new EffectParameter("Rotate Z", "perspectiveRotateZ", VERSION_HINT, 0.0, -1.0, 1.0),
|
||||
}
|
||||
},
|
||||
"perspective"
|
||||
));
|
||||
toggleableEffects.push_back(traceMax);
|
||||
toggleableEffects.push_back(traceMin);
|
||||
|
@ -263,7 +274,8 @@ void OscirenderAudioProcessor::addLuaSlider() {
|
|||
|
||||
luaEffects.push_back(std::make_shared<Effect>(
|
||||
std::make_shared<LuaEffect>(sliderName, *this),
|
||||
new EffectParameter("Lua " + sliderName, "lua" + sliderName, VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false)
|
||||
new EffectParameter("Lua " + sliderName, "lua" + sliderName, VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false),
|
||||
"lua" + sliderName
|
||||
));
|
||||
|
||||
auto& effect = luaEffects.back();
|
||||
|
|
|
@ -80,21 +80,24 @@ public:
|
|||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
frequency = values[0];
|
||||
return input;
|
||||
}, new EffectParameter("Frequency", "frequency", VERSION_HINT, 440.0, 0.0, 12000.0, 0.1)
|
||||
}, new EffectParameter("Frequency", "frequency", VERSION_HINT, 440.0, 0.0, 12000.0, 0.1),
|
||||
"Controls how many times per second the image is drawn, thereby controlling the pitch of the sound. Lower frequencies result in more-accurately drawn images, but more flickering, and vice versa."
|
||||
);
|
||||
|
||||
std::shared_ptr<Effect> volumeEffect = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
volume = values[0];
|
||||
return input;
|
||||
}, new EffectParameter("Volume", "volume", VERSION_HINT, 1.0, 0.0, 3.0)
|
||||
}, new EffectParameter("Volume", "volume", VERSION_HINT, 1.0, 0.0, 3.0),
|
||||
"Controls the volume of the sound. Works by scaling the image and sound by a factor."
|
||||
);
|
||||
|
||||
std::shared_ptr<Effect> thresholdEffect = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
threshold = values[0];
|
||||
return input;
|
||||
}, new EffectParameter("Threshold", "threshold", VERSION_HINT, 1.0, 0.0, 1.0)
|
||||
}, new EffectParameter("Threshold", "threshold", VERSION_HINT, 1.0, 0.0, 1.0),
|
||||
"Clips the sound and image to a maximum value. Applying a harsher threshold results in a more distorted sound."
|
||||
);
|
||||
|
||||
std::shared_ptr<Effect> focalLength = std::make_shared<Effect>(
|
||||
|
@ -105,7 +108,8 @@ public:
|
|||
camera->setFocalLength(values[0]);
|
||||
}
|
||||
return input;
|
||||
}, new EffectParameter("Focal length", "objFocalLength", VERSION_HINT, 1.0, 0.0, 2.0)
|
||||
}, new EffectParameter("Focal length", "objFocalLength", VERSION_HINT, 1.0, 0.0, 2.0),
|
||||
"Controls the focal length of the camera being used to render the 3D object. A lower focal length results in a wider field of view, distorting the image, and making the image smaller."
|
||||
);
|
||||
|
||||
BooleanParameter* fixedRotateX = new BooleanParameter("Object Fixed Rotate X", "objFixedRotateX", VERSION_HINT, false);
|
||||
|
@ -124,7 +128,8 @@ public:
|
|||
}
|
||||
}
|
||||
return input;
|
||||
}, new EffectParameter("Rotate X", "objRotateX", VERSION_HINT, 1.0, -1.0, 1.0)
|
||||
}, new EffectParameter("Object Rotate X", "objRotateX", VERSION_HINT, 1.0, -1.0, 1.0),
|
||||
"Controls the rotation of the 3D object around the X axis. When Object Fixed Rotate X is enabled, the object is unaffected by the rotation speed, and remains in a fixed position."
|
||||
);
|
||||
std::shared_ptr<Effect> rotateY = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
|
@ -139,7 +144,8 @@ public:
|
|||
}
|
||||
}
|
||||
return input;
|
||||
}, new EffectParameter("Rotate Y", "objRotateY", VERSION_HINT, 1.0, -1.0, 1.0)
|
||||
}, new EffectParameter("Object Rotate Y", "objRotateY", VERSION_HINT, 1.0, -1.0, 1.0),
|
||||
"Controls the rotation of the 3D object around the Y axis. When Object Fixed Rotate Y is enabled, the object is unaffected by the rotation speed, and remains in a fixed position."
|
||||
);
|
||||
std::shared_ptr<Effect> rotateZ = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
|
@ -154,7 +160,8 @@ public:
|
|||
}
|
||||
}
|
||||
return input;
|
||||
}, new EffectParameter("Rotate Z", "objRotateZ", VERSION_HINT, 0.0, -1.0, 1.0)
|
||||
}, new EffectParameter("Object Rotate Z", "objRotateZ", VERSION_HINT, 0.0, -1.0, 1.0),
|
||||
"Controls the rotation of the 3D object around the Z axis. When Object Fixed Rotate Z is enabled, the object is unaffected by the rotation speed, and remains in a fixed position."
|
||||
);
|
||||
std::shared_ptr<Effect> rotateSpeed = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
|
@ -164,18 +171,21 @@ public:
|
|||
obj->setRotationSpeed(values[0]);
|
||||
}
|
||||
return input;
|
||||
}, new EffectParameter("Rotate Speed", "objRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0)
|
||||
}, new EffectParameter("Rotate Speed", "objRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0),
|
||||
"Controls the speed at which the 3D object rotates. A negative value results in the object rotating in the opposite direction. The rotate speed is scaled by the different Object Rotate Axis values to rotate the object."
|
||||
);
|
||||
|
||||
std::shared_ptr<Effect> traceMax = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
return input;
|
||||
}, new EffectParameter("Trace max", "traceMax", VERSION_HINT, 1.0, 0.0, 1.0)
|
||||
}, new EffectParameter("Trace max", "traceMax", VERSION_HINT, 1.0, 0.0, 1.0),
|
||||
"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."
|
||||
);
|
||||
std::shared_ptr<Effect> traceMin = std::make_shared<Effect>(
|
||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||
return input;
|
||||
}, new EffectParameter("Trace min", "traceMin", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||
}, new EffectParameter("Trace min", "traceMin", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||
"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."
|
||||
);
|
||||
|
||||
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
#include "Effect.h"
|
||||
#include <numbers>
|
||||
|
||||
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters) :
|
||||
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters, juce::String description) :
|
||||
effectApplication(effectApplication),
|
||||
parameters(parameters),
|
||||
enabled(nullptr),
|
||||
actualValues(std::vector<double>(parameters.size(), 0.0)) {}
|
||||
actualValues(std::vector<double>(parameters.size(), 0.0)),
|
||||
description(description) {}
|
||||
|
||||
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter) : Effect(effectApplication, std::vector<EffectParameter*>{parameter}) {}
|
||||
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter, juce::String description) : Effect(effectApplication, std::vector<EffectParameter*>{parameter}, description) {}
|
||||
|
||||
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters) :
|
||||
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters, juce::String description) :
|
||||
application(application),
|
||||
parameters(parameters),
|
||||
enabled(nullptr),
|
||||
actualValues(std::vector<double>(parameters.size(), 0.0)) {}
|
||||
actualValues(std::vector<double>(parameters.size(), 0.0)),
|
||||
description(description) {}
|
||||
|
||||
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter) : Effect(application, std::vector<EffectParameter*>{parameter}) {}
|
||||
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter, juce::String description) : Effect(application, std::vector<EffectParameter*>{parameter}, description) {}
|
||||
|
||||
Vector2 Effect::apply(int index, Vector2 input) {
|
||||
animateValues();
|
||||
|
@ -201,3 +203,7 @@ EffectParameter* Effect::getParameter(juce::String id) {
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
juce::String Effect::getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
class Effect {
|
||||
public:
|
||||
Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters);
|
||||
Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter);
|
||||
Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters);
|
||||
Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter);
|
||||
Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters, juce::String description);
|
||||
Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter, juce::String description);
|
||||
Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters, juce::String description);
|
||||
Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter, juce::String description);
|
||||
|
||||
Vector2 apply(int index, Vector2 input);
|
||||
|
||||
|
@ -32,6 +32,7 @@ public:
|
|||
void save(juce::XmlElement* xml);
|
||||
void load(juce::XmlElement* xml);
|
||||
EffectParameter* getParameter(juce::String id);
|
||||
juce::String getDescription();
|
||||
|
||||
std::vector<EffectParameter*> parameters;
|
||||
BooleanParameter* enabled;
|
||||
|
@ -43,6 +44,7 @@ private:
|
|||
int precedence = -1;
|
||||
int sampleRate = 192000;
|
||||
std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application;
|
||||
juce::String description;
|
||||
|
||||
std::shared_ptr<EffectApplication> effectApplication;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, in
|
|||
lfo.addItem("Reverse Sawtooth", static_cast<int>(LfoType::ReverseSawtooth));
|
||||
lfo.addItem("Noise", static_cast<int>(LfoType::Noise));
|
||||
|
||||
setTooltip(effect.getDescription());
|
||||
|
||||
effect.addListener(index, this);
|
||||
setupComponent();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../audio/Effect.h"
|
||||
#include "LabelledTextBox.h"
|
||||
|
||||
class EffectComponent : public juce::Component, public juce::AudioProcessorParameter::Listener, juce::AsyncUpdater {
|
||||
class EffectComponent : public juce::Component, public juce::AudioProcessorParameter::Listener, juce::AsyncUpdater, public juce::SettableTooltipClient {
|
||||
public:
|
||||
EffectComponent(OscirenderAudioProcessor& p, Effect& effect, int index);
|
||||
EffectComponent(OscirenderAudioProcessor& p, Effect& effect);
|
||||
|
|
Ładowanie…
Reference in New Issue