Ψ-W2-T2: collapse a capture whose channels are bit-identical to one lossless mono channel, index value measured off the landed file

This commit is contained in:
2026-08-01 21:46:55 -04:00
parent 09d64c9f46
commit 4fa3c1dd15
12 changed files with 312 additions and 11 deletions
+13 -2
View File
@@ -53,6 +53,9 @@ struct CaptureRequest {
// 0 sampleRate => follow project rate.
int sampleRate = 0;
// What the RENDER is asked for (RENDER_CHANNELS / the realtime record mode), not
// what the capture lands as: a dual-mono render is collapsed to 1 channel after
// the fact, and the Sample's count comes from the produced file.
int channelCount = 2;
WavBitDepth bitDepth = WavBitDepth::Float32;
@@ -100,8 +103,16 @@ public:
// backend's family marker ("" offline, "rt-" realtime).
std::string makeUniqueTag(const std::string& prefix);
// Stamps the metadata shared by both backends onto `s`: trackGuids + channelCount
// (echoed from the request), resolved sampleRate (request rate, else PROJECT_SRATE
// Rewrites a just-captured WAV in place as a 1-channel file when its channels are
// bit-identical (the pure `collapseToMono` decides). Every other file is left
// untouched, byte for byte, so the not-collapsed path is exactly what the backend
// produced. Must run BEFORE stampCaptureSample, which measures the landed file.
void collapseCapturedFileToMono(const std::string& absolutePath);
// Stamps the metadata shared by both backends onto `s`: trackGuids (echoed from the
// request) + channelCount (measured from the produced file's `fmt`; the request
// value only as the fallback for a file that cannot be parsed), resolved
// sampleRate (request rate, else PROJECT_SRATE
// from `rateProj`), captureTempo, the capture-start time signature
// (TimeMap_GetTimeSigAtTime against `timeSigProj` — offline passes nullptr for the
// active project, realtime pins the record's own project), the WAV-aware