I am working on a plugin host for a sound effects database, This module lives in a DLL and is based on Juce. I am on Windows with a HiRes monitor right now and I see issues with plugin UI scaling. I set the scale factor on the AudioProcessorEditor to match the host app, which works on half the plugin I tested but the other ones are tiny, I can not find out, how to handle plugin scaling thru the high level Juce API correctly,
There’s a demo project named HostPluginDemo in the JUCE repository that shows how to host plugin editors from a plugin. The procedure should be pretty similar for a DLL.
If you’re referring to AudioProcessorEditor::setScaleFactor, then this is the correct approach. Note that not all plugins on Windows support setting a custom scale. For plugins that aren’t DPI-aware, there are basically two options:
- you can draw the editor at its native size (i.e. very small), or
- you can ask the OS to automatically ‘stretch’ the window so that it appears at the same scale as the desktop, although with scaling artefacts (visible pixels, blur).
If a plugin is not responding to setScaleFactor, I recommend testing it in some other hosts to see how it behaves there. If the editor is very pixellated, or draws at a very small size, then it’s most likely that the plugin is not DPI-aware.
If you want to support automatic scaling for non-DPI-aware plugins, it’s a bit awkward but it can be done. Auto-scaling can only be enabled on top-level windows, so the new plugin editor will need to be opened in a new floating window, and you’ll need to use a ScopedDPIAwarenessDisabler when creating that window.
When using ScopedDPIAwarenessDisabler, there are some plugins where the editor isn’t added to the editor window that I created, but appears on the desktop in the upper left corner.
