Files
LlamaCasty/HANDOFF.md
T
gramps e8ff4df05f TASK 22: global audio sync offset (positive delay at the mixer out)
Adds AudioSyncOffsetMs (0..500ms, default 0) that delays the whole
interleaved-stereo mix so audio lands on the video when it runs ahead —
OBS's documented lip-sync fix. Positive-only: advancing audio needs a
video-side delay and is out of the audio layer's scope.

- Services/Audio/AudioSyncDelay.cs: pure delay line, flushed on Configure
- AudioMixer: Func<int> syncOffsetMs seam + delay applied post-limiter
- LayoutStore.Settings + MainViewModel.Audio/VM: load/save + binding
- PreviewPane mic bar: SYNC slider + status dot (IntToSyncBrushConverter)
- AudioSyncDelayTests: identity, negative/beyond-500 clamps, 10ms→960 samples

Reference (external scan): https://obs-versions.com/blog/how-to-fix-audio-delay-on-obs
(audio ahead => positive delay). Verified: build 0 warnings; 3/3 delay tests pass.
2026-08-31 18:30:03 -07:00

56 lines
2.7 KiB
Markdown

# HANDOFF — Session State
## Branch / Commit State
**`main`**, working toward TASK 22 (audio sync offset). Prior milestone **TASK 31**
(SceneGraph + baked-crust compositor) is fully done, committed (`670fe3a`), pushed
(`origin/main` `3bf053a..670fe3a`), and verified by the user on native Windows
PowerShell (only the 2 known pre-existing failures remained).
## What's In Flight
**TASK 22 (audio sync offset) — implemented, uncommitted, awaiting commit + user
verification on Windows.**
Scope (Good-Dog single use-case; user chose positive-only slider at the mixer out):
a global `AudioSyncOffsetMs` (0..500 ms, default 0) that delays the whole
interleaved-stereo mix so audio lands on the video when it runs ahead — OBS's
documented lip-sync fix. Positive-only: advancing audio needs a video-side delay
(out of the audio layer's scope; tracked for v1.1).
Files touched (this work unit):
- `Services/Audio/AudioSyncDelay.cs` (new) — pure delay line, flushed on `Configure`.
- `Services/Audio/AudioMixer.cs` — `Func<int> syncOffsetMs` seam + `_syncDelay`
applied post-limiter in `FillAndMix`.
- `Services/LayoutStore.Settings.cs` — `LoadAudioSyncOffsetMs`/`SaveAudioSyncOffsetMs`
(`Audio.SyncOffsetMs`).
- `ViewModels/MainViewModel.cs` — load offset at startup + save in `SaveLayoutNow`.
- `ViewModels/MainViewModel.Audio.cs` — `AudioSyncOffsetMs` property (clamped, `ScheduleSave`).
- `Controls/PreviewPane.xaml` — SYNC slider (0..500) + status dot on the mic bar.
- `Helpers/IntToSyncBrushConverter.cs` (new) + registered in `Themes/Controls.xaml`.
- `ytLive.Tests/AudioSyncDelayTests.cs` (new) — 3 tests.
- `ai.md`, `TASKS.md`, `HANDOFF.md`.
**Verified:** `ytLive.csproj` and `ytLive.Tests.csproj` build with 0 warnings;
`AudioSyncDelayTests` (3/3) pass via vstest filter. The full audio pipeline /
RealAppHost suites hang headless (pre-existing) — must be verified on native
Windows PowerShell by the user.
**Landmine:** a stale `testhost` can lock `ytLive.Tests`'s `ytLive.dll` and break
`dotnet build` of the test project — kill it first (`cmd.exe /c "taskkill /PID N /F"`)
if the build hits MSB3027.
## Next
1. User runs `scripts/verify.sh` (or native Windows vstest) to confirm the full
suite — expect only the 2 known pre-existing failures.
2. On confirmation, run `scripts/scope-check.sh` with the declared file list,
commit as one work unit, await the user's push go-ahead (sub-milestone).
## The directive (2026-08-31, user)
Rewrite the project into functional components to aid AI retrieval — the
`Services/ChatOverlayLayer.cs` style (owner-state extraction), not line-count
chasing. TASK 31's `SceneGraph.cs` continued that pattern (an owner object owning
the scene collection + mutation surface).