# Dial Rotate

**URL:** <https://forum.juce.com/t/dial-rotate/64333>\
**Category:** General JUCE discussion\
**Created:** [November 21, 2024, 1:35pm UTC](https://forum.juce.com/t/dial-rotate/64333 "2024-11-21T13:35:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 21, 2024, 1:35pm UTC](https://forum.juce.com/t/dial-rotate/64333/1 "2024-11-21T13:35:06Z")

</div>

Hello

I have made a custom look and feel class for my dial to rotate, But it won’t rotate even though it comes up on the interface, Does anyone have any idea how to rectify this? Thanks.

---

<div class="post-metadata">

**Author:** ![ibisum](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ibisum/32/21288_2.png) [@ibisum](https://forum.juce.com/u/ibisum)\
**Post date:** [November 21, 2024, 1:39pm UTC](https://forum.juce.com/t/dial-rotate/64333/2 "2024-11-21T13:39:26Z")

</div>

Not going to be an easy question to answer without seeing your code - there could be multiple reasons things aren’t working.

---

<div class="post-metadata">

**Author:** ![mihai](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mihai](https://forum.juce.com/u/mihai)\
**Post date:** [November 21, 2024, 3:30pm UTC](https://forum.juce.com/t/dial-rotate/64333/3 "2024-11-21T15:30:33Z")

</div>

I do something like this

```
addAndMakeVisible(mVelModSlider);
mVelModSlider.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
mVelModSlider.hideTextBox(true);
mVelModSlider.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, true, 1, 1);
mVelModSlider.setRange(0, 127);
mVelModSlider.setValue(64);
mVelModSlider.setColour(juce::Slider::rotarySliderFillColourId, juce::Colours::green);
mVelModSlider.setColour(juce::Slider::rotarySliderOutlineColourId, juce::Colours::darkgrey);
mVelModSlider.setColour(juce::Slider::thumbColourId, juce::Colours::transparentBlack);
mVelModSlider.addListener(this);

```

---

<div class="post-metadata">

**Author:** ![HowardAntares](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/howardantares/32/4629_2.png) [@HowardAntares](https://forum.juce.com/u/HowardAntares)\
**Post date:** [November 21, 2024, 4:52pm UTC](https://forum.juce.com/t/dial-rotate/64333/4 "2024-11-21T16:52:47Z")

</div>

Just a wild guess, but could using transparentBlack for the thumb be the problem? Would that show up over the green background of the slider?

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 21, 2024, 6:56pm UTC](https://forum.juce.com/t/dial-rotate/64333/5 "2024-11-21T18:56:33Z")

</div>

Thanks for that, I’ve done that part what did you put in the plugineditor.h file

> ![](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/5/4/54107dd03ddecefea100f271e783bec27119ff17.png "mihai") | [mihai](https://forum.juce.com/u/mihai)  
> November 21 |
> 
> - | - |

I do something like this

```auto
addAndMakeVisible(mVelModSlider);
mVelModSlider.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
mVelModSlider.hideTextBox(true);
mVelModSlider.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, true, 1, 1);
mVelModSlider.setRange(0, 127);
mVelModSlider.setValue(64);
mVelModSlider.setColour(juce::Slider::rotarySliderFillColourId, juce::Colours::green);
mVelModSlider.setColour(juce::Slider::rotarySliderOutlineColourId, juce::Colours::darkgrey);
mVelModSlider.setColour(juce::Slider::thumbColourId, juce::Colours::transparentBlack);
mVelModSlider.addListener(this);

```

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 21, 2024, 6:57pm UTC](https://forum.juce.com/t/dial-rotate/64333/6 "2024-11-21T18:57:21Z")

</div>

Will send over the code later. Thanks.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [November 21, 2024, 7:51pm UTC](https://forum.juce.com/t/dial-rotate/64333/7 "2024-11-21T19:51:04Z")

</div>

> [@mihai](#):
>
> ```auto
> mVelModSlider.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
> mVelModSlider.hideTextBox(true);
> mVelModSlider.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, true, 1, 1);
> 
> ```

You can remove all that, if you declare your slider like this:

```auto
juce::Slider mVelModSlider { juce::Slider::RotaryVerticalDrag, juce::Slider::NoTextBox };

```

But unrelated to your problem… the transparentBlack sounds like a good lead

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 22, 2024, 12:03pm UTC](https://forum.juce.com/t/dial-rotate/64333/8 "2024-11-22T12:03:56Z")

</div>

![Inline image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/3/3/331d288ddeeeba279082a1e4c9ab5fd0344e359f.png "Inline image") ![Inline image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/b/4/b43fc425adea2849640bb6152c2344d998a39808.png "Inline image")

This is from the plugineditor.cpp and .h

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 22, 2024, 12:28pm UTC](https://forum.juce.com/t/dial-rotate/64333/9 "2024-11-22T12:28:28Z")

</div>

I have done those parts already, But what did you put in the plugineditor.h file for your dial to come on the interface, Not the default slider

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 22, 2024, 12:29pm UTC](https://forum.juce.com/t/dial-rotate/64333/10 "2024-11-22T12:29:57Z")

</div>

I have done those parts already, But what did you put in the plugineditor.h file for your dial to come on the interface, Not the default slider but your own slider? Thanks

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 22, 2024, 12:30pm UTC](https://forum.juce.com/t/dial-rotate/64333/11 "2024-11-22T12:30:08Z")

</div>

Thanks.

---

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [November 22, 2024, 12:39pm UTC](https://forum.juce.com/t/dial-rotate/64333/12 "2024-11-22T12:39:04Z")

</div>

idk if it’s related to your issue but since this is for a plugin you better get into the habit of not using Slider::Listener but SliderAttachment to attach a parameter to a slider. cause then information about the parameter state is owned by the parameter only and the slider only visualizes it. in practice that means you don’t have to call setValue, setRange and all that on your sliders anymore. they know this automatically from the attachment then. the only methods left in your editor are purely about the look and feel then which is less errorprone and easier to read as well

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [November 25, 2024, 10:38am UTC](https://forum.juce.com/t/dial-rotate/64333/13 "2024-11-25T10:38:11Z")

</div>

Thanks fro that but i am getting this one error.

> **(attachments)**
>
> ![Screenshot 2024.png](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/2/2/22f20120b8bf225e42abd4b359203fe0872580e1.png)

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [December 11, 2024, 9:57am UTC](https://forum.juce.com/t/dial-rotate/64333/14 "2024-12-11T09:57:42Z")

</div>

Thanks for getting back to me, But i am still getting this, If i sent you the file are you able to do this? Thanks.

---

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [December 11, 2024, 4:27pm UTC](https://forum.juce.com/t/dial-rotate/64333/15 "2024-12-11T16:27:12Z")

</div>

i would read the code, yes

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [December 11, 2024, 6:10pm UTC](https://forum.juce.com/t/dial-rotate/64333/16 "2024-12-11T18:10:10Z")

</div>

I am trying to upload the file, But it said it is to big.

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [December 13, 2024, 8:26am UTC](https://forum.juce.com/t/dial-rotate/64333/17 "2024-12-13T08:26:02Z")

</div>

This is the plugineditor.cpp //setLookAndFeel(&customLookAndFeel);  
// Make sure that before the constructor has finished, you’ve set the  
// editor’s size to whatever you need it to be.

```
//Load Images

```

// knob1= juce::ImageFileFormat::loadFrom(BinaryData::BlackDials\_png, BinaryData::BlackDials\_pngSize);  
// knob2= juce::ImageFileFormat::loadFrom(BinaryData::BlackKnob2\_png, BinaryData::BlackKnob2\_pngSize);  
// SwitchUP = juce::ImageFileFormat::loadFrom(BinaryData::switchmetal1\_png, BinaryData::switchmetal1\_pngSize);  
// SwitchDown = juce::ImageFileFormat::loadFrom(BinaryData::switchmetal2\_png, BinaryData::switchmetal2\_pngSize);  
// Slider3 = juce::ImageFileFormat::loadFrom(BinaryData::slider3\_png, BinaryData::slider3\_pngSize);  
// Led\_Clear = juce::ImageFileFormat::loadFrom(BinaryData::led\_clear\_png, BinaryData::led\_clear\_pngSize);  
// Led\_Red = juce::ImageFileFormat::loadFrom(BinaryData::led\_red\_png, BinaryData::led\_red\_pngSize);

```
/* addAndMakeVisible(Switch);
Switch.setImages(false, false, true,
    SwitchUP, 1.0, {}, juce::Image(), 1.0, {},
SwitchDown, 1.0f, {});
Switch.setToggleable(true);
Switch.setToggleState(false, juce::dontSendNotification);
Switch.onClick = [this]
    {
        if (Switch.getToggleState() == false)
        {
            Switch.setToggleState(!Switch.getToggleState(), juce::dontSendNotification);
        }
        else if (Switch.getToggleState() == true)
        {
            Switch.setToggleState(!Switch.getToggleState(), juce::dontSendNotification);
        }
        audioProcessor.OnOff = Switch.getToggleState();
    }; */

setSize (600, 350);

```

// setResizable(true, true);  
// setResizeLimits(575, 218.5, 700, 700);  
// getConstrainer()-\>setFixedAspectRatio(1.0);

addAndMakeVisible(gain);

// auto\* param = dynamic\_castjuce::AudioParameterFloat\*(audioProcessor.getParameters()[0]);

```
gain.setRange(0.0,100.0,0.1);
gain.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
gain.setTextBoxStyle(juce::Slider::TextBoxBelow, false,55,20);
gain.setTextValueSuffix("dB");
gain.setColour(juce::Slider::ColourIds::textBoxTextColourId, juce::Colours::white);
gain.centreWithSize(150, 250);
gain.setDoubleClickReturnValue(true, 0.0);
gain.setValue(-100);
gain.onValueChange = [this]() {
  float gainVal = juce::Decibels::decibelsToGain((float)gain.getValue());
  *dynamic_cast<juce::AudioParameterFloat*>(audioProcessor.getParameters()[0]) = gainVal;

```

plugineditor.h #pragma once

#include \<JuceHeader.h\>  
#include “PluginProcessor.h”  
//#include “ImageKnob.h”  
//#include “CustomLookAndFeel.h”

//==============================================================================  
/\*\*  
\*/  
class DistortionAudioProcessorEditor : public juce::AudioProcessorEditor  
{  
public:  
DistortionAudioProcessorEditor (DistortionAudioProcessor&);  
~DistortionAudioProcessorEditor() override;

```
//==============================================================================
void paint (juce::Graphics&) override;
void resized() override;

```

private:  
// This reference is provided as a quick way for your editor to  
// access the processor object that created it.  
DistortionAudioProcessor& audioProcessor;

```
juce::Image background,Blackknob2,SwitchUP,SwitchDown,BlackDials,LedRed,LedClear,Slider3;
juce::Slider gain;
juce::Slider low ;
juce::Slider high;
juce::Slider crunch;
juce::ComboBox DropdownMenu;

// Attachments sliders with parameters
 std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> gainAttachment;
 std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> crunchAttachment;
 std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> lowAttachment;
 std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> highAttachment;

// This reference is provided as a quick way for your editor to
// access the processor object that created it.

```

// GainAudioProcessor& audioProcessor;

```
// Custom look and feel

```

// CustomLookAndFeel customLookAndFeel;

```
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DistortionAudioProcessorEditor)

```

};

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [December 13, 2024, 8:26am UTC](https://forum.juce.com/t/dial-rotate/64333/18 "2024-12-13T08:26:32Z")

</div>

Thanks

---

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [December 13, 2024, 1:28pm UTC](https://forum.juce.com/t/dial-rotate/64333/19 "2024-12-13T13:28:09Z")

</div>

ok so here are the things that stand out to me, without knowing if any of these fixes your problem:

1. you initiate a lot of slider/knob-related images in the editor. i think those belong into your custom lookAndFeel class, where you use them to implement the sliders’ look and feel.
2. the switch is related to the audioProcessor, so it should probably represent a plugin parameter and thus be solved with ButtonAttachment instead of manually setting the click behaviour and stuff
3. the gain parameter should also not need all these method cals with setTextValueSuffix and setValue etc, because you use the SliderAttachments for that
4. you have a lot of inconsistency with uppercase and lowercase variables. that’s confusing to read because i’m used to uppercase words relating to class names and constexprs
5. the sliderAttachments don’t need to be wrapped in unique\_ptrs, unless you wanna dynamically reasign sliders to other parameters sometimes. it doesn’t look like it. instead you can initialize them in the initializer list. make sure that the slider was initialized before its attachment.
6. there is no lookAndFeel code in the code you are showing, so idk why your images don’t do the right thing

---

<div class="post-metadata">

**Author:** ![jim1](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jim1](https://forum.juce.com/u/jim1)\
**Post date:** [December 17, 2024, 11:15am UTC](https://forum.juce.com/t/dial-rotate/64333/20 "2024-12-17T11:15:24Z")

</div>

Thanks for getting back to me, As the file size is to big to send via the website is there another way to send the file?

> > [Mrugalla](https://forum.juce.com/u/mrugalla)  
> > December 13 |
> 
> - | - |

ok so here are the things that stand out to me, without knowing if any of these fixes your problem:

1. you initiate a lot of slider/knob-related images in the editor. i think those belong into your custom lookAndFeel class, where you use them to implement the sliders’ look and feel.
2. the switch is related to the audioProcessor, so it should probably represent a plugin parameter and thus be solved with ButtonAttachment instead of manually setting the click behaviour and stuff
3. the gain parameter should also not need all these method cals with setTextValueSuffix and setValue etc, because you use the SliderAttachments for that
4. you have a lot of inconsistency with uppercase and lowercase variables. that’s confusing to read because i’m used to uppercase words relating to class names and constexprs
5. the sliderAttachments don’t need to be wrapped in unique\_ptrs, unless you wanna dynamically reasign sliders to other parameters sometimes. it doesn’t look like it. instead you can initialize them in the initializer list. make sure that the slider was initialized before its attachment.
6. there is no lookAndFeel code in the code you are showing, so idk why your images don’t do the right thing
