VST3 scaling factor on Windows

Hi,

I’m fighting a bit with the changes of JUCE 6 related to the plugin scaling factor on Windows, as my images appear very blurry in VST hosts when the windows scaling is not 100%.

I understand that there is the function AudioProcessorEditor::setScaleFactor that is called with the actual scale, but the problem is that this information is not yet available during the construction of the AudioProcessorEditor.

Is it possible to provide the scale factor during AudioProcessor::createEditor ?

Hi,

I might have the same issue. I’m using SVGs in the GUI of my VST3 plugin, rendering the SVG to a juce::Image in the resized() method. To take into account the DPI for high-DPI displays, I get the scale factor using getApproximateScaleFactorForComponent(this).

This works perfectly when I’m manually resizing the window, but unfortunately it does not work when the VST3 editor is created :

  1. setSize is called in the editor constructor
  2. resized is then called several times (but the scale factor I get is always 1)
  3. setEditorScaleFactor is called in the VST3 wrapper and sets the right factor (2.5 in my case), but it is too late (the bounds have been set and resized is not called again).

It seems that checkHostWindowScaleFactor() is called too late in the VST3 wrapper, do you think it would be possible to set this factor sooner ?

My setup

  • JUCE 6.1.5
  • Windows Version 10.0.19044 Build 19044
  • JUCE Plugin Host with “Auto-scale window” set to disabled (which seems to enable high dpi support)

Thanks for your help

This function may be called repeatedly after construction, as the scale factor may change if the editor is dragged to a new display. Maybe you could override AudioProcessorEditor::setScaleFactor and re-render your images there (remember to call the base class implementation from the overriding function!).

I’d also recommend checking out the juce7 branch, as the VST3 resizing behaviour has been partially rewritten there.

1 Like

Thanks for your reply, overriding AudioProcessorEditor::setScaleFactor() worked! I’m now rendering the images again when the scale factor changes, instead of waiting for a call to resized().

I will definitely check the JUCE 7 branch in the future to check if this is still needed.