audacia/lib-src/portaudio-v19/wasapi-fix.patch

50 lines
1.6 KiB
Diff

diff --git a/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c b/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c
index 93e1d612a..f64049ad5 100644
--- a/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c
+++ b/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c
@@ -576,6 +576,9 @@ typedef struct PaWasapiStream
// thread is being started
volatile BOOL running;
+ // stream has not or is no longer started
+ BOOL stopped;
+
PA_THREAD_ID dwThreadId;
HANDLE hThread;
HANDLE hCloseRequest;
@@ -3550,6 +3553,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if (framesPerBuffer == 0)
framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
+ stream->stopped = TRUE;
+ stream->running = FALSE;
+
// Try create device: Input
if (inputParameters != NULL)
{
@@ -4275,6 +4281,7 @@ static PaError StartStream( PaStream *s )
// Signal: stream running.
stream->running = TRUE;
}
+ stream->stopped = FALSE;
return result;
@@ -4316,6 +4323,7 @@ void _StreamFinish(PaWasapiStream *stream)
_StreamCleanup(stream);
stream->running = FALSE;
+ stream->stopped = TRUE;
}
// ------------------------------------------------------------------------------------------
@@ -4349,7 +4357,7 @@ static PaError AbortStream( PaStream *s )
// ------------------------------------------------------------------------------------------
static PaError IsStreamStopped( PaStream *s )
{
- return !((PaWasapiStream *)s)->running;
+ return ((PaWasapiStream *)s)->stopped;
}
// ------------------------------------------------------------------------------------------