kopia lustrzana https://github.com/jameshball/osci-render
Move description to parameters
rodzic
f12ef1bbd0
commit
633723f1ba
|
@ -39,6 +39,8 @@ OscirenderLookAndFeel::OscirenderLookAndFeel() {
|
||||||
setColour(juce::TabbedButtonBar::frontTextColourId, juce::Colours::white);
|
setColour(juce::TabbedButtonBar::frontTextColourId, juce::Colours::white);
|
||||||
setColour(juce::TabbedComponent::outlineColourId, Colours::veryDark);
|
setColour(juce::TabbedComponent::outlineColourId, Colours::veryDark);
|
||||||
setColour(tabbedComponentBackgroundColourId, Colours::veryDark);
|
setColour(tabbedComponentBackgroundColourId, Colours::veryDark);
|
||||||
|
setColour(juce::TooltipWindow::backgroundColourId, Colours::veryDark);
|
||||||
|
setColour(juce::TooltipWindow::outlineColourId, juce::Colours::white);
|
||||||
|
|
||||||
getCurrentColourScheme().setUIColour(ColourScheme::widgetBackground, Colours::veryDark);
|
getCurrentColourScheme().setUIColour(ColourScheme::widgetBackground, Colours::veryDark);
|
||||||
getCurrentColourScheme().setUIColour(ColourScheme::UIColour::defaultFill, Colours::accentColor);
|
getCurrentColourScheme().setUIColour(ColourScheme::UIColour::defaultFill, Colours::accentColor);
|
||||||
|
@ -175,6 +177,20 @@ void OscirenderLookAndFeel::drawMenuBarBackground(juce::Graphics& g, int width,
|
||||||
g.fillRect(r);
|
g.fillRect(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OscirenderLookAndFeel::drawTooltip(juce::Graphics& g, const juce::String& text, int width, int height) {
|
||||||
|
juce::Rectangle<int> bounds (width, height);
|
||||||
|
auto cornerSize = 5.0f;
|
||||||
|
|
||||||
|
g.setColour(findColour(juce::TooltipWindow::backgroundColourId));
|
||||||
|
g.fillRect(bounds.toFloat());
|
||||||
|
|
||||||
|
g.setColour(findColour(juce::TooltipWindow::outlineColourId));
|
||||||
|
g.drawRect(bounds.toFloat().reduced(0.5f, 0.5f), 1.0f);
|
||||||
|
|
||||||
|
LookAndFeelHelpers::layoutTooltipText (text, findColour (juce::TooltipWindow::textColourId))
|
||||||
|
.draw (g, { static_cast<float> (width), static_cast<float> (height) });
|
||||||
|
}
|
||||||
|
|
||||||
juce::CodeEditorComponent::ColourScheme OscirenderLookAndFeel::getDefaultColourScheme() {
|
juce::CodeEditorComponent::ColourScheme OscirenderLookAndFeel::getDefaultColourScheme() {
|
||||||
juce::CodeEditorComponent::ColourScheme cs;
|
juce::CodeEditorComponent::ColourScheme cs;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,37 @@ namespace Dracula {
|
||||||
const juce::Colour yellow{0xfff1fa8c};
|
const juce::Colour yellow{0xfff1fa8c};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LookAndFeelHelpers
|
||||||
|
{
|
||||||
|
static juce::Colour createBaseColour (juce::Colour buttonColour,
|
||||||
|
bool hasKeyboardFocus,
|
||||||
|
bool shouldDrawButtonAsHighlighted,
|
||||||
|
bool shouldDrawButtonAsDown) noexcept
|
||||||
|
{
|
||||||
|
const float sat = hasKeyboardFocus ? 1.3f : 0.9f;
|
||||||
|
const juce::Colour baseColour (buttonColour.withMultipliedSaturation (sat));
|
||||||
|
|
||||||
|
if (shouldDrawButtonAsDown) return baseColour.contrasting (0.2f);
|
||||||
|
if (shouldDrawButtonAsHighlighted) return baseColour.contrasting (0.1f);
|
||||||
|
|
||||||
|
return baseColour;
|
||||||
|
}
|
||||||
|
|
||||||
|
static juce::TextLayout layoutTooltipText (const juce::String& text, juce::Colour colour) noexcept
|
||||||
|
{
|
||||||
|
const float tooltipFontSize = 13.0f;
|
||||||
|
const int maxToolTipWidth = 400;
|
||||||
|
|
||||||
|
juce::AttributedString s;
|
||||||
|
s.setJustification (juce::Justification::centred);
|
||||||
|
s.append (text, juce::Font (tooltipFontSize, juce::Font::bold), colour);
|
||||||
|
|
||||||
|
juce::TextLayout tl;
|
||||||
|
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
|
||||||
|
return tl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class OscirenderLookAndFeel : public juce::LookAndFeel_V4 {
|
class OscirenderLookAndFeel : public juce::LookAndFeel_V4 {
|
||||||
public:
|
public:
|
||||||
OscirenderLookAndFeel();
|
OscirenderLookAndFeel();
|
||||||
|
@ -58,6 +89,6 @@ public:
|
||||||
bool shouldDrawButtonAsHighlighted,
|
bool shouldDrawButtonAsHighlighted,
|
||||||
bool shouldDrawButtonAsDown) override;
|
bool shouldDrawButtonAsDown) override;
|
||||||
void drawMenuBarBackground(juce::Graphics& g, int width, int height, bool, juce::MenuBarComponent& menuBar) override;
|
void drawMenuBarBackground(juce::Graphics& g, int width, int height, bool, juce::MenuBarComponent& menuBar) override;
|
||||||
|
|
||||||
juce::CodeEditorComponent::ColourScheme getDefaultColourScheme();
|
juce::CodeEditorComponent::ColourScheme getDefaultColourScheme();
|
||||||
|
void drawTooltip(juce::Graphics& g, const juce::String& text, int width, int height) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
juce::StretchableLayoutManager layout;
|
juce::StretchableLayoutManager layout;
|
||||||
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
juce::StretchableLayoutResizerBar resizerBar{&layout, 1, true};
|
||||||
|
|
||||||
juce::TooltipWindow tooltipWindow{this};
|
juce::TooltipWindow tooltipWindow{this, 0};
|
||||||
|
|
||||||
std::atomic<bool> updatingDocumentsWithParserLock = false;
|
std::atomic<bool> updatingDocumentsWithParserLock = false;
|
||||||
|
|
||||||
|
|
|
@ -36,68 +36,57 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
|
||||||
|
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<BitCrushEffect>(),
|
std::make_shared<BitCrushEffect>(),
|
||||||
new EffectParameter("Bit Crush", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Bit Crush", "description", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"bitCrush"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<BulgeEffect>(),
|
std::make_shared<BulgeEffect>(),
|
||||||
new EffectParameter("Bulge", "bulge", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Bulge", "description", "bulge", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"bulge"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<RotateEffect>(),
|
std::make_shared<RotateEffect>(),
|
||||||
new EffectParameter("2D Rotate", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("2D Rotate", "description", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"2DRotate"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<VectorCancellingEffect>(),
|
std::make_shared<VectorCancellingEffect>(),
|
||||||
new EffectParameter("Vector Cancelling", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Vector Cancelling", "description", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"vectorCancelling"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<DistortEffect>(false),
|
std::make_shared<DistortEffect>(false),
|
||||||
new EffectParameter("Distort X", "distortX", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Distort X", "description", "distortX", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"distortX"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<DistortEffect>(true),
|
std::make_shared<DistortEffect>(true),
|
||||||
new EffectParameter("Distort Y", "distortY", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Distort Y", "description", "distortY", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"distortY"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
input.x += values[0];
|
input.x += values[0];
|
||||||
input.y += values[1];
|
input.y += values[1];
|
||||||
return input;
|
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", "description", "translateX", VERSION_HINT, 0.0, -1.0, 1.0), new EffectParameter("Translate Y", "description", "translateY", VERSION_HINT, 0.0, -1.0, 1.0)}
|
||||||
"translate"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<SmoothEffect>(),
|
std::make_shared<SmoothEffect>(),
|
||||||
new EffectParameter("Smoothing", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Smoothing", "description", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"smoothing"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
wobbleEffect,
|
wobbleEffect,
|
||||||
new EffectParameter("Wobble", "wobble", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("Wobble", "description", "wobble", VERSION_HINT, 0.0, 0.0, 1.0)
|
||||||
"wobble"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
delayEffect,
|
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", "description", "delayDecay", VERSION_HINT, 0.0, 0.0, 1.0), new EffectParameter("Delay Length", "description", "delayLength", VERSION_HINT, 0.5, 0.0, 1.0)}
|
||||||
"delay"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(std::make_shared<Effect>(
|
toggleableEffects.push_back(std::make_shared<Effect>(
|
||||||
perspectiveEffect,
|
perspectiveEffect,
|
||||||
std::vector<EffectParameter*>{
|
std::vector<EffectParameter*>{
|
||||||
new EffectParameter("3D Perspective", "perspectiveStrength", VERSION_HINT, 0.0, 0.0, 1.0),
|
new EffectParameter("3D Perspective", "description", "perspectiveStrength", VERSION_HINT, 0.0, 0.0, 1.0),
|
||||||
new EffectParameter("Depth (z)", "perspectiveZPos", VERSION_HINT, 0.1, 0.0, 1.0),
|
new EffectParameter("Depth (z)", "description", "perspectiveZPos", VERSION_HINT, 0.1, 0.0, 1.0),
|
||||||
new EffectParameter("Rotate Speed", "perspectiveRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0),
|
new EffectParameter("Rotate Speed", "description", "perspectiveRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0),
|
||||||
new EffectParameter("Rotate X", "perspectiveRotateX", VERSION_HINT, 1.0, -1.0, 1.0),
|
new EffectParameter("Rotate X", "description", "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 Y", "description", "perspectiveRotateY", VERSION_HINT, 1.0, -1.0, 1.0),
|
||||||
new EffectParameter("Rotate Z", "perspectiveRotateZ", VERSION_HINT, 0.0, -1.0, 1.0),
|
new EffectParameter("Rotate Z", "description", "perspectiveRotateZ", VERSION_HINT, 0.0, -1.0, 1.0),
|
||||||
},
|
}
|
||||||
"perspective"
|
|
||||||
));
|
));
|
||||||
toggleableEffects.push_back(traceMax);
|
toggleableEffects.push_back(traceMax);
|
||||||
toggleableEffects.push_back(traceMin);
|
toggleableEffects.push_back(traceMin);
|
||||||
|
@ -275,8 +264,7 @@ void OscirenderAudioProcessor::addLuaSlider() {
|
||||||
|
|
||||||
luaEffects.push_back(std::make_shared<Effect>(
|
luaEffects.push_back(std::make_shared<Effect>(
|
||||||
std::make_shared<LuaEffect>(sliderName, *this),
|
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, "description", "lua" + sliderName, VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false)
|
||||||
"lua" + sliderName
|
|
||||||
));
|
));
|
||||||
|
|
||||||
auto& effect = luaEffects.back();
|
auto& effect = luaEffects.back();
|
||||||
|
|
|
@ -81,24 +81,36 @@ public:
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
frequency = values[0];
|
frequency = values[0];
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Frequency", "frequency", VERSION_HINT, 440.0, 0.0, 12000.0, 0.1),
|
}, new EffectParameter(
|
||||||
"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."
|
"Frequency",
|
||||||
|
"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.",
|
||||||
|
"frequency",
|
||||||
|
VERSION_HINT, 440.0, 0.0, 12000.0, 0.1
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::shared_ptr<Effect> volumeEffect = std::make_shared<Effect>(
|
std::shared_ptr<Effect> volumeEffect = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
volume = values[0];
|
volume = values[0];
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Volume", "volume", VERSION_HINT, 1.0, 0.0, 3.0),
|
}, new EffectParameter(
|
||||||
"Controls the volume of the sound. Works by scaling the image and sound by a factor."
|
"Volume",
|
||||||
|
"Controls the volume of the sound. Works by scaling the image and sound by a factor.",
|
||||||
|
"volume",
|
||||||
|
VERSION_HINT, 1.0, 0.0, 3.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::shared_ptr<Effect> thresholdEffect = std::make_shared<Effect>(
|
std::shared_ptr<Effect> thresholdEffect = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
threshold = values[0];
|
threshold = values[0];
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Threshold", "threshold", VERSION_HINT, 1.0, 0.0, 1.0),
|
}, new EffectParameter(
|
||||||
"Clips the sound and image to a maximum value. Applying a harsher threshold results in a more distorted sound."
|
"Threshold",
|
||||||
|
"Clips the sound and image to a maximum value. Applying a harsher threshold results in a more distorted sound.",
|
||||||
|
"threshold",
|
||||||
|
VERSION_HINT, 1.0, 0.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::shared_ptr<Effect> focalLength = std::make_shared<Effect>(
|
std::shared_ptr<Effect> focalLength = std::make_shared<Effect>(
|
||||||
|
@ -109,8 +121,12 @@ public:
|
||||||
camera->setFocalLength(values[0]);
|
camera->setFocalLength(values[0]);
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Focal length", "objFocalLength", VERSION_HINT, 1.0, 0.0, 2.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"Focal length",
|
||||||
|
"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.",
|
||||||
|
"objFocalLength",
|
||||||
|
VERSION_HINT, 1.0, 0.0, 2.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
BooleanParameter* fixedRotateX = new BooleanParameter("Object Fixed Rotate X", "objFixedRotateX", VERSION_HINT, false);
|
BooleanParameter* fixedRotateX = new BooleanParameter("Object Fixed Rotate X", "objFixedRotateX", VERSION_HINT, false);
|
||||||
|
@ -129,8 +145,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Object Rotate X", "objRotateX", VERSION_HINT, 1.0, -1.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"Object Rotate X",
|
||||||
|
"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.",
|
||||||
|
"objRotateX",
|
||||||
|
VERSION_HINT, 1.0, -1.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
std::shared_ptr<Effect> rotateY = std::make_shared<Effect>(
|
std::shared_ptr<Effect> rotateY = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
|
@ -145,8 +165,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Object Rotate Y", "objRotateY", VERSION_HINT, 1.0, -1.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"Object Rotate Y",
|
||||||
|
"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.",
|
||||||
|
"objRotateY",
|
||||||
|
VERSION_HINT, 1.0, -1.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
std::shared_ptr<Effect> rotateZ = std::make_shared<Effect>(
|
std::shared_ptr<Effect> rotateZ = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
|
@ -161,8 +185,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Object Rotate Z", "objRotateZ", VERSION_HINT, 0.0, -1.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"Object Rotate Z",
|
||||||
|
"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.",
|
||||||
|
"objRotateZ",
|
||||||
|
VERSION_HINT, 0.0, -1.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
std::shared_ptr<Effect> rotateSpeed = std::make_shared<Effect>(
|
std::shared_ptr<Effect> rotateSpeed = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
|
@ -172,21 +200,33 @@ public:
|
||||||
obj->setRotationSpeed(values[0]);
|
obj->setRotationSpeed(values[0]);
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Rotate Speed", "objRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"Rotate Speed",
|
||||||
|
"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.",
|
||||||
|
"objRotateSpeed",
|
||||||
|
VERSION_HINT, 0.0, -1.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::shared_ptr<Effect> traceMax = std::make_shared<Effect>(
|
std::shared_ptr<Effect> traceMax = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Trace max", "traceMax", VERSION_HINT, 1.0, 0.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"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, 1.0, 0.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
std::shared_ptr<Effect> traceMin = std::make_shared<Effect>(
|
std::shared_ptr<Effect> traceMin = std::make_shared<Effect>(
|
||||||
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
[this](int index, Vector2 input, const std::vector<double>& values, double sampleRate) {
|
||||||
return input;
|
return input;
|
||||||
}, new EffectParameter("Trace min", "traceMin", VERSION_HINT, 0.0, 0.0, 1.0),
|
}, new EffectParameter(
|
||||||
"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."
|
"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.0, 0.0, 1.0
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
|
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include <numbers>
|
#include <numbers>
|
||||||
|
|
||||||
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters, juce::String description) :
|
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters) :
|
||||||
effectApplication(effectApplication),
|
effectApplication(effectApplication),
|
||||||
parameters(parameters),
|
parameters(parameters),
|
||||||
enabled(nullptr),
|
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, juce::String description) : Effect(effectApplication, std::vector<EffectParameter*>{parameter}, description) {}
|
Effect::Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter) : Effect(effectApplication, std::vector<EffectParameter*>{parameter}) {}
|
||||||
|
|
||||||
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters, juce::String description) :
|
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, const std::vector<EffectParameter*>& parameters) :
|
||||||
application(application),
|
application(application),
|
||||||
parameters(parameters),
|
parameters(parameters),
|
||||||
enabled(nullptr),
|
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, juce::String description) : Effect(application, std::vector<EffectParameter*>{parameter}, description) {}
|
Effect::Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter) : Effect(application, std::vector<EffectParameter*>{parameter}) {}
|
||||||
|
|
||||||
Vector2 Effect::apply(int index, Vector2 input) {
|
Vector2 Effect::apply(int index, Vector2 input) {
|
||||||
animateValues();
|
animateValues();
|
||||||
|
@ -203,7 +201,3 @@ EffectParameter* Effect::getParameter(juce::String id) {
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
juce::String Effect::getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
class Effect {
|
class Effect {
|
||||||
public:
|
public:
|
||||||
Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters, juce::String description);
|
Effect(std::shared_ptr<EffectApplication> effectApplication, const std::vector<EffectParameter*>& parameters);
|
||||||
Effect(std::shared_ptr<EffectApplication> effectApplication, EffectParameter* parameter, juce::String description);
|
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, juce::String description);
|
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, juce::String description);
|
Effect(std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application, EffectParameter* parameter);
|
||||||
|
|
||||||
Vector2 apply(int index, Vector2 input);
|
Vector2 apply(int index, Vector2 input);
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ public:
|
||||||
void save(juce::XmlElement* xml);
|
void save(juce::XmlElement* xml);
|
||||||
void load(juce::XmlElement* xml);
|
void load(juce::XmlElement* xml);
|
||||||
EffectParameter* getParameter(juce::String id);
|
EffectParameter* getParameter(juce::String id);
|
||||||
juce::String getDescription();
|
|
||||||
|
|
||||||
std::vector<EffectParameter*> parameters;
|
std::vector<EffectParameter*> parameters;
|
||||||
BooleanParameter* enabled;
|
BooleanParameter* enabled;
|
||||||
|
@ -44,7 +43,6 @@ private:
|
||||||
int precedence = -1;
|
int precedence = -1;
|
||||||
int sampleRate = 192000;
|
int sampleRate = 192000;
|
||||||
std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application;
|
std::function<Vector2(int, Vector2, const std::vector<double>&, double)> application;
|
||||||
juce::String description;
|
|
||||||
|
|
||||||
std::shared_ptr<EffectApplication> effectApplication;
|
std::shared_ptr<EffectApplication> effectApplication;
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,7 @@ public:
|
||||||
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, 100.0f, 0.1f, "Hz");
|
FloatParameter* lfoRate = new FloatParameter(name + " LFO Rate", paramID + "LfoRate", getVersionHint(), 1.0f, 0.0f, 100.0f, 0.1f, "Hz");
|
||||||
std::atomic<float> phase = 0.0f;
|
std::atomic<float> phase = 0.0f;
|
||||||
|
juce::String description;
|
||||||
|
|
||||||
std::vector<juce::AudioProcessorParameter*> getParameters() {
|
std::vector<juce::AudioProcessorParameter*> getParameters() {
|
||||||
std::vector<juce::AudioProcessorParameter*> parameters;
|
std::vector<juce::AudioProcessorParameter*> parameters;
|
||||||
|
@ -349,5 +350,5 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectParameter(juce::String name, 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) {}
|
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) {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,9 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, in
|
||||||
addAndMakeVisible(slider);
|
addAndMakeVisible(slider);
|
||||||
addChildComponent(lfoSlider);
|
addChildComponent(lfoSlider);
|
||||||
addAndMakeVisible(lfo);
|
addAndMakeVisible(lfo);
|
||||||
|
addAndMakeVisible(label);
|
||||||
|
|
||||||
|
label.setFont(juce::Font(13.0f));
|
||||||
|
|
||||||
lfo.addItem("Static", static_cast<int>(LfoType::Static));
|
lfo.addItem("Static", static_cast<int>(LfoType::Static));
|
||||||
lfo.addItem("Sine", static_cast<int>(LfoType::Sine));
|
lfo.addItem("Sine", static_cast<int>(LfoType::Sine));
|
||||||
|
@ -15,9 +18,6 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, in
|
||||||
lfo.addItem("Reverse Sawtooth", static_cast<int>(LfoType::ReverseSawtooth));
|
lfo.addItem("Reverse Sawtooth", static_cast<int>(LfoType::ReverseSawtooth));
|
||||||
lfo.addItem("Noise", static_cast<int>(LfoType::Noise));
|
lfo.addItem("Noise", static_cast<int>(LfoType::Noise));
|
||||||
|
|
||||||
// temporarily disabling tooltips
|
|
||||||
// setTooltip(effect.getDescription());
|
|
||||||
|
|
||||||
effect.addListener(index, this);
|
effect.addListener(index, this);
|
||||||
setupComponent();
|
setupComponent();
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect) :
|
||||||
void EffectComponent::setupComponent() {
|
void EffectComponent::setupComponent() {
|
||||||
EffectParameter* parameter = effect.parameters[index];
|
EffectParameter* parameter = effect.parameters[index];
|
||||||
|
|
||||||
|
label.setTooltip(parameter->description);
|
||||||
|
label.setText(parameter->name, juce::dontSendNotification);
|
||||||
|
|
||||||
slider.setRange(parameter->min, parameter->max, parameter->step);
|
slider.setRange(parameter->min, parameter->max, parameter->step);
|
||||||
slider.setValue(parameter->getValueUnnormalised(), juce::dontSendNotification);
|
slider.setValue(parameter->getValueUnnormalised(), juce::dontSendNotification);
|
||||||
|
|
||||||
|
@ -118,16 +121,14 @@ void EffectComponent::resized() {
|
||||||
lfo.setBounds(bounds.removeFromRight(100).reduced(5));
|
lfo.setBounds(bounds.removeFromRight(100).reduced(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
textBounds = bounds.removeFromLeft(120);
|
bounds.removeFromLeft(5);
|
||||||
textBounds.removeFromLeft(5);
|
label.setBounds(bounds.removeFromLeft(120));
|
||||||
slider.setBounds(bounds);
|
slider.setBounds(bounds);
|
||||||
lfoSlider.setBounds(bounds);
|
lfoSlider.setBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectComponent::paint(juce::Graphics& g) {
|
void EffectComponent::paint(juce::Graphics& g) {
|
||||||
g.fillAll(findColour(effectComponentBackgroundColourId));
|
g.fillAll(findColour(effectComponentBackgroundColourId));
|
||||||
g.setColour(juce::Colours::white);
|
|
||||||
g.drawText(effect.parameters[index]->name, textBounds, juce::Justification::left);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectComponent::mouseDown(const juce::MouseEvent& event) {
|
void EffectComponent::mouseDown(const juce::MouseEvent& event) {
|
||||||
|
|
|
@ -28,11 +28,11 @@ public:
|
||||||
private:
|
private:
|
||||||
void setupComponent();
|
void setupComponent();
|
||||||
bool lfoEnabled = true;
|
bool lfoEnabled = true;
|
||||||
juce::Rectangle<int> textBounds;
|
|
||||||
std::shared_ptr<juce::Component> component;
|
std::shared_ptr<juce::Component> component;
|
||||||
OscirenderAudioProcessor& audioProcessor;
|
OscirenderAudioProcessor& audioProcessor;
|
||||||
|
|
||||||
juce::Label popupLabel;
|
juce::Label popupLabel;
|
||||||
|
juce::Label label;
|
||||||
LabelledTextBox min{"Min"};
|
LabelledTextBox min{"Min"};
|
||||||
LabelledTextBox max{"Max"};
|
LabelledTextBox max{"Max"};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue