Skip to content

Commit

Permalink
Add retry to sound wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Mar 13, 2021
1 parent de4ea77 commit 4ef2bcc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Resources/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 1896
#define BUILD_NUMBER 1897
12 changes: 11 additions & 1 deletion Wrappers/dsound/IDirectSound8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ HRESULT m_IDirectSound8::CreateSoundBuffer(LPCDSBUFFERDESC pcDSBufferDesc, LPDIR
DSBufferDesc->dwFlags |= DSBCAPS_CTRLVOLUME;
}

HRESULT hr = ProxyInterface->CreateSoundBuffer(pcDSBufferDesc, ppDSBuffer, pUnkOuter);
HRESULT hr;

DWORD x = 0;
do {
hr = ProxyInterface->CreateSoundBuffer(pcDSBufferDesc, ppDSBuffer, pUnkOuter);

if (FAILED(hr))
{
Sleep(100);
}
} while (FAILED(hr) && ++x < 100);

if (SUCCEEDED(hr) && ppDSBuffer)
{
Expand Down
12 changes: 11 additions & 1 deletion Wrappers/dsound/dsoundwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ HRESULT WINAPI DirectSoundCreate8Wrapper(LPCGUID pcGuidDevice, LPDIRECTSOUND8 *p
{
LOG_LIMIT(3, "Redirecting 'DirectSoundCreate8' ...");

HRESULT hr = m_pDirectSoundCreate8(pcGuidDevice, ppDS8, pUnkOuter);
HRESULT hr;

DWORD x = 0;
do {
hr = m_pDirectSoundCreate8(pcGuidDevice, ppDS8, pUnkOuter);

if (FAILED(hr))
{
Sleep(100);
}
} while (FAILED(hr) && ++x < 100);

if (SUCCEEDED(hr) && ppDS8)
{
Expand Down

0 comments on commit 4ef2bcc

Please sign in to comment.