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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user