From a8da43fa5d996f07862cb2a77d0ba3645e80f9b0 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 25 Jun 2008 08:59:25 +0000 Subject: [PATCH] --- .../juce_win32_DirectSound.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build/win32/platform_specific_code/juce_win32_DirectSound.cpp b/build/win32/platform_specific_code/juce_win32_DirectSound.cpp index b87b036b62..05aef1baac 100644 --- a/build/win32/platform_specific_code/juce_win32_DirectSound.cpp +++ b/build/win32/platform_specific_code/juce_win32_DirectSound.cpp @@ -373,7 +373,7 @@ public: totalBytesPerBuffer = (3 * bytesPerBuffer) & ~15; const int numChannels = 2; - hr = pDirectSound->SetCooperativeLevel (GetDesktopWindow(), 3 /* DSSCL_EXCLUSIVE */); + hr = pDirectSound->SetCooperativeLevel (GetDesktopWindow(), 2 /* DSSCL_PRIORITY */); logError (hr); if (hr == S_OK) @@ -512,6 +512,16 @@ public: (void**) &lpbuf1, &dwSize1, (void**) &lpbuf2, &dwSize2, 0); + if (hr == MAKE_HRESULT (1, 0x878, 150)) // DSERR_BUFFERLOST + { + pOutputBuffer->Restore(); + + hr = pOutputBuffer->Lock (writeOffset, + bytesPerBuffer, + (void**) &lpbuf1, &dwSize1, + (void**) &lpbuf2, &dwSize2, 0); + } + if (hr == S_OK) { if (bitDepth == 16) @@ -991,7 +1001,8 @@ public: sampleRate (0.0), inputBuffers (0), outputBuffers (0), - callback (0) + callback (0), + bufferSizeSamples (0) { }