From 07a35e709e9ac8055245178c0aa19bedcb16e4a2 Mon Sep 17 00:00:00 2001 From: James Ball Date: Sun, 17 Dec 2023 22:46:24 +0000 Subject: [PATCH] Add tooltips to fixed rotate and edit buttons --- Source/MainComponent.cpp | 3 ++ Source/ObjComponent.cpp | 5 +++ Source/PluginProcessor.cpp | 45 ++++++++++++++-------- Source/components/EffectsListComponent.cpp | 6 +++ 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index ea85c74..5eae3d7 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -83,6 +83,9 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess pluginEditor.fileUpdated(fileName); }; + fileName.setFont(juce::Font(16.0f, juce::Font::plain)); + fileName.setText("filename"); + fileName.onReturnKey = [this] { createFile.triggerClick(); }; diff --git a/Source/ObjComponent.cpp b/Source/ObjComponent.cpp index d621e14..3bc1c48 100644 --- a/Source/ObjComponent.cpp +++ b/Source/ObjComponent.cpp @@ -73,6 +73,11 @@ ObjComponent::ObjComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessor rotateX.setComponent(fixedRotateX); rotateY.setComponent(fixedRotateY); rotateZ.setComponent(fixedRotateZ); + + juce::String tooltip = "Toggles whether the rotation around this axis is fixed, or changes according to the rotation speed."; + fixedRotateX->setTooltip(tooltip); + fixedRotateY->setTooltip(tooltip); + fixedRotateZ->setTooltip(tooltip); } ObjComponent::~ObjComponent() { diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index c3ce76c..3b5ebb2 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -36,56 +36,62 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() toggleableEffects.push_back(std::make_shared( std::make_shared(), - new EffectParameter("Bit Crush", "description", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Bit Crush", "Limits the resolution of points drawn to the screen, making the image look pixelated, and making the audio sound more 'digital' and distorted.", "bitCrush", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( std::make_shared(), - new EffectParameter("Bulge", "description", "bulge", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Bulge", "Applies a bulge that makes the centre of the image larger, and squishes the edges of the image. This applies a distortion to the audio.", "bulge", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( std::make_shared(), - new EffectParameter("2D Rotate", "description", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("2D Rotate", "Rotates the image, and pans the audio.", "2DRotateSpeed", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( std::make_shared(), - new EffectParameter("Vector Cancelling", "description", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Vector Cancelling", "Inverts the audio and image every few samples to 'cancel out' the audio, making the audio quiet, and distorting the image.", "vectorCancelling", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( std::make_shared(false), - new EffectParameter("Distort X", "description", "distortX", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Distort X", "Distorts the image in the horizontal direction by jittering the audio sample being drawn.", "distortX", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( std::make_shared(true), - new EffectParameter("Distort Y", "description", "distortY", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Distort Y", "Distorts the image in the vertical direction by jittering the audio sample being drawn.", "distortY", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( [this](int index, Vector2 input, const std::vector& values, double sampleRate) { input.x += values[0]; input.y += values[1]; return input; - }, std::vector{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)} + }, std::vector{ + new EffectParameter("Translate X", "Moves the image horizontally.", "translateX", VERSION_HINT, 0.0, -1.0, 1.0), + new EffectParameter("Translate Y", "Moves the image vertically.", "translateY", VERSION_HINT, 0.0, -1.0, 1.0) + } )); toggleableEffects.push_back(std::make_shared( std::make_shared(), - new EffectParameter("Smoothing", "description", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Smoothing", "This works as a low-pass frequency filter that removes high frequencies, making the image look smoother, and audio sound less harsh.", "smoothing", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( wobbleEffect, - new EffectParameter("Wobble", "description", "wobble", VERSION_HINT, 0.0, 0.0, 1.0) + new EffectParameter("Wobble", "Adds a sine wave of the prominent frequency in the audio currently playing. The sine wave's frequency is slightly offset to create a subtle 'wobble' in the image. Increasing the slider increases the strength of the wobble.", "wobble", VERSION_HINT, 0.0, 0.0, 1.0) )); toggleableEffects.push_back(std::make_shared( delayEffect, - std::vector{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)} + std::vector{ + new EffectParameter("Delay Decay", "Adds repetitions, delays, or echos to the audio. This slider controls the volume of the echo.", "delayDecay", VERSION_HINT, 0.0, 0.0, 1.0), + new EffectParameter("Delay Length", "Controls the time in seconds between echos.", "delayLength", VERSION_HINT, 0.5, 0.0, 1.0) + } )); toggleableEffects.push_back(std::make_shared( perspectiveEffect, std::vector{ - new EffectParameter("3D Perspective", "description", "perspectiveStrength", VERSION_HINT, 0.0, 0.0, 1.0), - new EffectParameter("Depth (z)", "description", "perspectiveZPos", VERSION_HINT, 0.1, 0.0, 1.0), - new EffectParameter("Rotate Speed", "description", "perspectiveRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0), - new EffectParameter("Rotate X", "description", "perspectiveRotateX", 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", "description", "perspectiveRotateZ", VERSION_HINT, 0.0, -1.0, 1.0), + new EffectParameter("3D Perspective", "Controls the strength of the 3D perspective effect which treats the image as a 3D object that can be rotated.", "perspectiveStrength", VERSION_HINT, 0.0, 0.0, 1.0), + new EffectParameter("Depth (z)", "Controls how far away the 3D object is drawn away from the camera (the Z position).", "perspectiveZPos", VERSION_HINT, 0.1, 0.0, 1.0), + new EffectParameter("Rotate Speed", "Controls how fast the 3D object rotates in the direction determined by the rotation sliders below.", "perspectiveRotateSpeed", VERSION_HINT, 0.0, -1.0, 1.0), + new EffectParameter("Rotate X", "Controls the rotation of the object in the X axis.", "perspectiveRotateX", VERSION_HINT, 1.0, -1.0, 1.0), + new EffectParameter("Rotate Y", "Controls the rotation of the object in the Y axis.", "perspectiveRotateY", VERSION_HINT, 1.0, -1.0, 1.0), + new EffectParameter("Rotate Z", "Controls the rotation of the object in the Z axis.", "perspectiveRotateZ", VERSION_HINT, 0.0, -1.0, 1.0), } )); toggleableEffects.push_back(traceMax); @@ -264,7 +270,12 @@ void OscirenderAudioProcessor::addLuaSlider() { luaEffects.push_back(std::make_shared( std::make_shared(sliderName, *this), - new EffectParameter("Lua " + sliderName, "description", "lua" + sliderName, VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false) + new EffectParameter( + "Lua Slider " + sliderName, + "Controls the value of the Lua variable called slider_" + sliderName + ".", + "lua" + sliderName, + VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false + ) )); auto& effect = luaEffects.back(); diff --git a/Source/components/EffectsListComponent.cpp b/Source/components/EffectsListComponent.cpp index 3e99e59..8aeebac 100644 --- a/Source/components/EffectsListComponent.cpp +++ b/Source/components/EffectsListComponent.cpp @@ -86,14 +86,19 @@ void EffectsListComponent::resized() { std::shared_ptr EffectsListComponent::createComponent(EffectParameter* parameter) { if (parameter->paramID == "perspectiveRotateX" || parameter->paramID == "perspectiveRotateY" || parameter->paramID == "perspectiveRotateZ") { BooleanParameter* toggle; + juce::String axis; if (parameter->paramID == "perspectiveRotateX") { toggle = audioProcessor.perspectiveEffect->fixedRotateX; + axis = "X"; } else if (parameter->paramID == "perspectiveRotateY") { toggle = audioProcessor.perspectiveEffect->fixedRotateY; + axis = "Y"; } else if (parameter->paramID == "perspectiveRotateZ") { toggle = audioProcessor.perspectiveEffect->fixedRotateZ; + axis = "Z"; } std::shared_ptr button = std::make_shared(parameter->name, BinaryData::fixed_rotate_svg, "white", "red", toggle); + button->setTooltip("Toggles whether the rotation around the " + axis + " axis is fixed, or changes according to the rotation speed."); button->onClick = [this, toggle] { toggle->setBoolValueNotifyingHost(!toggle->getBoolValue()); }; @@ -103,6 +108,7 @@ std::shared_ptr EffectsListComponent::createComponent(EffectPar std::weak_ptr weakButton = button; button->setEdgeIndent(5); button->setToggleState(editor.editingPerspective, juce::dontSendNotification); + button->setTooltip("Toggles whether the text editor is editing the currently open file, or the Lua 3D perspective function."); button->onClick = [this, weakButton] { if (auto button = weakButton.lock()) { editor.editPerspectiveFunction(button->getToggleState());