Ξ-W2-T1: the resample bake chain — instrument renders, extension banks, one click re-points and resets
This commit is contained in:
@@ -51,7 +51,7 @@ REAPER/filesystem-facing half only, and it gathers rather than decides.
|
||||
|
||||
## Modules
|
||||
|
||||
- `shell/persist` (`session` / `ext_state_io` / `prune_fs`) — the persist seam, split by responsibility (Q-W5; the former `persist.cpp` god-TU and its `persist.h` compatibility umbrella are both retired — callers include `shell/persist/session.h` / `ext_state_io.h` directly). `session` owns the `ReaSamplerSession` lifecycle: the poll identity-transition detection (load / Save-As / forked sibling / recycled pointer) and the `projectconfig`-driven deferred undo/redo reload. `ext_state_io` owns project ext state (`SetProjExtState`/`GetProjExtState`, namespace `"reasampler"`) ↔ `BankBook` JSON, `ViewModeModel` JSON, `TailSetting` JSON, the tracking ledger JSON, the writing-version stamp, GUID minting, and bank-folder relocation. `session` additionally owns `recordCreated` — **the one writer of a birth record**, called at the same point the `Sample` is added, deriving lineage from that `Sample`'s own provenance. `prune_fs` hosts the prune dry-run / full-set orphan queries (gathering `referencedPaths()` plus `tracking::pruneProtection`'s two inputs for the `prune_reconcile` pure core) and is **the single file-deletion authority over user files in the bank folder** (`deleteOrphanFile` via `SHFileOperationW`); nothing else in the system deletes bank-folder bytes. Dry-run / orphan-set / reclaim each independently abort (delete nothing) when the authority reports a block.
|
||||
- `shell/persist` (`session` / `ext_state_io` / `prune_fs`) — the persist seam, split by responsibility (Q-W5; the former `persist.cpp` god-TU and its `persist.h` compatibility umbrella are both retired — callers include `shell/persist/session.h` / `ext_state_io.h` directly). `session` owns the `ReaSamplerSession` lifecycle: the poll identity-transition detection (load / Save-As / forked sibling / recycled pointer) and the `projectconfig`-driven deferred undo/redo reload. `ext_state_io` owns project ext state (`SetProjExtState`/`GetProjExtState`, namespace `"reasampler"`) ↔ `BankBook` JSON, `ViewModeModel` JSON, `TailSetting` JSON, the tracking ledger JSON, the writing-version stamp, GUID minting, and bank-folder relocation. `session` additionally owns `recordCreated` — **the one writer of a birth record**, called at the same point the `Sample` is added, deriving lineage from that `Sample`'s own provenance. `prune_fs` hosts the prune dry-run / full-set orphan queries (gathering `referencedPaths()` plus `tracking::pruneProtection`'s two inputs for the `prune_reconcile` pure core) — and, beside them, `tiedUsageFor`, the resample's replace-vs-add input, deliberately co-located so "both answers come out of one `TrackingState`" is structural rather than a rule two files must remember. It is also **the single file-deletion authority over user files in the bank folder** (`deleteOrphanFile` via `SHFileOperationW`); nothing else in the system deletes bank-folder bytes. Dry-run / orphan-set / reclaim each independently abort (delete nothing) when the authority reports a block.
|
||||
- `usage_scan` — extension-side prune-scan shell: enumerates every `rsusage_*` ext-state key, decodes each `sample_usage` wire record, enumerates every ReaSampler 9000 FX instance across all tracks + master / normal + record chains / containers (recursive) / take FX, and returns the pure `sample_usage::foldUsageRecords` result verbatim. One of the two inputs `tracking::pruneProtection` reads; it decides nothing itself. Read-only: writes no ext-state.
|
||||
- `persist_internal.h` — internal-only shared helpers for the persist TU family (`session` / `ext_state_io` / `prune_fs`); included only by those three TUs, never a public seam (mirror of the panel's `panel_state.h` / the editor's `editor_internal.h` precedent). Holds the former anonymous-namespace helpers more than one split TU needs (active-project + `.rpp` path lookup, project-dir derivation, growing `GetProjExtState` read, project-GUID minting, bank-folder relocation) — all definitions live in `ext_state_io.cpp`. REAPER-free header: the project handle crosses this seam as the same opaque `void*` the public `session` header already uses.
|
||||
|
||||
|
||||
@@ -204,6 +204,19 @@ bool deleteOrphanFile(const std::string& absPath, bool& outUsedTrash,
|
||||
|
||||
} // namespace
|
||||
|
||||
tracking::Answer ReaSamplerSession::tiedUsageFor(const std::string& capturePath,
|
||||
const std::string& ownUsageKey) const {
|
||||
// The SECOND consumer of the same gather the prune scan above runs — deliberately
|
||||
// next to it, so "both answers come out of one TrackingState" is structural rather
|
||||
// than a rule two files have to remember.
|
||||
std::string rppPath;
|
||||
void* proj = readActiveProject(rppPath);
|
||||
if (!proj) return tracking::Answer::Indeterminate;
|
||||
const wire::UsageFoldResult usage = scanInstanceUsage(proj);
|
||||
const tracking::TrackingState state{trackingStatus_, tracking_, usage};
|
||||
return tracking::tiedUsageExists(state, capturePath, ownUsageKey);
|
||||
}
|
||||
|
||||
reclaim::PruneReport ReaSamplerSession::pruneDryRun() const {
|
||||
const PruneScan scan = scanPruneOrphans(book_, tracking_, trackingStatus_);
|
||||
reclaim::PruneReport report =
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "core/model/bank_model.h"
|
||||
#include "core/reclaim/prune_reconcile.h"
|
||||
#include "core/tracking/origin_ledger.h"
|
||||
#include "core/tracking/tracking_authority.h"
|
||||
#include "core/version/app_version.h"
|
||||
#include "core/view/view_mode_model.h"
|
||||
|
||||
@@ -115,6 +116,13 @@ public:
|
||||
// prune action confirms this set before deleting it. Read-only.
|
||||
std::vector<std::string> pruneOrphanSet() const;
|
||||
|
||||
// The resample's replace-vs-add input for one capture, gathered from the SAME live
|
||||
// tracking state the prune scan reads, so the two consumers cannot disagree. Exposed
|
||||
// as the answer rather than as the ledger, because an absent record and an unreadable
|
||||
// ledger demand opposite treatment and only the pair says which. Read-only.
|
||||
tracking::Answer tiedUsageFor(const std::string& capturePath,
|
||||
const std::string& ownUsageKey) const;
|
||||
|
||||
// Delete the confirmed orphan set — the sole file-deletion path,
|
||||
// callable only after an explicit user confirm. Re-enumerates and runs
|
||||
// the pure core fresh, deleting exactly `confirmed ∩ freshOrphans` so a
|
||||
|
||||
Reference in New Issue
Block a user