instrument: snap live params onto a fresh voice, roll a live drag back on capture loss, serialize the seqlock's two writers

This commit is contained in:
2026-07-30 21:39:56 -04:00
parent 1dade0bfcf
commit bbc7dc70bb
15 changed files with 621 additions and 143 deletions
+7
View File
@@ -153,6 +153,13 @@ void ReaSamplerProcessor::setInstrumentParams(const InstrumentParams& params) {
}
void ReaSamplerProcessor::publishLiveParams() {
// reloadMutex_ enforces the block's SINGLE-WRITER contract (live_params.h), not the
// reload's slot bookkeeping: reloadInstrument publishes the block too, and two concurrent
// seqlock writers can leave the generation even mid-write, which a reader would accept as
// a coherent — but torn — block. The audio thread never takes this mutex, so the cost is
// an off-thread wait behind a reload. Lock order matches reloadInstrument's
// (reloadMutex_ then paramsMutex_, taken by instrumentParams below).
std::lock_guard<std::mutex> lock(reloadMutex_);
const int rate = builtSampleRate_.load(std::memory_order_relaxed);
if (rate <= 0) return;
liveParams_.publish(