Skip to content

Draft standalone features extension for driving audio/MIDI setup from a plugin - #590

Merged
defiantnerd merged 2 commits into
free-audio:nextfrom
baconpaul:standalone-features
Oct 13, 2026
Merged

defiantnerd merged 2 commits into
free-audio:nextfrom
baconpaul:standalone-features

Conversation

@baconpaul

@baconpaul baconpaul commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Draft of a clap-wrapper.standalone-features.draft/1 host extension. It lets a plugin drive the standalone's audio and MIDI setup from its own UI.

The full spec, design notes and plan to finish are at https://gist.github.com/baconpaul/3063fca5038bd9fd847ce77324302dc7

In this PR

  • include/clapwrapper/standalone_features.h, the extension header
  • IHost::standalone_features(), which defaults to null so every non-standalone wrapper returns null
  • dispatch in Clap::Plugin::clapExtension
  • standalone_host_features.cpp, implementing:
    • show settings screen: a frontend hook, installed on macOS, where it opens the existing AudioSettingsWindow
    • API listing
    • audio in/out and MIDI in endpoint listing: the standalone now tracks the names of the MIDI ports it has open
    • sample-rate listing: an instrument's input never narrows the list
    • buffer-size listing
    • status: the stream's actual rate, block size and channels, plus the last open error
  • lastAudioError, recorded on every startAudioThreadOn failure path

Not yet

  • Rebinding (request_audio_config, request_midi_bindings) and reset_standalone_state are declared but report unsupported.
  • Startup ordering, so that requests made from init() win over the .conf, still has to be done.
  • The Windows show-screen hook still has to be added.
  • macOS still never writes standalone-settings.conf. That gap predates this PR.

So far this has only been built: it compiles into the Six Sines standalone on macOS, where Six Sines adds a main-menu item that calls the extension. That item has not been exercised yet, and the change has not been compiled on Windows or Linux.

… a plugin

Adds clap-wrapper.standalone-features.draft/1: open the standalone's
settings screen, list audio APIs, devices, sample rates, buffer sizes and
MIDI ports, and read back the stream status including the last open error.
Rebinding and reset are declared but report unsupported for now.

Assisted-by: Claude Opus 5.5
@defiantnerd

Copy link
Copy Markdown
Collaborator

We need a function to mute/unmute the input. If a standalone version is run the first time on a MacBook, user will experience an immediate feedback noise.

The plugin can - if it recognizes the first start, mute the input, call up the configuration panel and unmute afterwards. It can also mute if the config has changed (sound card removed).

A first launch on a laptop can feed the built-in mic straight back out of
the speakers. A plugin can now mute the input, show the settings screen and
unmute once the user has chosen a device. The mute is not persisted.

Assisted-by: Claude Opus 5.5
@baconpaul

Copy link
Copy Markdown
Collaborator Author

Good call - input mute is added in af86979.

  • supports_input_mute(host) and set_input_muted(host, bool), plus an input_muted field in get_audio_status.
  • While muted the plugin gets silence in place of the input device, from the next block. The stream stays open and the plugin stays active, so toggling it doesn't reactivate anything.
  • Called from init() it takes effect before the first block, so a plugin can mute on a first launch before any audio flows, open the settings panel, and unmute after. Muting on a device change works the same way.
  • It isn't persisted, so every launch starts unmuted and a stuck mute can't carry over between sessions.

The struct changed, so the ID is now draft/2. So far it's only been built on macOS, not exercised. The spec gist is updated to match: https://gist.github.com/baconpaul/3063fca5038bd9fd847ce77324302dc7

@defiantnerd

Copy link
Copy Markdown
Collaborator

The plugin should be notified when the user applied a setting. Then the plugin can unmute the audio stream and inform the user.

@baconpaul

Copy link
Copy Markdown
Collaborator Author

The plugin should be notified when the user applied a setting. Then the plugin can unmute the audio stream and inform the user.

yeah an optional plugin-side api with an inform makes a lot of sense

@defiantnerd

Copy link
Copy Markdown
Collaborator

I will merge this to next, although it is a draft, so I can work on this.

@defiantnerd
defiantnerd marked this pull request as ready for review October 13, 2026 10:18
@defiantnerd
defiantnerd merged commit 4ca689f into free-audio:next Oct 13, 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