Render in place: a track's output to a new sibling, source to the bench

This commit is contained in:
2026-08-02 14:17:55 -04:00
parent a0fd931dcb
commit 5c0f5f1591
21 changed files with 727 additions and 32 deletions
+36
View File
@@ -362,6 +362,39 @@ static void testBankRelativeForNameMatchesDerivePathSpelling() {
CHECK(bankRelativeForName(p.fileName) == p.relativePath);
}
// --- deriveRenderPaths ------------------------------------------------------
static void testRenderPathsSpellTheStemExactlyAsTheBankPathDoes() {
// The one owner claim, made checkable: for the same baseName + uniqueTag, the
// bank path's stem and file name must BE the render path's. If these ever
// diverge, bankRelativeForName's exact-string match against an enumerated
// folder entry starts misfiring and prune misreads referenced files as orphans.
const BankPaths bank = deriveBankPaths("/proj", "kick drum!", "001");
const RenderPaths render = deriveRenderPaths("/proj/reasampler_bank",
"kick drum!", "001");
CHECK(render.fileStem == bank.fileStem);
CHECK(render.fileName == bank.fileName);
CHECK(render.absoluteDir == bank.absoluteDir);
}
static void testRenderPathsTakeTheirDirectoryVerbatim() {
// No bank subfolder is appended — a render outside the bank has none, which is
// what makes "write into the bank folder" inexpressible through this call.
const RenderPaths r = deriveRenderPaths("/proj/media/", "take", "");
CHECK(r.absoluteDir == normalizeSlashes("/proj/media"));
CHECK(r.fileName == "take.wav");
CHECK(r.fileStem == "take");
// Backslashes normalize and a trailing slash is stripped, same as everywhere.
CHECK(deriveRenderPaths("C:\\proj\\media\\", "take", "").absoluteDir ==
normalizeSlashes("C:/proj/media"));
}
static void testRenderPathsEmptyDirectoryStaysEmpty() {
// No CWD fallback: an unresolvable directory must fail at the caller's own
// guard, never silently render next to whatever the process happened to be in.
CHECK(deriveRenderPaths("", "take", "001").absoluteDir.empty());
}
static void testBankRelativeForNameConventionAndEdge() {
// The convention verbatim: "reasampler_bank/<name>" (the one place the spelling lives).
CHECK(bankRelativeForName("a.wav") == "reasampler_bank/a.wav");
@@ -396,6 +429,9 @@ int main() {
testTransitionFirstSaveOfUnsavedRelocatesButPlanNoOps();
testTransitionInPlaceSaveIsNoOp();
testBankRelativeForNameMatchesDerivePathSpelling();
testRenderPathsSpellTheStemExactlyAsTheBankPathDoes();
testRenderPathsTakeTheirDirectoryVerbatim();
testRenderPathsEmptyDirectoryStaysEmpty();
testBankRelativeForNameConventionAndEdge();
if (g_fail == 0) std::printf("capture_paths: all tests passed\n");