SHA256
Round Voice Start Times Down To Output Samples
This commit is contained in:
1 parent
455436e744
commit
5136127e39
1 file changed
+5
-2
@@ -75,8 +75,11 @@ internal sealed class VoiceMixer : IDisposable
|
|||||||
/// <summary>Voices currently mixed (started or waiting to start). Render thread only.</summary>
|
/// <summary>Voices currently mixed (started or waiting to start). Render thread only.</summary>
|
||||||
public int ActiveVoiceCount => _voices.Count;
|
public int ActiveVoiceCount => _voices.Count;
|
||||||
|
|
||||||
/// <summary>Output sample nearest to <paramref name="seconds"/>.</summary>
|
/// <summary>
|
||||||
public static long ToSample(double seconds, int rate) => (long)Math.Round(seconds * rate, MidpointRounding.AwayFromZero);
|
/// 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 ──
|
// ── Main thread ──
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user