From 4a4c06acd4038c6b0ffa9107854d8da619bff105 Mon Sep 17 00:00:00 2001 From: Julian <31388661+jgraj@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:24:56 +0200 Subject: [PATCH 1/2] Remove unused `audioProcessingDoneEvent` --- Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c b/Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c index f2d41a769..d80c78270 100644 --- a/Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c +++ b/Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c @@ -75,7 +75,6 @@ static IMMDevice *device; static IAudioClient *audioClient = NULL; static IAudioRenderClient *renderClient = NULL; static HANDLE bufferEndEvent = 0; -static HANDLE audioProcessingDoneEvent; static UINT32 bufferFrames; static WAVEFORMATEX requestedFormat; static WAVEFORMATEX *closestFormat; @@ -240,7 +239,7 @@ static void submitBuffer(unsigned frames) { static DWORD WINAPI audioThread(LPVOID ignored) { submitBuffer(bufferFrames); audioClient->lpVtbl->Start(audioClient); - while (WAIT_OBJECT_0 != WaitForSingleObject(audioProcessingDoneEvent, 0)) { + while (1) { WaitForSingleObject(bufferEndEvent, INFINITE); UINT32 padding = 0; HRESULT result = audioClient->lpVtbl->GetCurrentPadding(audioClient, &padding); @@ -275,9 +274,6 @@ void kinc_a2_init() { a2_buffer.channels[0] = (float *)malloc(a2_buffer.data_size * sizeof(float)); a2_buffer.channels[1] = (float *)malloc(a2_buffer.data_size * sizeof(float)); - audioProcessingDoneEvent = CreateEvent(0, FALSE, FALSE, 0); - kinc_affirm(audioProcessingDoneEvent != 0); - kinc_windows_co_initialize(); kinc_microsoft_affirm(CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&deviceEnumerator)); From b79617205769b16b321ec48b151a4c91c3d1a831 Mon Sep 17 00:00:00 2001 From: Julian <31388661+jgraj@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:29:17 +0200 Subject: [PATCH 2/2] Remove unused `audioProcessingDoneEvent` --- .../WASAPI_WinRT/Sources/kinc/backend/WASAPI.winrt.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Backends/Audio2/WASAPI_WinRT/Sources/kinc/backend/WASAPI.winrt.cpp b/Backends/Audio2/WASAPI_WinRT/Sources/kinc/backend/WASAPI.winrt.cpp index c3dff53ce..c32085149 100644 --- a/Backends/Audio2/WASAPI_WinRT/Sources/kinc/backend/WASAPI.winrt.cpp +++ b/Backends/Audio2/WASAPI_WinRT/Sources/kinc/backend/WASAPI.winrt.cpp @@ -45,7 +45,6 @@ namespace { IAudioClient *audioClient = NULL; IAudioRenderClient *renderClient = NULL; HANDLE bufferEndEvent = 0; - HANDLE audioProcessingDoneEvent; UINT32 bufferFrames; WAVEFORMATEX requestedFormat; WAVEFORMATEX *closestFormat; @@ -229,7 +228,7 @@ namespace { void audioThread(LPVOID) { submitBuffer(bufferFrames); audioClient->Start(); - while (WAIT_OBJECT_0 != WaitForSingleObject(audioProcessingDoneEvent, 0)) { + while (true) { WaitForSingleObject(bufferEndEvent, INFINITE); UINT32 padding = 0; HRESULT result = audioClient->GetCurrentPadding(&padding); @@ -269,9 +268,6 @@ void kinc_a2_init() { a2_buffer.channels[0] = (float *)malloc(a2_buffer.data_size * sizeof(float)); a2_buffer.channels[1] = (float *)malloc(a2_buffer.data_size * sizeof(float)); - audioProcessingDoneEvent = CreateEvent(0, FALSE, FALSE, 0); - kinc_affirm(audioProcessingDoneEvent != 0); - #ifdef KINC_WINDOWSAPP renderer = Make();