From 5136127e39a77e43a4f9a197ac832a3bd6d4c5b63f21166fce09fb274f99881f Mon Sep 17 00:00:00 2001 From: copecone Date: Tue, 13 Oct 2026 19:20:59 +0900 Subject: [PATCH] Round Voice Start Times Down To Output Samples --- Util/Audio/Mixer/VoiceMixer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Util/Audio/Mixer/VoiceMixer.cs b/Util/Audio/Mixer/VoiceMixer.cs index 9be63e6..b522d4b 100644 --- a/Util/Audio/Mixer/VoiceMixer.cs +++ b/Util/Audio/Mixer/VoiceMixer.cs @@ -75,8 +75,11 @@ internal sealed class VoiceMixer : IDisposable /// Voices currently mixed (started or waiting to start). Render thread only. public int ActiveVoiceCount => _voices.Count; - /// Output sample nearest to . - public static long ToSample(double seconds, int rate) => (long)Math.Round(seconds * rate, MidpointRounding.AwayFromZero); + /// + /// Output sample containing (seconds × rate rounded down), the sample at which + /// AudioSource.PlayScheduled starts a sound scheduled between two output samples. + /// + public static long ToSample(double seconds, int rate) => (long)Math.Floor(seconds * rate); // ── Main thread ──