From 418904abd336990b54c32c52518847d12237c666 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 25 Aug 2015 00:23:12 -0700 Subject: [PATCH] WASAPI: support exclusive mode capture --- src/wasapi.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/wasapi.cpp b/src/wasapi.cpp index 0002a90..bcf0ce3 100644 --- a/src/wasapi.cpp +++ b/src/wasapi.cpp @@ -1628,7 +1628,23 @@ static int instream_do_open(struct SoundIoPrivate *si, struct SoundIoInStreamPri } static void instream_raw_run(SoundIoInStreamPrivate *is) { - soundio_panic("TODO instream_raw_run"); + SoundIoInStreamWasapi *isw = &is->backend_data.wasapi; + SoundIoInStream *instream = &is->pub; + + HRESULT hr; + + if (FAILED(hr = IAudioClient_Start(isw->audio_client))) { + instream->error_callback(instream, SoundIoErrorStreaming); + return; + } + + for (;;) { + WaitForSingleObject(isw->h_event, INFINITE); + if (!isw->thread_exit_flag.test_and_set()) + return; + + instream->read_callback(instream, isw->buffer_frame_count, isw->buffer_frame_count); + } } static void instream_shared_run(SoundIoInStreamPrivate *is) {