Auto-detect and apply DPI scaling for old plugins

Hi jucers,

As of 2024, do you have any recommendation on how to handle DPI scaling for external plugins that don’t do it themselves? I see that most hosts are already doing it well now so I assume there is a way.

EDIT: Well another thread just appeared and shows that Ableton is actually not doing it well (just applying a scaling to every plugin)! The question would be then, is there a way?

How would you recommend finding out if a plugin adapts already to the screen DPI?

How do you apply the scaling? I have tried to apply an AffineTransform::scale to the plugin editor but it jasserts to encourage me to use setScaleFactor (which doesn’t work for old plugins). In any case, after the transform, the part of the UI beyond its original boundaries appears in black. Why is it so? I remember some major DAW’s experiencing those issues one year ago, so I imagine is a common pitfall.

Any hints are appreciated! Thanks!

Don’t apply the affine transform to the editor itself. Apply it to a child component that shares bounds with the editor.

1 Like

Thanks Quilio, but I should have specified that I’m trying to host external plugins so I don’t have access to their child components. I’ve also tried the opposite, applying a transform to the parent component of the plugin (window in which it is displayed) and I’m having the same issue.

Ah, I understand now.

Is there absolutely no way to get access to the child component?

I’m interested because I can see this problem coming up in our workflow (we’re working on a node based editor that hosts other plugins)

For old plugins that aren’t DPI aware, the only option is to get the OS to auto-scale the plugin. This will make the editor appear at the same scale as the desktop, but the contents of the editor will appear blurry due to the scaling.

The AudioPluginHost includes an option to enable/disable auto-scaling for each plugin. You can change this setting by right-clicking on a loaded plugin node in the graph view and using the “Auto-scale window” menu entry. Inspect the source of the AudioPluginHost to see how this feature is implemented.

Thanks much @reuk! I had missed that option in AudioPluginHost.

Now the only issue remaining is how to auto-detect the need of auto-scaling.