Name captures after their source track: label and filename both, on every interactive mint site, and show the name on the panel card

This commit is contained in:
2026-08-01 21:46:53 -04:00
parent 09d64c9f46
commit 3278b4eced
23 changed files with 626 additions and 25 deletions
+31
View File
@@ -489,6 +489,36 @@ static void testLegacyJsonDefaults() {
}
}
// A bank written before captures were named after their source track carries the literal
// "item"/"track" label. Nothing migrates or relabels it: the label must survive load and
// re-serialize byte-identically, so an old bank reads exactly as it did.
static void testPreNamingSchemeLabelsSurviveUntouched() {
const char* old =
"{\"version\":1,\"samples\":["
"{\"id\":\"cap-1700000000-1-item_1700000000-1.wav\","
"\"displayName\":\"item\",\"relativePath\":\"reasampler_bank/item_1700000000-1.wav\","
"\"contentHash\":\"h-old-a\"},"
"{\"id\":\"cap-1700000000-2-track_1700000000-2.wav\","
"\"displayName\":\"track\",\"relativePath\":\"reasampler_bank/track_1700000000-2.wav\","
"\"contentHash\":\"h-old-b\"}]}";
auto r = BankModel::deserialize(old);
CHECK(r.has_value());
if (!r) return;
const Sample* a = r->query("cap-1700000000-1-item_1700000000-1.wav");
const Sample* b = r->query("cap-1700000000-2-track_1700000000-2.wav");
CHECK(a && a->displayName == "item");
CHECK(b && b->displayName == "track");
auto again = BankModel::deserialize(r->serialize());
CHECK(again.has_value());
CHECK(again && *again == *r);
if (again) {
const Sample* a2 = again->query("cap-1700000000-1-item_1700000000-1.wav");
CHECK(a2 && a2->displayName == "item");
}
}
// S2 test case 4: boundary values for the seam fields are representable and
// round-trip. rootNote 0 and 127 (the MIDI edges); loopStart == loopEnd (a valid
// zero-length marker); a loop whose end sits at the file's last frame. Also asserts
@@ -588,6 +618,7 @@ int main() {
testIntegerOverflow();
testEnumRangeValidation();
testLegacyJsonDefaults();
testPreNamingSchemeLabelsSurviveUntouched();
testSeamFieldBoundaries();
testSeamFieldsAdditiveInvariant();