T2: realtime capture tail trimming

Auto/Manual/Off tail handling for realtime track-tap capture. Auto scans
recorded PCM backward for last frame above -72 dB and truncates the wav
header-aware (8 s cap); Manual pads a fixed tail; Off is byte-identical.
wav_trim rejects WAVE_FORMAT_EXTENSIBLE with non-float SubFormat GUID.
This commit is contained in:
2026-07-23 18:25:45 -04:00
parent 81fa37fe94
commit f2bfe466ec
12 changed files with 1053 additions and 10 deletions
+18 -4
View File
@@ -596,13 +596,20 @@ static void RunCaptureRealtimeTrack()
return;
}
// The tail mode is the SAME panel setting the offline capture actions read (the
// docked bank panel's toggle). Realtime honors it via a parallel path: the backend
// records a generous window past the range end, then trims by PCM decay-scan (T2 /
// capture-tail.md §The realtime path) — it does NOT drive RENDER_*. Default None
// keeps realtime exact-bounds / byte-identical to today.
const reasampler::TailSetting tail = reasampler::bankPanelTailSetting();
reasampler::CaptureRequest req;
req.sourceMode = reasampler::SourceMode::SelectedTracks; // realtime track scope
req.startSeconds = src.startSeconds; // exact bounds — no rounding
req.endSeconds = src.endSeconds;
req.wetDry = 1.0; // fully wet (post-fader tap)
req.tailMode = reasampler::TailMode::None; // realtime tail is T2; exact bounds here
req.tailMs = 0.0;
req.tailMode = tail.mode; // None / Auto / Manual, from the panel toggle
req.tailMs = tail.manualMs; // Manual-only (pre-clamped); ignored for None/Auto
req.sampleRate = 0; // follow project rate
req.channelCount = 2;
req.bitDepth = reasampler::WavBitDepth::Float32;
@@ -623,8 +630,15 @@ static void RunCaptureRealtimeTrack()
// completion across ticks (UI stays responsive).
g_rtCaptureProject = EnumProjects(-1, nullptr, 0);
g_rtCapture = std::move(st);
ShowConsoleMsg("ReaSampler: realtime capture started — recording in the "
"background; the bank updates when it reaches the range end.\n");
// With a tail mode the recorded window runs PAST the range end (Auto: +8 s then
// decay-trim; Manual: +the set length), so the completion note names the window,
// not just the range end.
const char* doneWhen =
(tail.mode == reasampler::TailMode::None)
? "the bank updates when it reaches the range end."
: "the bank updates after the extra tail window (past the range end).";
ShowConsoleMsg((std::string("ReaSampler: realtime capture started — recording in "
"the background; ") + doneWhen + "\n").c_str());
}
// Cancels the in-flight realtime capture on demand (bindable action). Force-terminates