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
+27 -1
View File
@@ -201,6 +201,32 @@ std::string makeUniqueTag(const std::string& prefix) {
std::to_string(++counter);
}
CaptureName captureNameFor(const std::vector<std::string>& sourceNames,
int ordinal, const std::string& fallback) {
CaptureNameInputs in;
in.sourceNames = sourceNames;
in.ordinal = ordinal;
in.fallback = fallback;
// localtime, not gmtime: the discriminator is read by the person who made the
// capture, so it must match the clock on their wall. A failed conversion leaves the
// stamp zeroed, which composeCaptureName renders as no discriminator at all.
const std::time_t now = std::time(nullptr);
std::tm local{};
#ifdef _WIN32
const bool ok = (localtime_s(&local, &now) == 0);
#else
const bool ok = (localtime_r(&now, &local) != nullptr);
#endif
if (ok) {
in.stamp.month = local.tm_mon + 1; // tm_mon is 0-based
in.stamp.day = local.tm_mday;
in.stamp.hour = local.tm_hour;
in.stamp.minute = local.tm_min;
}
return composeCaptureName(in);
}
void stampCaptureSample(Sample& s, const CaptureRequest& req,
ReaProject* rateProj, ReaProject* timeSigProj,
const std::string& absolutePath) {
@@ -452,7 +478,7 @@ CaptureResult OfflineRenderBackend::capture(const CaptureRequest& request) {
// Same uniqueTag that named the file — calling makeUniqueTag() again could
// yield a different value and desync Sample.id from the file name.
s.id = "cap-" + uniqueTag + "-" + paths.fileName;
s.displayName = request.baseName;
s.displayName = request.label();
s.relativePath = paths.relativePath; // project-relative (invariant)
s.sourceMode = request.sourceMode;
s.sourceRange.startSeconds = request.startSeconds;