diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-16 08:22:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 08:22:09 +0100 |
commit | c2ac3db0392e5c0b23f622fa96820f8ee80fc0dc (patch) | |
tree | 783bebe6720910078d4412d7e59f8189072d5127 /drivers | |
parent | 53ae45f657b63a7e9c122f8db27f5f9b5f8dda98 (diff) | |
parent | 21e244773b7828243e6d2979bbba641970ddf931 (diff) |
Merge pull request #54880 from benjarmstrong/wasapi_input_fix
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/wasapi/audio_driver_wasapi.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 520d4808fb..403feb149e 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -387,14 +387,17 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN); // Due to WASAPI Shared Mode we have no control of the buffer size - buffer_frames = max_frames; - - int64_t latency = 0; - audio_output.audio_client->GetStreamLatency(&latency); - // WASAPI REFERENCE_TIME units are 100 nanoseconds per unit - // https://docs.microsoft.com/en-us/windows/win32/directshow/reference-time - // Convert REFTIME to seconds as godot uses for latency - real_latency = (float)latency / (float)REFTIMES_PER_SEC; + if (!p_capture) { + buffer_frames = max_frames; + + int64_t latency = 0; + audio_output.audio_client->GetStreamLatency(&latency); + // WASAPI REFERENCE_TIME units are 100 nanoseconds per unit + // https://docs.microsoft.com/en-us/windows/win32/directshow/reference-time + // Convert REFTIME to seconds as godot uses for latency + real_latency = (float)latency / (float)REFTIMES_PER_SEC; + } + } else { IAudioClient3 *device_audio_client_3 = (IAudioClient3 *)p_device->audio_client; |