in the AAX wrapper GetViewContainer()->SetViewSize(newSize) can FAIL
this can happen when the plugin is too big (like described in the comments) but also if the offscreen bounds of the plugin are too big.
The result is that the internal size, and the window size are different, which may hide important controls in the plugin (including resize-symbol)
This is a fix for the AAX Wrapper
It remembers the last successful resizing of the plugin, and if it wasn’t successful, it just applies the old size to the internal plugin again.
A listener-loop (because of the component lister) should not happen, because it checks if the current size is equal to the new size)
Point<int> lastCorrectSize;
void childBoundsChanged(Component*) override
{
if (pluginEditor != nullptr)
{
auto w = pluginEditor->getWidth();
auto h = pluginEditor->getHeight();
if (lastCorrectSize.isOrigin() || lastCorrectSize.getX() != w || lastCorrectSize.getY() != h)
{
AAX_Point newSize((float)h, (float)w);
if (owner.GetViewContainer()->SetViewSize(newSize) != AAX_SUCCESS)
{
// Because setViewSize has failed, we have set the internal plugin-size to the same size
// this is tricky because the constrainer may not allow smaller bounds, but if we don't do it the internal size
// is bigger than UI element, and may hide important controls;
auto bounds=pluginEditor->getBounds();
bounds.setWidth(lastCorrectSize.getX());
bounds.setHeight(lastCorrectSize.getY());
pluginEditor->setBoundsConstrained(bounds);
}
else
{
lastCorrectSize.setXY(w, h);
setSize(w, h);
};
};
}
}
Thanks I’ve pushed a fix for this to develop (it will appear shortly). Just to avoid this in the future - with which compiler are you seeing this. Our CI system did not flag this and we build with VS2015 and VS2017, Xcode.
Digging into juce_audio_plugin_client_AAX.cpp (JUCE 8.0.14), I can see the childBoundsChanged/resizeHostWindow mechanism already does what the 2018 thread proposed (checking SetViewSize’s return value):
Setup: JUCE 8.0.14, Pro Tools Developer (latest). Plugin works fine in VST3/AU — issue is AAX-only.
Symptom: On first insert on a new track, the editor opens at a much smaller size than the frame Pro Tools reserves (grey gap around it). Dragging the corner manually fixes it instantly.
My read of the code: lastValidSize defaults to an empty Rectangle. If SetViewSize fails on the very first childBoundsChanged call (likely because the host’s ViewContainer isn’t fully ready yet when the editor first reports its size), the editor gets clamped down to lastValidSize (0x0, constrained to the resize limits minimum) instead of the size I actually requested in the constructor. This would explain both the small initial size AND why repeatedly retrying setSize() from a timer didn’t help — each retry re-triggers childBoundsChanged, and if the host still isn’t ready, it gets clamped back down again.
Questions:
Is this understanding correct?
Is there a known timing/readiness signal I should wait for before requesting my initial size, to avoid landing in the SetViewSize-fails branch?
Would initializing lastValidSize to the intended starting size (rather than leaving it default-constructed) be a reasonable local patch, or is there a cleaner supported way to influence the initial AAX view size?