From: dmitrykos Date: Sat, 20 Feb 2010 12:03:57 +0000 (+0000) Subject: wasapi: improved paFramesPerBufferUnspecified handling in case device does not provid... X-Git-Tag: pa_stable_v19_20110326_r1647~170 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=d2e38acc08a2f83a1c3c40fb32695d3bee209a50;p=portaudio wasapi: improved paFramesPerBufferUnspecified handling in case device does not provide default period, paInvalidSampleRate will be returned if sampleRate parameter is 0 for Pa_IsFormatSupported/Pa_OpenStream --- diff --git a/src/hostapi/wasapi/pa_win_wasapi.cpp b/src/hostapi/wasapi/pa_win_wasapi.cpp index ec938fd..a3a4bb1 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.cpp +++ b/src/hostapi/wasapi/pa_win_wasapi.cpp @@ -1368,6 +1368,8 @@ static PaError IsStreamParamsValid(struct PaUtilHostApiRepresentation *hostApi, { if (hostApi == NULL) return paHostApiNotFound; + if ((UINT32)sampleRate == 0) + return paInvalidSampleRate; if (inputParameters != NULL) { @@ -1686,6 +1688,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, // choosing maximum default size framesPerBuffer = max(framesPerBufferIn, framesPerBufferOut); } + if (framesPerBuffer == 0) + framesPerBuffer = ((UINT32)sampleRate / 100) * 2; // Try create device: Input if (inputParameters != NULL)