1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Recreate and apply WASAPI IsStreamStopped() patch

This commit is contained in:
Leland Lucius 2019-12-15 02:37:06 -06:00
parent 07b95d72da
commit e3e1758110
2 changed files with 15 additions and 7 deletions

View File

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

View File

@ -1,8 +1,8 @@
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 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 de05d72..0026033 100644 index 93e1d612a..f64049ad5 100644
--- a/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c --- a/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c
+++ b/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c +++ b/lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c
@@ -499,6 +499,9 @@ typedef struct PaWasapiStream @@ -576,6 +576,9 @@ typedef struct PaWasapiStream
// thread is being started // thread is being started
volatile BOOL running; volatile BOOL running;
@ -12,7 +12,7 @@ index de05d72..0026033 100644
PA_THREAD_ID dwThreadId; PA_THREAD_ID dwThreadId;
HANDLE hThread; HANDLE hThread;
HANDLE hCloseRequest; HANDLE hCloseRequest;
@@ -2882,6 +2885,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, @@ -3550,6 +3553,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if (framesPerBuffer == 0) if (framesPerBuffer == 0)
framesPerBuffer = ((UINT32)sampleRate / 100) * 2; framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
@ -22,7 +22,7 @@ index de05d72..0026033 100644
// Try create device: Input // Try create device: Input
if (inputParameters != NULL) if (inputParameters != NULL)
{ {
@@ -3546,6 +3552,7 @@ static PaError StartStream( PaStream *s ) @@ -4275,6 +4281,7 @@ static PaError StartStream( PaStream *s )
// Signal: stream running. // Signal: stream running.
stream->running = TRUE; stream->running = TRUE;
} }
@ -30,7 +30,7 @@ index de05d72..0026033 100644
return result; return result;
@@ -3587,6 +3594,7 @@ void _StreamFinish(PaWasapiStream *stream) @@ -4316,6 +4323,7 @@ void _StreamFinish(PaWasapiStream *stream)
_StreamCleanup(stream); _StreamCleanup(stream);
stream->running = FALSE; stream->running = FALSE;
@ -38,7 +38,7 @@ index de05d72..0026033 100644
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
@@ -3620,7 +3628,7 @@ static PaError AbortStream( PaStream *s ) @@ -4349,7 +4357,7 @@ static PaError AbortStream( PaStream *s )
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
static PaError IsStreamStopped( PaStream *s ) static PaError IsStreamStopped( PaStream *s )
{ {