Since moving my plugin to the juce wrapper instead of my own, I have a report of an issue in the VST2 version in Cubase on OSX.
When changing in the UI the actual plugin size, the user got this.
This works fine in Reaper and Live.
In my code I only call setSize with the new size.
I don’t call setResizable as the only size changes come from my plugin itself. (no resize corner)
Does this ring a bell to someone ? (using juce develop trunk)
Thanks for putting together a code example, that’s really helpful. I’ve put together a patch which should fix this issue, which I’ll push once it has been reviewed and tested a bit more thoroughly.
It fixes the main plugin issue, but it looks like something else has been broken in the meantime.
The menu is called like that m.showAt(componentToAttachTo, 1, 100, 1, 20);
Can you provide some more details, please? It’d be useful to know how this editor is configured. Do you see the same issue in any of the JUCE demo plugins?
Is the behaviour you’re seeing in that gif definitely new, or was it also present before the NSViewComponentPeer changes (e.g. in commit ec43c7f61c)?
I tried modifying the DSPModulePluginDemo with a similar setup and it seems to work fine, for the most part. Jumping from 10x scaling down to 1x scaling sometimes fails to refresh the view properly, but I’m seeing the same behaviour on ec43c7f61c. Other than that, the window size and scale update appropriately.
I compute the original width and height in my code given the actual width and height with the previous scale.
Looks like getWidth and getHeight is in that case limited by the screen size, so maybe you cannot have a plugin size bigger than the original one. hence my issue when getting back to smaller scaling
Is there any way you can test whether this was an issue before the recent NSViewComponentPeer changes? If it was, then I’d be inclined to say that this is a bug in your code. If this is a new regression, then I’ll attempt to fix it in JUCE.
Alright, I’m seeing the same behaviour before the NSViewComponentPeer changes, so this is not a new regression.
It looks like in the AAX wrapper, resize requests to the host may fail. In this case, the editor is reset to the last known-good size. We don’t have a dedicated way to signal this failure in the JUCE API at the moment, but it’s quite easy to check whether the size actually changed to the expected value after calling setSize:
void updateScale (float newScale)
{
const auto oldScale = std::exchange (scale, newScale);
const auto oldBounds = getLocalBounds();
setSize (scale * getWidth() / oldScale, scale * getHeight() / oldScale);
// Check if the resize succeeded
if (getLocalBounds() == oldBounds)
{
// The resize failed, revert to the previous scale
scale = oldScale;
resized();
}
else
{
widget.setTransform (AffineTransform::scale (scale));
}
}
To be clear, the AAX wrapper is refusing to accept the requested size. There’s nothing we can do in JUCE to force the requested editor size. If there’s a chance that you’ll request a very large editor size, you should add some checks in your code to ensure that the new size is what you expect.