From 7b3d837bbbcda0ac9b12850da67dca11a041bb7b Mon Sep 17 00:00:00 2001 From: dmitrykos Date: Sat, 6 Nov 2010 01:16:34 +0000 Subject: [PATCH] wasapi: fixed audio stream failing to open on Windows 7 in Exclusive mode if suggestedLatency parameter is 0 and user framesPerBuffer is less than 3 milliseconds --- src/hostapi/wasapi/pa_win_wasapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index cff3abd..9d48f34 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -632,13 +632,13 @@ static UINT32 ALIGN_BWD(UINT32 v, UINT32 align) // ------------------------------------------------------------------------------------------ // Aligns 'v' forward -/*static UINT32 ALIGN_FWD(UINT32 v, UINT32 align) +static UINT32 ALIGN_FWD(UINT32 v, UINT32 align) { UINT32 remainder = (align ? (v % align) : 0); if (remainder == 0) return v; return v + (align - remainder); -}*/ +} // ------------------------------------------------------------------------------------------ // Aligns WASAPI buffer to 128 byte packet boundary. HD Audio will fail to play if buffer @@ -2056,7 +2056,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu pSub->period = pInfo->MinimumDevicePeriod; // Recalculate aligned period framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec); - _CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD); + _CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_FWD); } } -- 2.43.0