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:
@@ -139,9 +139,9 @@ public:
|
||||
// What the audio thread published since the LAST call: peaks maxed and minGain minimised
|
||||
// across every block in that window. CONSUMING — it resets the accumulators as it reads, so
|
||||
// exactly one reader may call it, and that reader is the editor's meter tick. Two live
|
||||
// editors would each consume half the windows and both meters would read low; what makes
|
||||
// that unreachable is the HOST calling createView once per instance, not anything this
|
||||
// plugin enforces — createView allocates a new editor on every call. UI thread.
|
||||
// editors would each consume half the windows and both meters would read low; the single
|
||||
// reader rests on the HOST calling createView once per instance `[verify — DAW]`, not on
|
||||
// anything this plugin enforces — createView allocates a new editor on every call. UI thread.
|
||||
MasterBusMeter masterBusMeter();
|
||||
void clearMasterBusClip();
|
||||
|
||||
@@ -289,10 +289,12 @@ private:
|
||||
void rebuildVoiceEngine();
|
||||
|
||||
// The reactivation half of the activation/decode lifetime split (see dormantSample_):
|
||||
// rebuilds the voice state around the parked sample and publishes it through the same
|
||||
// drain-slot swap. True also when a publish landed while inactive, which needs no rebuild.
|
||||
// False when there is nothing to activate from — the caller then falls back to a full
|
||||
// reload, which is where the pre-v10 legacy lift lives. Off the audio thread only.
|
||||
// folds the live bank blob into the refs, rebuilds the voice state around the parked
|
||||
// sample, publishes it through the same drain-slot swap, and republishes usage. True also
|
||||
// when a publish landed while inactive, which needs no rebuild. False when there is nothing
|
||||
// to activate from, or when that fold moved what the park was decoded from — the caller
|
||||
// then falls back to a full reload, which decodes the new file and is also where the pre-v10
|
||||
// legacy lift lives. Off the audio thread only.
|
||||
bool resumeDormantInstrument();
|
||||
|
||||
// Builds a playable snapshot around `sample` at the current voice-system parameters and
|
||||
@@ -307,7 +309,8 @@ private:
|
||||
// Publishes `built` (null = install silence) into live_: prunes the graveyard by the
|
||||
// last process()-published generation, swaps `built` into live_, displaces the previous
|
||||
// live into the drain slot, and parks the evicted drain instrument in the graveyard.
|
||||
// Requires reloadMutex_ held — shared by reloadInstrument and rebuildVoiceEngine.
|
||||
// Requires reloadMutex_ held — shared by reloadInstrument, rebuildVoiceEngine and
|
||||
// resumeDormantInstrument.
|
||||
void publishBuiltLocked(std::unique_ptr<LoadedInstrument> built);
|
||||
|
||||
// Publishes a silent block. EVERY process() path that emits no audio calls this. It clears
|
||||
@@ -391,6 +394,10 @@ private:
|
||||
// reloadMutex_.
|
||||
std::optional<SampleData> dormantSample_;
|
||||
|
||||
// Whether the host has us active, so setActive can treat a repeat of the state it already
|
||||
// holds as a no-op (it owns why). Main/UI thread only, like setActive itself.
|
||||
bool active_ = false;
|
||||
|
||||
// The loaded capture's id ("" = no pick -> silence). Off-thread only, not read on the
|
||||
// audio thread.
|
||||
std::mutex selectionMutex_;
|
||||
@@ -488,13 +495,14 @@ private:
|
||||
instrument::engine::Limiter limiter_;
|
||||
std::atomic<bool> limiterEnabled_{false};
|
||||
// Raised (and lowered) by the commit funnel from the difference between the enable and
|
||||
// latencyAnnounced_, cleared by flushLatencyRestart on delivery. A bool and not a count on
|
||||
// purpose: the host is being told to re-ASK, so N changes before one flush need exactly one
|
||||
// restart, and whatever getLatencySamples answers at that moment is the truth announced.
|
||||
// latencyAnnounced_, cleared by flushLatencyRestart on delivery and re-raised there if the
|
||||
// host refuses. A bool and not a count on purpose: the host is being told to re-ASK, so N
|
||||
// changes before one flush need exactly one restart, and whatever getLatencySamples answers
|
||||
// at that moment is the truth announced.
|
||||
std::atomic<bool> latencyRestartPending_{false};
|
||||
// The enable the host was last told about — false initially, which is what an instance
|
||||
// that has announced nothing reports. Every arm is judged against this, so a change that
|
||||
// returns to the announced state costs no restart.
|
||||
// The enable the host has ACCEPTED — false initially, which is what an instance that has
|
||||
// announced nothing reports. Every arm is judged against this, so a change that returns to
|
||||
// the announced state costs no restart.
|
||||
std::atomic<bool> latencyAnnounced_{false};
|
||||
|
||||
// What the audio thread publishes about the output bus each block, relaxed. The peaks and
|
||||
|
||||
Reference in New Issue
Block a user