Skip to content

Commit

Permalink
Merge pull request #881 from jgraj/patch-1
Browse files Browse the repository at this point in the history
Remove unused `audioProcessingDoneEvent`
  • Loading branch information
RobDangerous authored Aug 9, 2024
2 parents 7ccdd1c + b796172 commit dc802e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions Backends/Audio2/WASAPI/Sources/kinc/backend/wasapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace {
IAudioClient *audioClient = NULL;
IAudioRenderClient *renderClient = NULL;
HANDLE bufferEndEvent = 0;
HANDLE audioProcessingDoneEvent;
UINT32 bufferFrames;
WAVEFORMATEX requestedFormat;
WAVEFORMATEX *closestFormat;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<AudioRenderer>();

Expand Down

0 comments on commit dc802e9

Please sign in to comment.