Macos doesnt draw correctly

hi, im currently working on a very simple implementation of a gain plugin. just one knob. pretty basic.

my issue is, that i have a custom look and feel and my slider just stopped drawing its thumb correctly. i tried to go back to a older commit but it didn’t seem to have an impact. note, that this only happens on the standalone app but not on the plugin versions.

this shouldn’t be related to that but the last step before it stopped working was removing the comment from `COPY_PLUGIN_AFTER_BUILD TRUE` to enable the copy step.

here is my `drawRotarySlider` function:

void PureGainLookAndFeel::drawRotarySlider(
    juce::Graphics &g,
    int x,
    int y,
    int width,
    int height,
    float sliderPos,
    float rotaryStartAngle,
    float rotaryEndAngle,
    juce::Slider &slider
  )
{
  juce::Colour backgroundColour = slider.findColour(juce::Slider::backgroundColourId);
  juce::Colour thumbColour = slider.findColour(juce::Slider::thumbColourId);

  juce::Rectangle<float> bounds;
  bounds = juce::Rectangle<int>(x, y, width, height).toFloat();
  float radius = bounds.getWidth() / 2.f;
  float centreX = bounds.getCentreX();
  float centreY = bounds.getCentreY();
  float angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);

  float pointerLength = radius-20;
  float pointerThickness = 20.f;
  float pointerCenter = pointerThickness/2;
  float pointerYOffset = -20;

  g.setColour(backgroundColour);
  g.fillEllipse(bounds);

  juce::Path pointer;
  pointer.addRectangle(pointerCenter, pointerYOffset, -pointerThickness, -pointerLength);
  g.setColour(thumbColour);
  g.fillPath(pointer, juce::AffineTransform::rotation(angle).translated(centreX, centreY));
}

before:

after (containing the bug?):

This is where learning some debugging skills comes in handy. :wink:

Change the color of the thumb from black to red. Does the thumb perhaps show up now? (It would be in the wrong position but you can’t tell that if it’s drawing black on black, which is why you’d change the color.)

Don’t apply the transformation. Does the thumb draw now? If not, change the position of the thumb rectangle to (0, 0, 100, 100) or whatever. If it’s still not drawing, then the version of the code you’re looking at probably isn’t the thing that is currently running.

If it draws without the transform but not with, then simply the transform until you figure out which part is broken.

And so on…

hi, thanks for your reply. the issue is, that on plugin versions (au and vst3) on mac, it works correctly and also on linux standalone.

The standalone app is a small hosts that loads the plug-in code as if it were a plug-in, so there’s no reason why standalone would act differently.

At this point I would delete the plug-ins from your system and rebuild everything, so make sure the plug-ins (and standalone) really do get recompiled and that you’re not looking at older versions.

i just tested it again by chaining the color to blue and it still wont show in the standalone app but in reaper the change is shown correctly.

if you want to take a look at the code: ~dystiv/puregain - puregain audio plugin. - sourcehut git

i don’t know why there is this issue since it only happens on macos in standalone mode. maybe a bug in juce?

even in “AudioPluginHost” the ui is drawn correctly.

got it fixed. the issue was, that my app stored an out of bounds value for the slider. i needed to go to options>reset to default state on my standalone app.

i don’t know if this is a bug but i think so.

i stored my parameter from `-24` to `24` before and the slider was stored on `-24`. when changing the values to `-12` to `24`, the thumb just would not show up. this was the cause of the issue.

seems that this was not the issue but reseting to the default state solved it.