Audio Unit setGlobalScaleFactor window clipping issue

Hi everyone, I’m still fairly new to JUCE, just doing a project using it and so far it’s been quite nice to work with, but I have run across what may be a bug with gui scaling and clipping bounds in Audio Units.

[Some edits here because I managed to confuse myself a bit before…]

I’m building a both a standalone version and AU plugin version of the app, and they behave differently when using setGlobalScaleFactor() and setSize(), but that’s not a big issue in itself.

This is what I do in the standalone version which seems to work nicely:

setSize(originalEditorWidth, originalEditorHeight);

This is what I have to do in the plugin version to get the window to resize:

setSize(scale * originalEditorWidth, scale * originalEditorHeight);

For some reason the setSize() dimensions need to be scaled only in the plugin version, and that would be fine if it worked. However, it’s like the clip area then gets scaled down twice in the plugin, so it ends up smaller than the window, and only part of the plugin gets painted!

I have tried spelunking through the framework code a bit now, but as I’m a noob I can’t find an obvious fix for the clipping problem.

If anyone can help with this I’d be ever so happy!

Thanks, Jules
(No, not that Jules, I’m another Jules. Maybe just call me jc_lounge or Julian to avoid confusion! :slight_smile: )

Hi all, replying to my own post just to clarify, maybe I should have mentioned more prominently that the problem is only visible when the scale is less than 1.

If the scale is greater than 1, I am guessing the clip area becomes larger than the window, so the clipping problem is not visible. But with e.g. scale = 0.5, it only paints the top left quarter of the window contents in the plugin version.

Any help would be greatly appreciated, it’s tantalisingly close to working, but I just can’t quite get it happening.

Best regards,

The whole global-scale-factor thing never worked in plugins until yet, i think there a lot of adjustments in the wrappers required to make this work.
Until now i put my whole plugin gui in a component and transform that.

1 Like

Thanks chkn! That’s a bit of a shame, but at least it’s getting there by the sound of things.

Your suggestion seems pretty good, although if I understand correctly it means I have to also scale popup/combo menus separately. Still, it could be worse. Actually, this way I would get to control menu scaling so it doesn’t go down as far as the main window scaling, so it may work out for the best in the end hopefully.


Hi jc_lounge,

Unfortunately chkn is right. We do not support global scale factors for plug-ins yet. This is also due to the plug-in format specs (VST/VST3/AAX) not specifying how to deal with scaling of DAWs etc. especially on Windows. I think there are some extensions being proposed currently.


Hi fabian,

Fair enough, that’s something to look forward to if it gets sorted out across the board. It’s very close to spot on with AUs already, just the scaling down thing doesn’t quite work yet. Chkn’s suggestion seems to have panned out nicely in the mean time.

Thanks guys!