IPlugResponsiveUI AUv3 doesn't resize with "Switch View Mode" button

I’m trying to understand how the resizing mechanisms work for AUv3s, and so I thought I’d see it in action with the IPlugResponsiveUI example using an iPad simulator and the AUv3Host for iOS (the one Oli recently suggested testing with, which actually works quite well).

I put a breakpoint in OnParentWindowResize(), and it does get called when simulating a rotation (eg from portrait to horizontal mode), however it’s not called when using the the “Switch Veiw Mode” button in the host and nothing happens.

I understand there are some functions to overload to tell the host resizing is possible (via OnHostRequestingSupportedViewConfiguration), and give min/max sizes and so on. Though i feel the connection between the host setting the viewConfiguration and iPlug is missing, because nothing in iPlug ends up being called (from what i can tell).

@olilarkin Is there anything you could look at or advise me on to make this work, specifically, setting different sizes (aka viewConfigurations) from the host app?

Many thanks,
kurt

Aha, i see that OnHostSelectedViewConfiguration() gets called, though I’m not sure what to do in that function; I tried doing that same as in OnParentWindowResize(), but that corrupts everything and it eventually crashes (however it does kind of resize :wink:

Here’s what it looks like after clicking the “Switch View Mode”, though it gets unstable and crahes:

Another update:
I also see the min width and height for the plugin is 256x256, and the small viewConfig from the host is 100x400. So i guess it’s not even designed to work at 100x400, and the controls are drawing over each other causing all kinds of chaos.

But if i want my plugin to work at the requsted size, what do I actually need to do to make resizing work; should this be enough (given that all my controls would layout correctly within the given size)?

if(GetUI())
    GetUI()->Resize(width, height, 1.f, false);

and what about the last arg, needsPlatformResize, when should that be true or false?
Do I need to call IPlugAPIBase::EditorResize() too?

thanks very much

I’ve pushed some commits which should help, and I’ve confirmed they work on a real device in AUM and Garageband. AUv3Host is not an ideal host to test with TBH.

Firstly, I had to defer the call to OnHostSelectedViewConfiguration() onto the main thread. After implementing OnHostSelectedViewConfiguration() in the example and resizing the IGraphicsUI accordingly (setting the minimum size to 100x100 in config.h, it fails when loaded in AUv3Host because the AudioUnit view frame doesn’t get changed (by the host), and OnParentWindowResize() gets called with dimensions that don’t match the selected view configuration (so the view doesn’t change size). Comment out the resize call in OnParentWindowResize() and it works in AUv3 host (but this causes problems in Garageband where the initial view is not the correct size)

1 Like