Restore the bank fold and usage publish to the resume path, guard setActive against repeats, and make the meter fold's bound literal

The resume also hands back to a full reload when the fold moves the loaded capture's decode source, so the refs table and the audio cannot skew.
This commit is contained in:
2026-08-02 13:15:47 -04:00
parent 5c6525fb91
commit da14509ab5
15 changed files with 218 additions and 76 deletions
+12 -5
View File
@@ -87,8 +87,8 @@ tresult PLUGIN_API ReaSamplerProcessor::setState(IBStream* state) {
legacyLiftConcluded_.store(false, std::memory_order_relaxed);
reloadInstrument();
// This caller has no editor to flush for it. At the TAIL on purpose: a host that services the
// restart synchronously deactivates/reactivates, and our setActive(true) reloads — from the
// refs above, which are only fully restored once this function has run to here.
// restart synchronously deactivates/reactivates, and our setActive(true) resumes or reloads
// against the refs above, which are only fully restored once this function has run to here.
flushLatencyRestart();
return kResultOk;
}
@@ -183,13 +183,20 @@ void ReaSamplerProcessor::flushLatencyRestart() {
// Latched BEFORE the call: a host that services the restart synchronously re-enters this
// object inside it, so the next commit must compare against the value the host is about to
// read, not against the one it held before.
latencyAnnounced_.store(limiterEnabled_.load(std::memory_order_relaxed),
std::memory_order_relaxed);
const bool previouslyAnnounced = latencyAnnounced_.exchange(
limiterEnabled_.load(std::memory_order_relaxed), std::memory_order_relaxed);
// The SDK requires this on the UI thread and answers getLatencySamples only after the host's
// own deactivate/reactivate — so the flag is long committed by the time the host asks. This
// is a kLatencyChanged restart with the bus untouched, NOT the retired per-mode kIoChanged
// bus renegotiation (see initialize()); do not conflate.
componentHandler->restartComponent(kLatencyChanged);
if (componentHandler->restartComponent(kLatencyChanged) == kResultOk) return;
// A refused restart leaves the host's delay compensation on the OLD value, so the latch has
// to come back off it: announcing a value the host never took would let a later toggle BACK
// to that value arm nothing, stranding the host's view permanently. Re-armed instead, which
// costs one retry per drain in a host that always refuses. The SDK documents no refusal
// semantics, so whether any host returns non-kResultOk here is `[verify — DAW]`.
latencyAnnounced_.store(previouslyAnnounced, std::memory_order_relaxed);
latencyRestartPending_.store(true, std::memory_order_release);
}
void ReaSamplerProcessor::publishLimiterEnabled(bool on) {