fix: classify future-version ledgers with changed record shape correctly, not as corrupt

Version-check now runs on the parseLedger failure path too, so a v3 blob whose record shape actually changed reports FutureVersion instead of Unreadable, avoiding the corrupt-blob "clear it" advice. Also closes the six minor findings.
This commit is contained in:
2026-07-30 20:25:46 -04:00
parent 45b87dc2ff
commit 6287534454
6 changed files with 67 additions and 22 deletions
+21 -11
View File
@@ -11,6 +11,7 @@
#define REAPERAPI_MINIMAL
#define REAPERAPI_WANT_EnumProjects
#define REAPERAPI_WANT_GetProjectName
#define REAPERAPI_WANT_ShowConsoleMsg
#include "reaper_plugin_functions.h"
@@ -64,21 +65,30 @@ void DriveRealtimeCapture(ReaSamplerSession& session)
// 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)
//
// RealtimeTickStatus::Done implies CaptureStatus::Ok (RealtimeRecordBackend::
// abort only sets Done on that path) — the Ok branch below is therefore the
// whole Done case; anything else is Failed and falls to the last branch.
if (r.status == RealtimeTickStatus::Done && r.result.status == CaptureStatus::Ok) {
// g_rtCaptureProject is still valid here (reset only below) — it names the
// ORIGINAL project, not whatever is active now, which is the whole point:
// the user has already switched away from it.
char nameBuf[512] = {0};
GetProjectName(g_rtCaptureProject, nameBuf, sizeof(nameBuf));
const std::string projName = nameBuf[0] ? nameBuf : "(unsaved project)";
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 '" +
"captured audio restored into the original project (" +
projName + "); not persisted to avoid crossing projects. The "
"recorded file was left in that 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
"', untracked. Re-importing it there does NOT adopt this file "
"-- it copies the audio in under a new name -- so after "
"re-importing, delete this untracked original by hand.\n")
.c_str());
} else {
ShowConsoleMsg(("ReaSampler realtime capture: project changed mid-record -- " +
r.result.message + "\n").c_str());
}
g_rtCapture.reset();
g_rtCaptureProject = nullptr;
return;