Skip to Content
Soundor Skills

How the layers communicate

A reference of the soundor-plugin-architecture skill.

soundor-plugin-architecture reads this reference when a task needs it. Source on GitHub

What each Soundor mechanism carries, between which threads, and what it is part of. Based on Soundor 0.21; confirm details in the installed version.

MechanismFrom → toSaved with sessionDAW automationPresetsHistory (undo)Real-time safe on the audio side
ParameterUI, controller, host → processoryesunless manualyesyesyes (ctx.params, per block)
Read-only parameterprocessor → host, UInoshown onlynonoyes (ctx.publish)
StateUI, controller → UI, controlleryesnoyesyesnot read by the processor
State, audio: trueUI, controller → processoryesnoyesyesyes (ctx.state, snapshot)
Native streamprocessor (or controller) → UInonononoyes (ctx.streams, latest wins)
Audio resourceprepare(), controller → processornonononoyes (ctx.resources, swapped)
Native methodUI → controllernononononever on the audio thread
Native eventcontroller → UInononononever on the audio thread
soundor:storageUI ↔ disk (per plugin, all instances)no (per machine)nononono

Parameters

Declared in soundor.config.ts, typed everywhere: soundor:parameters in the UI, ctx.params (a generated struct, snake_case fields) in the processor, ctx.params.<id> with get()/set() in the controller. The processor sees one value per block. Writes from any source are clamped and snapped to the step; subscribers hear changes, not repeated writes.

State

Typed application data, declared under state with a default per field, using the native type registry (structs, enums, arrays, nullable values). The UI reads it with soundor:state (useStateValue in React); the controller with ctx.state. Fields with audio: true (numbers, booleans, and arrays of them with a maxLength) also reach the processor as a coherent snapshot at the start of the next block; all audio fields together may take at most 8 MiB.

Streams

Declared under native.streams: one number, or a buffer<T> with a maxLength. The processor publishes with ctx.streams.<name>.publish(v), or for buffers writes buffer_mut() then commit(len), without locks or allocation. The UI gets the latest value at most once a frame (useNativeStream for markup; subscribe in an effect for drawing). Values in between are skipped, never queued, so a stream cannot carry events that must all arrive.

Resources

Declared under native.resources as buffer<T>. Published whole from prepare() or the controller (ctx.processor.resources().<name>.publish), read in process() with ctx.resources.<name>.get() as a slice that does not change during a block. A replaced resource is freed off the audio thread. Not saved: republish them in prepare() from state, parameters and the sample rate.

Native methods and events

Declared under native.methods and native.events; implemented in Rust by the controller (impl NativeMethods), and called from the UI as typed functions in soundor:native. Synchronous methods run inside the UI's call and must be quick; slow work is an async: true method, whose future runs on the controller's worker. Blocking work inside it goes to soundor::unblock. Callbacks that touch parameters, state or History are scheduled back onto the control thread with ctx.schedule.

There are no arbitrary message queues between the UI and the processor: everything the processor reads arrives as a parameter, audio state, or a resource.

Choosing between close options

  • Parameter or state? If a host should see, automate or show it, it is a parameter. If it is structured, a list, text, or has no single numeric range, it is state.
  • Read-only parameter or stream? A read-only parameter is one value the host also shows (gain reduction). A stream is for the UI only, and can be a buffer (a spectrum).
  • Audio state or resource? Audio state is session data the user edits (bounded, saved). A resource is derived data (computed tables, loaded audio) the processor reads, rebuilt rather than saved.
  • Method or state write? Write state directly from the UI when it is a plain edit; call a method when Rust must compute, load or validate something.

On this page