tracking: read the ledger's version, not just write it; clear owned on any block; channel-correct prune recovery

This commit is contained in:
2026-07-30 20:11:05 -04:00
parent 7f70d94228
commit 45b87dc2ff
27 changed files with 432 additions and 168 deletions
+19 -7
View File
@@ -31,8 +31,6 @@ void CommitRealtimeResult(ReaSamplerSession& session, const CaptureResult& res)
return;
}
session.bank().add(res.sample);
// Record the birth regardless of the index AddResult — even a hash-collapse still
// wrote a file the tool owns; the ledger dedups a repeat path itself.
session.recordCreated(res.sample, tracking::OriginKind::Capture);
// A capture add changes what a live instance could play, so bump the generation
// before persisting to refresh instances.
@@ -56,14 +54,28 @@ void DriveRealtimeCapture(ReaSamplerSession& session)
{
RealtimeTickResult r = g_rtBackend.abort(*g_rtCapture);
// Log without persisting — we restored into the original project but must
// not persist into the now-active foreign one. A Failed abort surfaces
// not persist into the now-active foreign one: the ledger and bank we would
// have to write belong to the project we just left. A Failed abort surfaces
// abort()'s own message, distinguishing a clean tab-switch abort from the
// closed-project case (nothing restored because the pointers were already
// freed).
if (r.status == RealtimeTickStatus::Done)
ShowConsoleMsg("ReaSampler realtime capture: project switched mid-record -- "
"captured audio restored into the original project; not "
"persisted to avoid crossing projects.\n");
//
// The abort already moved the recorded WAV into the ORIGINAL project's bank
// folder, so it survives here untracked — deleting a user's just-recorded
// audio is the destructive direction and is not this shell's call, so the
// path is NAMED instead and the operator decides (docs/TODO.md).
if (r.status == RealtimeTickStatus::Done && r.result.status == CaptureStatus::Ok)
ShowConsoleMsg(("ReaSampler realtime capture: project switched mid-record -- "
"captured audio restored into the original project; not "
"persisted to avoid crossing projects. The recorded file was "
"left in the original project's bank folder as '" +
r.result.sample.relativePath +
"', untracked -- reopen that project and re-import it, or "
"delete it by hand.\n").c_str());
else if (r.status == RealtimeTickStatus::Done)
ShowConsoleMsg(("ReaSampler realtime capture: project switched mid-record -- "
"the capture was aborted and produced no usable file: " +
r.result.message + "\n").c_str());
else
ShowConsoleMsg(("ReaSampler realtime capture: project changed mid-record -- " +
r.result.message + "\n").c_str());