feat(S9/S8): bank-generation change-detection + instrument-side assignment reader
Extension stamps a monotonic bank_generation counter, bumped at content mutations; the VST3 instrument polls it off-thread on an editor timer and consumes assignment requests, refreshing playback hands-free.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
// calls live in persist.cpp. It depends on bank_model (pure) for JSON round-trip
|
||||
// and capture_paths (pure) for the path arithmetic it drives.
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "app_version.h"
|
||||
@@ -149,6 +150,24 @@ public:
|
||||
// reason about the origin build without re-reading ext state.
|
||||
const WritingVersion& writingVersion() const { return writingVersion_; }
|
||||
|
||||
// The S9 bank-generation counter (the value stamped under `bank_generation`). Monotonic
|
||||
// per project: recovered on load (so it continues from the stored value rather than
|
||||
// resetting), bumped by bank-content mutations via bumpBankGeneration(), and written on
|
||||
// every saveToActiveProject(). Exposed const for the writer sites to read/log.
|
||||
std::int64_t bankGeneration() const { return bankGeneration_; }
|
||||
|
||||
// Bump the S9 bank-generation counter — call at every bank-CONTENT mutation that changes
|
||||
// what a live instance would PLAY (capture add, re-capture-in-place, sample remove,
|
||||
// move/copy affecting banks, ingest import). NOT the pure-organizational verbs (create /
|
||||
// rename / activate / reorder a bank), which change no existing (bankId, sampleId) ->
|
||||
// content mapping. The bumped value is persisted by the NEXT saveToActiveProject() call
|
||||
// the same mutation already makes (the counter rides the persist blob, so there is no
|
||||
// separate write). In-memory only here — cheap and REAPER-free; the persist is the write.
|
||||
// Over-bumping is safe (a reload that finds unchanged content atomically re-installs the
|
||||
// same instrument, no glitch); under-bumping misses a hands-free refresh, so the sites err
|
||||
// toward bumping. Idempotent per logical op — call once per mutation, before the persist.
|
||||
void bumpBankGeneration() { ++bankGeneration_; }
|
||||
|
||||
// Serialize the current book (under the `banks` key), view model, and tail setting
|
||||
// to the active project's ext state (namespace "reasampler"), and clear the retired
|
||||
// legacy `bank_index` key. Non-destructive beyond writing our own ext-state keys.
|
||||
@@ -282,6 +301,14 @@ private:
|
||||
// the previous project's stamp. Read-only to consumers via writingVersion().
|
||||
WritingVersion writingVersion_;
|
||||
|
||||
// The S9 bank-generation counter (peer to writingVersion_). Recovered on EVERY load path
|
||||
// from the stored `bank_generation` stamp (parseBankGeneration; absent -> 0), so it
|
||||
// continues monotonic from the persisted value across reopen and resets cleanly on a
|
||||
// project switch (a different project's counter, not the previous project's). bumped by
|
||||
// bumpBankGeneration() at bank-content mutations and stamped by saveToActiveProject().
|
||||
// Default 0 for an unsaved / never-loaded / pre-S9 session.
|
||||
std::int64_t bankGeneration_ = 0;
|
||||
|
||||
// The project identity last observed by poll(), used to detect load/Save-As.
|
||||
// The GUID is the PRIMARY signal (a different stored GUID = a different project
|
||||
// of record = Load, immune to pointer recycling). The pointer disambiguates the
|
||||
|
||||
Reference in New Issue
Block a user