e8ff4df05f
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.
20 lines
808 B
C#
20 lines
808 B
C#
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
namespace ytLive.Helpers;
|
|
|
|
/// <summary>TASK 22: the audio-sync status dot — green when the sync offset is a
|
|
/// no-op (0 ms), amber once the creator has dialled in a delay.</summary>
|
|
public class IntToSyncBrushConverter : IValueConverter
|
|
{
|
|
private static readonly Brush Ok = new SolidColorBrush(Color.FromRgb(0x34, 0xd3, 0x99));
|
|
private static readonly Brush Set = new SolidColorBrush(Color.FromRgb(0xf5, 0xb8, 0x4c));
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> value is int i && i == 0 ? Ok : Set;
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> throw new NotSupportedException();
|
|
}
|