Rewrite Audio #5

Merged
copecone merged 14 commits from feature/audio_rewrite into main 2026-10-15 01:29:31 +09:00
Showing only changes of commit a2e6c49d7a - Show all commits
+5 -2
View File
@@ -75,8 +75,11 @@ internal sealed class VoiceMixer : IDisposable
/// <summary>Voices currently mixed (started or waiting to start). Render thread only.</summary>
public int ActiveVoiceCount => _voices.Count;
/// <summary>Output sample nearest to <paramref name="seconds"/>.</summary>
public static long ToSample(double seconds, int rate) => (long)Math.Round(seconds * rate, MidpointRounding.AwayFromZero);
/// <summary>
/// Output sample containing <paramref name="seconds"/> (seconds × rate rounded down), the sample at which
/// AudioSource.PlayScheduled starts a sound scheduled between two output samples.
/// </summary>
public static long ToSample(double seconds, int rate) => (long)Math.Floor(seconds * rate);
// ── Main thread ──