Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion OpenUtau/NAudioOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class NAudioOutput : DummyAudioOutput { }
#else
public class NAudioOutput : IAudioOutput {
const int Channels = 2;
const int PlaybackLatencyMs = 50;

private readonly object lockObj = new object();
private WaveOutEvent? waveOutEvent;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void Init(ISampleProvider sampleProvider) {
wasapiOut.Stop();
wasapiOut.Dispose();
}
wasapiOut = new WasapiOut(AudioClientShareMode.Shared, 200);
wasapiOut = new WasapiOut(AudioClientShareMode.Shared, PlaybackLatencyMs);
wasapiOut.PlaybackStopped += OnWasapiPlaybackStopped;
wasapiOut.Init(sampleProvider);
} else {
Expand All @@ -94,6 +95,8 @@ public void Init(ISampleProvider sampleProvider) {
}
waveOutEvent = new WaveOutEvent() {
DeviceNumber = deviceNumber,
DesiredLatency = PlaybackLatencyMs,
NumberOfBuffers = 2,
};
waveOutEvent.Init(sampleProvider);
}
Expand Down
Loading