Ξ-W2-T1: the resample bake chain — instrument renders, extension banks, one click re-points and resets

This commit is contained in:
2026-08-01 16:26:28 -04:00
parent 6c982cd617
commit 60308a3655
52 changed files with 2212 additions and 55 deletions
@@ -26,6 +26,7 @@ namespace reasampler::vst {
using instrument::map::ComponentState;
using instrument::map::InstrumentParams;
using instrument::map::SampleRefEntry;
using instrument::map::SampleRefs;
using instrument::map::kPreviewVelocityDefault;
@@ -120,6 +121,21 @@ public:
// resolved selection id ("" if nothing loaded).
std::string reloadInstrument();
// The dialed sound as plain data for the offline bake: the SAME refs resolve + decode +
// build reloadInstrument runs, with no live block attached. Rebuilt rather than copied
// off the live snapshot because a tier-3 live edit leaves that snapshot's own play
// params stale on purpose — copying it would bake the pre-drag values. nullopt when
// nothing is loaded or the WAV is unreadable. Off the audio thread (file I/O).
std::optional<SampleData> bakeSnapshot();
// Adopt a landed bake in ONE act: the new capture becomes this instance's ref and
// selection, the parameter set and master gain go neutral, and a single reload
// publishes both together. The ordering is the whole point — a reset published ahead
// of the re-point would put neutral parameters under the OLD capture for a block.
// UI thread only.
void adoptBakedCapture(const SampleRefEntry& entry, const InstrumentParams& reset,
double masterGainLinear);
// What pollBankSync did this tick, so the editor can react only when something changed.
struct BankSyncResult {
bool reloaded = false; // bank generation changed (or a legacy lift landed) -> reloaded
@@ -203,6 +219,11 @@ public:
// fallback when the bank blob is unreadable. Guarded by refsMutex_.
SampleRefs sampleRefs();
// This instance's usage identity, minted here if it has never published. It names BOTH
// the "rsusage_" record the bake's tie query must exclude and the "rsbake_" request
// key, so the two can never name different instances. Off the audio thread.
std::string usageInstanceGuid();
private:
// If process() published that the drain instrument is fully idle, move it into the
// graveyard and prune — so an edited-away snapshot stops costing memory as soon as its