diff --git a/Source/OPLLookAndFeel.cpp b/Source/OPLLookAndFeel.cpp
index 5304c47..3ad2a06 100644
--- a/Source/OPLLookAndFeel.cpp
+++ b/Source/OPLLookAndFeel.cpp
@@ -36,3 +36,103 @@ void OPLLookAndFeel::drawTickBox(Graphics &g,
g.drawImage(ticked ? toggleOn : toggleOff, toggleRect.withY(y + 2));
}
+// From JuceLookAndFeel_V2
+static Colour createBaseColour(Colour buttonColour,
+ bool hasKeyboardFocus,
+ bool isMouseOverButton,
+ bool isButtonDown) noexcept
+{
+ const float sat = hasKeyboardFocus ? 1.3f : 0.9f;
+ const Colour baseColour(buttonColour.withMultipliedSaturation(sat));
+
+ if (isButtonDown) return baseColour.contrasting(0.2f);
+ if (isMouseOverButton) return baseColour.contrasting(0.1f);
+
+ return baseColour;
+}
+
+int OPLLookAndFeel::getSliderThumbRadius(Slider& s) {
+ return 10;
+}
+
+// Adapted rom JuceLookAndFeel_V2 - changed round thumb to plain filled rectangle and tweake size.
+void OPLLookAndFeel::drawLinearSliderThumb(Graphics& g, int x, int y, int width, int height,
+ float sliderPos, float minSliderPos, float maxSliderPos,
+ const Slider::SliderStyle style, Slider& slider) {
+
+ const float sliderRadius = (float)(getSliderThumbRadius(slider));
+
+ Colour knobColour(createBaseColour(slider.findColour(Slider::thumbColourId),
+ slider.hasKeyboardFocus(false) && slider.isEnabled(),
+ slider.isMouseOverOrDragging() && slider.isEnabled(),
+ slider.isMouseButtonDown() && slider.isEnabled()));
+
+ const float outlineThickness = slider.isEnabled() ? 0.8f : 0.3f;
+
+ if (style == Slider::LinearHorizontal || style == Slider::LinearVertical)
+ {
+ float kx, ky;
+ float sw, sh;
+
+ if (style == Slider::LinearVertical)
+ {
+ sw = sliderRadius * 2.0f;
+ sh = sliderRadius;
+ kx = x + width * 0.5f;
+ ky = sliderPos + sh * 0.5f;
+ }
+ else
+ {
+ sw = sliderRadius;
+ sh = sliderRadius * 2.0f;
+ kx = sliderPos + sw * 0.5f;
+ ky = y + height * 0.5f;
+ }
+
+ g.setColour(knobColour);
+ g.fillRect(kx - sliderRadius, ky - sliderRadius, sw, sh);
+ }
+ else
+ {
+ LookAndFeel_V2::drawLinearSliderThumb(g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
+ }
+}
+
+// Adapted from JuceLookAndFeel_V3 - replace rounded rectangles with regular ones.
+void OPLLookAndFeel::drawLinearSliderBackground(Graphics& g, int x, int y, int width, int height,
+ float /*sliderPos*/,
+ float /*minSliderPos*/,
+ float /*maxSliderPos*/,
+ const Slider::SliderStyle /*style*/, Slider& slider)
+{
+ const float sliderRadius = (float)(getSliderThumbRadius(slider) - 2);
+
+ const Colour trackColour(slider.findColour(Slider::trackColourId));
+ const Colour gradCol1(trackColour.overlaidWith(Colour(slider.isEnabled() ? 0x13000000 : 0x09000000)));
+ const Colour gradCol2(trackColour.overlaidWith(Colour(0x06000000)));
+ Path indent;
+
+ if (slider.isHorizontal())
+ {
+ const float iy = y + height * 0.5f - sliderRadius * 0.5f;
+
+ g.setGradientFill(ColourGradient(gradCol1, 0.0f, iy,
+ gradCol2, 0.0f, iy + sliderRadius, false));
+
+ indent.addRectangle(x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius);
+ }
+ else
+ {
+ const float ix = x + width * 0.5f - sliderRadius * 0.5f;
+
+ g.setGradientFill(ColourGradient(gradCol1, ix, 0.0f,
+ gradCol2, ix + sliderRadius, 0.0f, false));
+
+ indent.addRectangle(ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius);
+ }
+
+ g.fillPath(indent);
+
+ g.setColour(trackColour.contrasting(0.5f));
+ g.strokePath(indent, PathStrokeType(0.5f));
+}
diff --git a/Source/OPLLookAndFeel.h b/Source/OPLLookAndFeel.h
index f0c54ea..60df5c1 100644
--- a/Source/OPLLookAndFeel.h
+++ b/Source/OPLLookAndFeel.h
@@ -35,6 +35,15 @@ public:
bool isButtonDown
);
+ int getSliderThumbRadius(Slider& s);
+ void drawLinearSliderThumb(Graphics& g, int x, int y, int width, int height,
+ float sliderPos, float minSliderPos, float maxSliderPos,
+ const Slider::SliderStyle style, Slider& slider);
+ void drawLinearSliderBackground(Graphics& g, int x, int y, int width, int height,
+ float /*sliderPos*/,
+ float /*minSliderPos*/,
+ float /*maxSliderPos*/,
+ const Slider::SliderStyle /*style*/, Slider& slider);
};
diff --git a/Source/PluginGui.cpp b/Source/PluginGui.cpp
index ce99d28..10609db 100644
--- a/Source/PluginGui.cpp
+++ b/Source/PluginGui.cpp
@@ -184,7 +184,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
aSlider->setRange (0, 15, 1);
aSlider->setSliderStyle (Slider::LinearVertical);
aSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 30, 20);
- aSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ aSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
aSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
aSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
aSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -206,7 +206,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
dSlider->setRange (0, 15, 1);
dSlider->setSliderStyle (Slider::LinearVertical);
dSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 30, 20);
- dSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ dSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
dSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
dSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
dSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -228,7 +228,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
sSlider->setRange (0, 15, 1);
sSlider->setSliderStyle (Slider::LinearVertical);
sSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 30, 20);
- sSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ sSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
sSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
sSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
sSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -250,7 +250,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
rSlider->setRange (0, 15, 1);
rSlider->setSliderStyle (Slider::LinearVertical);
rSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 30, 20);
- rSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ rSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
rSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
rSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
rSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -271,7 +271,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
attenuationSlider->setRange (-47.25, 0, 0.75);
attenuationSlider->setSliderStyle (Slider::LinearHorizontal);
attenuationSlider->setTextBoxStyle (Slider::TextBoxRight, true, 64, 20);
- attenuationSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ attenuationSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
attenuationSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
attenuationSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
attenuationSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -404,7 +404,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
aSlider2->setRange (0, 15, 1);
aSlider2->setSliderStyle (Slider::LinearVertical);
aSlider2->setTextBoxStyle (Slider::TextBoxBelow, true, 40, 20);
- aSlider2->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ aSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00));
aSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00));
aSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
aSlider2->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -425,7 +425,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
dSlider2->setRange (0, 15, 1);
dSlider2->setSliderStyle (Slider::LinearVertical);
dSlider2->setTextBoxStyle (Slider::TextBoxBelow, true, 40, 20);
- dSlider2->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ dSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00));
dSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00));
dSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
dSlider2->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -446,7 +446,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
sSlider2->setRange (0, 15, 1);
sSlider2->setSliderStyle (Slider::LinearVertical);
sSlider2->setTextBoxStyle (Slider::TextBoxBelow, true, 40, 20);
- sSlider2->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ sSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00));
sSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00));
sSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
sSlider2->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -467,7 +467,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
rSlider2->setRange (0, 15, 1);
rSlider2->setSliderStyle (Slider::LinearVertical);
rSlider2->setTextBoxStyle (Slider::TextBoxBelow, true, 40, 20);
- rSlider2->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ rSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00));
rSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00));
rSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
rSlider2->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -488,7 +488,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
attenuationSlider2->setRange (-47.25, 0, 0.75);
attenuationSlider2->setSliderStyle (Slider::LinearHorizontal);
attenuationSlider2->setTextBoxStyle (Slider::TextBoxRight, true, 64, 20);
- attenuationSlider2->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ attenuationSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00));
attenuationSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00));
attenuationSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
attenuationSlider2->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -604,7 +604,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
tremoloSlider->setRange (1, 4.8, 3.8);
tremoloSlider->setSliderStyle (Slider::LinearHorizontal);
tremoloSlider->setTextBoxStyle (Slider::TextBoxRight, true, 32, 20);
- tremoloSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ tremoloSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
tremoloSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
tremoloSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
tremoloSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -635,7 +635,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
vibratoSlider->setRange (7, 14, 7);
vibratoSlider->setSliderStyle (Slider::LinearHorizontal);
vibratoSlider->setTextBoxStyle (Slider::TextBoxRight, true, 32, 20);
- vibratoSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
+ vibratoSlider->setColour (Slider::thumbColourId, Colour (0xff007f00));
vibratoSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
vibratoSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
vibratoSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
@@ -665,10 +665,12 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter)
addAndMakeVisible (feedbackSlider = new Slider ("feedback slider"));
feedbackSlider->setRange (0, 7, 1);
- feedbackSlider->setSliderStyle (Slider::LinearVertical);
+ feedbackSlider->setSliderStyle (Slider::RotaryVerticalDrag);
feedbackSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 30, 20);
feedbackSlider->setColour (Slider::thumbColourId, Colour (0xff00af00));
feedbackSlider->setColour (Slider::trackColourId, Colour (0x7f007f00));
+ feedbackSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff00af00));
+ feedbackSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff007f00));
feedbackSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00));
feedbackSlider->setColour (Slider::textBoxBackgroundColourId, Colours::black);
feedbackSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff00af00));
@@ -1849,7 +1851,7 @@ void PluginGui::resized()
vibratoSlider->setBounds (149, 456, 80, 24);
frequencyLabel6->setBounds (40, 456, 96, 24);
dbLabel6->setBounds (230, 448, 48, 40);
- feedbackSlider->setBounds (190, 203, 30, 88);
+ feedbackSlider->setBounds (190, 232, 30, 59);
frequencyLabel7->setBounds (190, 293, 30, 24);
velocityComboBox->setBounds (244, 249, 72, 24);
velocityComboBox2->setBounds (672, 249, 72, 24);
@@ -2487,7 +2489,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
@@ -2498,7 +2500,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
@@ -2509,7 +2511,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
@@ -2520,7 +2522,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
@@ -2530,7 +2532,7 @@ BEGIN_JUCER_METADATA
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
+ virtualName="" explicitFocusOrder="0" pos="190 232 30 59" thumbcol="ff00af00"
+ trackcol="7f007f00" rotarysliderfill="ff00af00" rotaryslideroutline="ff007f00"
+ textboxtext="ff007f00" textboxbkgd="ff000000" textboxhighlight="ff00af00"
+ min="0" max="7" int="1" style="RotaryVerticalDrag" textBoxPos="TextBoxBelow"
+ textBoxEditable="0" textBoxWidth="30" textBoxHeight="20" skewFactor="1"
+ needsCallback="1"/>