Skip to content

Implement ProcessContext::set_parameter - #278

Open
derenma wants to merge 2 commits into
robbert-vdh:masterfrom
derenma:set_param
Open

derenma wants to merge 2 commits into
robbert-vdh:masterfrom
derenma:set_param

Conversation

@derenma

@derenma derenma commented Sep 8, 2026

Copy link
Copy Markdown

This PR should superscede: d790ee5

Adds a realtime-safe way for a plugin to report a parameter value change from inside Plugin::process(). (TODO in src/context/process.rs). Works like ParamSetter::set_parameter(), but skips main-thread host automation and its locks. The change is queued and flushed to the host at the end of the current processing block instead.

  • CLAP: reuses the existing OutputParamEvent::SetValue queue already used by GuiContext (no begin/end gesture, since this isn't a user gesture).
  • VST3: adds a new output parameter queue (VST3 had no output-side equivalent of the input parameter queue before), drained each block into the host's IParameterChanges via add_parameter_data/add_point.
  • Standalone: forwards to the existing realtime-safe parameter queue.

VST3 has no output-side equivalent of the input parameter change queue:
data.output_param_changes is never touched. Add an AtomicRefCell<VecDeque>
queue on WrapperInner, mirroring the existing output_events note queue and
its guard on WrapperProcessContext, and drain it once per processing block
into the host's IParameterChanges via add_parameter_data()/add_point().

Nothing feeds this queue yet, so it stays empty for now.
Add a realtime-safe way for a plugin to report a parameter value change
from inside Plugin::process(), similar to ParamSetter::set_parameter() but
without going through main-thread host automation and its locks.

- CLAP reuses the existing OutputParamEvent::SetValue queue already used
  by GuiContext (no begin/end gesture, since this isn't a user gesture).
- VST3 pushes onto the output parameter queue added in the previous
  commit.
- Standalone forwards directly to the existing realtime-safe
  Wrapper::set_parameter queue, matching its GuiContext implementation.

The parameter's reported value is not updated until the queued change is
flushed to the host at the end of the current processing block.

This branch has not been deployed

No deployments
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.

1 participant