Skip to main content
The IPlugResponsiveUI example demonstrates how to create plugin interfaces that dynamically adapt to different window sizes. This is essential for supporting resizable plugin windows and different screen sizes.

What This Example Demonstrates

  • Dynamic layout calculation based on window bounds
  • Runtime control repositioning on resize
  • Host-requested view configuration support (AUv3)
  • Using mLayoutFunc for responsive control placement

Key Implementation Details

Layout Function

The layout function recalculates control positions whenever the window is resized:

Rectangle Utilities

FracRectVertical

Divides a rectangle vertically into fractional parts

GetPadded

Adds padding/margin to a rectangle

ReduceFromRight

Carves out space from the right edge

GetBounds

Returns the current window bounds

Host View Configuration

Support for host-requested resize (especially important for AUv3):
OnHostRequestingSupportedViewConfiguration is primarily used by AUv3 hosts to query if your plugin supports specific window dimensions.

Audio Processing with Visualization

The example includes a scope visualization that displays the audio output:
The IBufferSender sends audio data from the audio thread to the UI thread safely, where it’s displayed by the IVScopeControl.

Building Responsive Layouts

1

Enable layout on resize

Call pGraphics->SetLayoutOnResize(true) to enable dynamic relayout.
2

Define layout logic

Create a function that calculates control bounds based on current window size.
3

Handle existing controls

Check if controls already exist and update their positions using SetTargetAndDrawRECTs().
4

Implement view configuration

Override OnHostRequestingSupportedViewConfiguration and OnHostSelectedViewConfiguration for AUv3 support.

Common Layout Patterns

Always check if controls exist before repositioning them. The layout function is called both during initial setup and on resize.
  • Web UI - Alternative approach using web technologies
  • SwiftUI - Native macOS/iOS UI with automatic layout