Skip to content

VST3: declare setContentScaleFactor with PLUGIN_API (fixes the 32-bit Windows build) - #650

Merged
defiantnerd merged 2 commits into
free-audio:nextfrom
webprofusion-chrisc:vst3-plugin-api-scale-factor
Nov 26, 2026
Merged

defiantnerd merged 2 commits into
free-audio:nextfrom
webprofusion-chrisc:vst3-plugin-api-scale-factor

Conversation

@webprofusion-chrisc

Copy link
Copy Markdown

IPlugViewContentScaleSupport::setContentScaleFactor is declared PLUGIN_API, which is
__stdcall on 32-bit Windows. WrappedView overrides it without PLUGIN_API, so an x86 build of
the VST3 wrapper fails. Every other IPlugView override in plugview.h already has the macro.

On main (c3a2531), MSVC 19.52:

vcvarsall x86:
src\detail\vst3\plugview.h(84): error C2695: 'WrappedView::setContentScaleFactor': overriding virtual
function differs from 'Steinberg::IPlugViewContentScaleSupport::setContentScaleFactor' only by calling convention
vcvarsall x64: builds

With this change, plugview.cpp builds for both x86 and x64. Compiling the rest of the VST3
sources for x86 showed no other calling-convention errors. On other platforms PLUGIN_API is
empty, so nothing changes there.

We have shipped this in a 32-bit Windows build (standalone, CLAP and VST3) since mid-November.

defiantnerd and others added 2 commits November 19, 2026 18:41
# clap-wrapper 0.18.0

Includes everything that was prepared for 0.17.1, which was never released.

### AUv2
- ARA 2 support through the ARA Audio Unit properties: `kAudioUnitProperty_ARAFactory` returns the CLAP's ARA factory, `kAudioUnitProperty_ARAPlugInExtensionBindingWithRoles` binds to the host's document controller, and the deprecated ARA 1 binding binds with the playback renderer, edit renderer and editor view roles. The properties are only advertised when the CLAP has the ARA extension, and the build helper adds the `ARA` tag to the AudioComponents entry (free-audio#617).
- `kAudioUnitProperty_OfflineRender` reaches the plugin through `clap.render`, so a CLAP learns it is bouncing faster than real time. A plugin with a hard realtime requirement stays in realtime (free-audio#640).
- `Reset` is forwarded: the process and flush adapters drop their pending non-parameter events and active notes, and the plugin is reset. Gesture boundaries are kept so a reset cannot leave a gesture open, and leaving bypass resets the processor's audio history (free-audio#614).
- The saved state names the present preset, and a restored state becomes the present preset, so the host no longer shows the factory preset chosen before the restore. Fixes a leak of the name string on every restore (free-audio#631).
- State can be saved and restored before `Initialize`. Hosts that set `kAudioUnitProperty_ClassInfo` before `AudioUnitInitialize` (Logic Pro when reloading a project, JUCE-based hosts) had the state dropped and the plugin came up with its defaults. A restore now runs on the main thread, and a CLAP without a state extension falls back to the AU base implementation instead of dereferencing a null extension (free-audio#490, free-audio#642).
- A values-only `param_rescan` sends a parameter value change per parameter instead of announcing a new parameter list, which cost Logic Pro seconds of UI lag when a plugin rescanned values per preset (free-audio#624).
- An editor still open is destroyed on the main thread. A host disposing of an instance off the main thread made AppKit throw and ended the host process (free-audio#628).
- `mark_dirty` is held back while a parameter gesture is open, for at most five seconds, so Logic Pro records the gesture's changes in Latch and Write (free-audio#612).
- The loop start is written to `loop_start_beats` rather than over the loop end, and both cycle points are converted to `clap_beattime` (free-audio#615).
- Beat time 0 is a valid song position (free-audio#613).
- The ARA property handlers return `OSStatus` instead of mixing two anonymous enums, which broke the C++20 build under `-Werror` (free-audio#618).

### AUv3
- Channel layouts: a bus wider than two channels now carries an `AVAudioChannelLayout` instead of being dropped. Layouts come from `clap.surround` / `clap.ambisonic`, otherwise they are guessed from the channel count as the VST3 wrapper does, with a new `auv3_channellayout.{h,mm}` translating CoreAudio layout tags and labels to and from CLAP channel maps and ambisonic configs. `clap.configurable-audio-ports` is probed at init as in the AUv2 wrapper, and `allocateRenderResources` hands the host's bus formats to the plugin (free-audio#611, free-audio#620).
- `renderingOffline` is forwarded to `clap.render`, respecting a hard realtime requirement, and re-applied before activation (free-audio#611).
- A main-bus format change is refused when it would leave the unit on a channel pair `channelCapabilities` does not report, which auval caught as `Initialised Unit incorrectly set to InputChans:3 OutputChans:1` (free-audio#620).
- Port names the plugin changes in `apply_configuration` are passed on to the busses (free-audio#620).
- Build: `INFO_PLIST_ADDITIONS` deep-merges a plist into the generated appex `Info.plist` (new `cmake/merge_plist.cmake`), `CODE_SIGN_IDENTITY` / `DEVELOPMENT_TEAM` let Xcode team-sign the appex, and `target_embed_auv3_appex()` embeds the appex into an app of your own (free-audio#611).

### VST3
- Raw MIDI output is translated: `CLAP_EVENT_MIDI` becomes note on/off and `kLegacyMIDICCOutEvent` for CC, program change, aftertouch, pitch bend and poly pressure, and `CLAP_EVENT_MIDI_SYSEX` becomes a `DataEvent` with `kMidiSysEx`. A CLAP emitting raw MIDI sent nothing to the host before (free-audio#414, free-audio#630).
- `IMidiMapping` parameters, note expressions and the preset program list are set up for a CLAP without a params extension, which the SDK validator rejected with `Unknown ParamID [0] returned for MIDI Mapping` (free-audio#634).
- A plugin with a hard realtime requirement answers `IPrefetchableSupport` with `kIsNeverPrefetchable`, so Cubase's ASIO-Guard no longer processes it ahead of playback (free-audio#627).
- No crash when a host provides fewer audio busses than the plugin declared; the block falls back to the params-flush path (free-audio#621).
- No crash when a host passes a null `initialize` context, as the ARA SDK's TestHost does for renderer-only instances (free-audio#618).
- ARA fixes: `queryInterface` no longer dereferences the plugin before `initialize()` or after `terminate()`, the deprecated `bindToDocumentController` forwards to the role-based binding so ARA 1 hosts can bind, and the factory logging reports the real factory count and mismatched plugin ids (free-audio#616).
- CMake: `target_add_vst3_wrapper` reads its arguments under their `V3_` names, so `ASSET_OUTPUT_DIRECTORY` is honoured, `BUNDLE_VERSION` defaults to 1.0 again and the resource-directory warnings fire. On Windows a build without `RESOURCE_DIRECTORY` is now a single file, as `CLAP_WRAPPER_WINDOWS_SINGLE_FILE` describes (free-audio#633).

### AAX
- `GetParameterNumberOfSteps()` no longer reports 0, which the AAX SDK treats as an error, and defers to the base class for continuous parameters and for parameters the wrapper does not own. Stepped parameter values are rounded and clamped on both sides of the conversion, so a round trip settles instead of drifting, and a degenerate zero-width range no longer divides by zero (free-audio#641).

### Standalone
- The window comes up at once, at the size the gui is going to ask for, in the gui's background colour and with a splash image (and optionally a few lines of text) in its middle; the gui's view then takes its place without the window moving or changing colour. The hints come from the build (`STANDALONE_WINDOW_SIZE`, `_BACKGROUND_COLOR`, `_SPLASH_IMAGE`, `_SPLASH_IMAGE_SCALE`) and from the plugin's entry through the new `clap_wrapper_plugin_factory_standalone_window` factory (draft/1), which can also set the appearance the window is drawn in (free-audio#638).
- Opening the standalone from a link: `URL_SCHEMES` (`STANDALONE_URL_SCHEMES` in `make_clapfirst_plugins`) registers the schemes, and standalone features draft/6 adds `open_url` on the plugin side, called once the plugin exists and its gui is shown. draft/5 is no longer answered. A launch with urls hands them to a running instance on Windows; macOS holds a launch url until the plugin is there (free-audio#623).
- Windows: the window keeps to the gui's size when an edge is dragged, snapping to half or a quarter of the screen respects the gui's minimum, a window resized by the gui is moved as little as it takes to stay on its monitor's work area, and the splash is repainted when the window changes size (free-audio#639).
- macOS: the standalone and the AUv3 host app are filed under `public.app-category.music`, settable with `MACOS_APP_CATEGORY`; the AUv3 host app's `Info.plist` is generated per target (free-audio#639).
- Linux: the window resizes with a plugin that can, and tells the plugin its size. The window's minimum width is the strip's own, so a narrower plugin is no longer stretched, and the window size is only recorded when the window manager confirms it (free-audio#609).
- Windows, WASAPI: shared mode has less latency. The output is filled to one engine period plus one block instead of to the brim, which cuts what waits ahead of a block from 12-15 ms to 5.3 ms. The input cushion is trimmed back to 64 frames when it goes unused, which saves 2-4 ms at 128 and 256 frames (free-audio#647).
- Windows: "WASAPI (Exclusive)" (`wasapi-exclusive`) is a new api in the Audio API menu. It uses the device's own format at the stream's rate, a period of the device's minimum or one block (whichever is longer), and gives a 3 ms period each way on a typical USB interface. Its audio thread runs at high MMCSS priority within the "Pro Audio" task. A device in use by another application, or one that does not allow exclusive use, gets a message of its own (free-audio#647, free-audio#648).
- MIDI ports plugged in after launch are opened: every input when the settings bind all, and the chosen inputs and outputs once they are present. CoreMIDI keeps a source that is still wanted connected while other ports come and go. WinMM is polled once a second, since it does not report device changes. `request_midi_bindings` (draft) changes meaning to match: `bind_all` also takes inputs plugged in later, and an id that is missing is opened once it is plugged in (free-audio#646).
- The latency readout in the Audio/MIDI settings is the whole latency, input device plus two blocks plus output device ("Latency: 27.4 ms round trip", or "… output" without an input). A device that does not report its latency shows a lower bound instead of hiding the readout. The rate menu follows the rate the device actually opened at. On macOS the readout has a row of its own. The `audio-midi-configuration` latencies are unchanged (free-audio#644).
- The buffer size menu shows samples only ("256" instead of "256 (5.8 ms)") (free-audio#645).
- Build fixes: the PipeWire backend builds against pre-1.0 headers (Debian bookworm, Ubuntu 22.04), the standalone library builds outside unity builds, and the Linux backends build with GCC 12 in release (free-audio#606).

### Across formats
- Wrapping fails when CLAP plugin initialization fails: the result is propagated through both instance factories, AudioComponent open fails before the SDK queries an unavailable instance, and VST3 reports its normal initialization error (free-audio#625).
- SysEx pool slots reserve their payload storage up front (256 bytes by default), so the first `acquire()` on the audio thread does not allocate. Used by the AUv2, AUv3 and VST3 wrappers (free-audio#637).
- macOS: an empty `CMAKE_OSX_DEPLOYMENT_TARGET` selects `std::filesystem` instead of downloading gulrak/filesystem at configure time, which broke offline and vendored builds (free-audio#632).
- CI: the jobs that pin gcc 12 or 13 run on ubuntu-24.04, since ubuntu-latest has moved to 26.04 and has no gcc-12 (free-audio#636).
It is __stdcall on 32-bit Windows, where MSVC refused the override
(C2695) and the VST3 wrapper did not compile. Elsewhere PLUGIN_API is
empty.
@defiantnerd
defiantnerd changed the base branch from main to next November 23, 2026 08:36
@defiantnerd

Copy link
Copy Markdown
Collaborator

Hi, thanks for that. I'll changed the target branch since we contribute to next, only releases go to main

@defiantnerd
defiantnerd merged commit bc488fc into free-audio:next Nov 26, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants