From 9c90c0b2ed61bf273005bc6a784f177235623c09 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 1 May 2016 13:04:29 -0700 Subject: [PATCH] WASAPI: default input software latency when none detected See #73 --- src/wasapi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wasapi.c b/src/wasapi.c index 11e7c07..faf4f34 100644 --- a/src/wasapi.c +++ b/src/wasapi.c @@ -1784,6 +1784,10 @@ static int instream_do_open(struct SoundIoPrivate *si, struct SoundIoInStreamPri if (FAILED(hr = IAudioClient_GetBufferSize(isw->audio_client, &isw->buffer_frame_count))) { return SoundIoErrorOpeningDevice; } + if (instream->software_latency == 0.0) + instream->software_latency = 1.0; + instream->software_latency = soundio_double_clamp(device->software_latency_min, + instream->software_latency, device->software_latency_max); if (isw->is_raw) instream->software_latency = isw->buffer_frame_count / (double)instream->sample_rate;