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:
@@ -126,6 +126,31 @@ static void testTailManualClampsToCap() {
|
||||
CHECK(tailRenderSettingsFor(TailMode::Manual, -50.0).tailMs == 0.0);
|
||||
}
|
||||
|
||||
// --- realtimeRecordWindowEnd: the T2 record-window extension -----------------
|
||||
|
||||
static void testRealtimeWindowNoneIsExact() {
|
||||
// None -> the exact range end, no extra recording (byte-identical to today).
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::None, 12.5, 2000.0) == 12.5);
|
||||
// manualTailMs is ignored for None.
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::None, 12.5, 0.0) == 12.5);
|
||||
}
|
||||
|
||||
static void testRealtimeWindowAutoAddsCap() {
|
||||
// Auto -> range end + the 8 s runaway cap (trimmed later by the decay scan).
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::Auto, 10.0, 0.0) == 10.0 + kMaxTailSeconds);
|
||||
// manualTailMs is ignored for Auto (the cap is fixed).
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::Auto, 10.0, 3000.0) == 10.0 + kMaxTailSeconds);
|
||||
}
|
||||
|
||||
static void testRealtimeWindowManualAddsClampedLength() {
|
||||
// Manual -> range end + the set length in seconds (fixed, no trim).
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::Manual, 5.0, 2000.0) == 5.0 + 2.0);
|
||||
// Clamped to the 8 s cap: > 8000 ms -> +8 s.
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::Manual, 5.0, 9000.0) == 5.0 + kMaxTailSeconds);
|
||||
// Negative floors to 0 -> no extra window (never records before the range end).
|
||||
CHECK(realtimeRecordWindowEnd(TailMode::Manual, 5.0, -100.0) == 5.0);
|
||||
}
|
||||
|
||||
// --- parseRazorEdits: P_RAZOREDITS string -> ranges --------------------------
|
||||
|
||||
static void testParseSingleTrackAudioArea() {
|
||||
@@ -267,6 +292,9 @@ int main() {
|
||||
testAutoTrimRatioDerivesFromDb();
|
||||
testTailManualFixedNoTrim();
|
||||
testTailManualClampsToCap();
|
||||
testRealtimeWindowNoneIsExact();
|
||||
testRealtimeWindowAutoAddsCap();
|
||||
testRealtimeWindowManualAddsClampedLength();
|
||||
testParseSingleTrackAudioArea();
|
||||
testParseMultipleAreas();
|
||||
testParseSkipsEnvelopeLaneAreas();
|
||||
|
||||
Reference in New Issue
Block a user