Skip to content

Commit 4ef2bcc

Browse files
committed
Add retry to sound wrapper
1 parent de4ea77 commit 4ef2bcc

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Resources/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 1896
1+
#define BUILD_NUMBER 1897

Wrappers/dsound/IDirectSound8.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,17 @@ HRESULT m_IDirectSound8::CreateSoundBuffer(LPCDSBUFFERDESC pcDSBufferDesc, LPDIR
7171
DSBufferDesc->dwFlags |= DSBCAPS_CTRLVOLUME;
7272
}
7373

74-
HRESULT hr = ProxyInterface->CreateSoundBuffer(pcDSBufferDesc, ppDSBuffer, pUnkOuter);
74+
HRESULT hr;
75+
76+
DWORD x = 0;
77+
do {
78+
hr = ProxyInterface->CreateSoundBuffer(pcDSBufferDesc, ppDSBuffer, pUnkOuter);
79+
80+
if (FAILED(hr))
81+
{
82+
Sleep(100);
83+
}
84+
} while (FAILED(hr) && ++x < 100);
7585

7686
if (SUCCEEDED(hr) && ppDSBuffer)
7787
{

Wrappers/dsound/dsoundwrapper.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ HRESULT WINAPI DirectSoundCreate8Wrapper(LPCGUID pcGuidDevice, LPDIRECTSOUND8 *p
4848
{
4949
LOG_LIMIT(3, "Redirecting 'DirectSoundCreate8' ...");
5050

51-
HRESULT hr = m_pDirectSoundCreate8(pcGuidDevice, ppDS8, pUnkOuter);
51+
HRESULT hr;
52+
53+
DWORD x = 0;
54+
do {
55+
hr = m_pDirectSoundCreate8(pcGuidDevice, ppDS8, pUnkOuter);
56+
57+
if (FAILED(hr))
58+
{
59+
Sleep(100);
60+
}
61+
} while (FAILED(hr) && ++x < 100);
5262

5363
if (SUCCEEDED(hr) && ppDS8)
5464
{

0 commit comments

Comments
 (0)