fix: freeze the scope when the transport is stopped

FL keeps calling process() with silence while stopped/paused, so the scope
scrolled silence instead of holding. Gate the plot's bucket advance on
context.transport().playing, so it freezes on stop/pause and resumes on play.
Bar meters still fall to silence as before. Update README thread-safety notes
for the ScopeRing feed and transport gating.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mikkeli Matlock
2026-06-24 16:25:08 +09:00
parent 9a60b0ea72
commit 514fd964f6
2 changed files with 34 additions and 18 deletions
+9 -3
View File
@@ -256,9 +256,15 @@ NIH-plug provides `Smoother` — use it for all gain/threshold params to avoid z
### Thread safety
Params are atomics. The editor and audio thread communicate only through params and a shared
`Arc<Meters>` of **lock-free atomics** (`meters.rs`) — never a mutex on the audio path. `process()`
publishes one value per meter per block (gated on the editor being open); the editor reads them
each frame. Never pass DSP state to the UI directly.
`Arc<Meters>` (`meters.rs`) — never a mutex on the audio path. Two lock-free feeds, both gated on
the editor being open:
- **Bar meters** — decayed atomic scalars, one store per block; the editor reads them each frame.
- **Scrolling plot** — a single-producer/single-consumer `ScopeRing` of buckets clocked at
~200 Hz, so the plot's horizontal resolution is decoupled from the ~60 fps repaint. The editor
drains all new buckets each frame. The scope is **transport-gated** (advances only while playing)
so it freezes rather than scrolling silence when the host is stopped/paused.
Never pass DSP state to the UI directly.
### VST3 licensing
You must accept Steinberg's VST3 SDK licence before distributing VST3 binaries.