From dcc2f7fa48d0e15febdfae71b5038b4a7bd1f4fb Mon Sep 17 00:00:00 2001 From: dmitrykos Date: Sat, 3 Oct 2020 23:21:11 +0300 Subject: [PATCH] wasapi: Fix paInvalidSampleRate (and any other) error code is replaced with paInvalidDevice if audio client failed to be created due to some reason. --- src/hostapi/wasapi/pa_win_wasapi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index 17846bd..f23fd58 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -3705,11 +3705,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->in.params.wow64_workaround = paWasapi->useWOW64Workaround; // Create and activate audio client - if (FAILED(hr = ActivateAudioClientInput(stream))) + if ((result = ActivateAudioClientInput(stream)) != paNoError) { - LogPaError(result = paInvalidDevice); + LogPaError(result); goto error; - } + } // Get closest format hostInputSampleFormat = PaUtil_SelectClosestAvailableFormat(WaveToPaFormat(&stream->in.wavex), inputSampleFormat); @@ -3839,11 +3839,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, stream->out.params.wow64_workaround = paWasapi->useWOW64Workaround; // Create and activate audio client - if (FAILED(hr = ActivateAudioClientOutput(stream))) + if ((result = ActivateAudioClientOutput(stream)) != paNoError) { - LogPaError(result = paInvalidDevice); + LogPaError(result); goto error; - } + } // Get closest format hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat(WaveToPaFormat(&stream->out.wavex), outputSampleFormat); -- 2.43.0