diff options
author | Chris Robinson <[email protected]> | 2012-01-17 12:38:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-01-17 12:38:47 -0800 |
commit | 66a700729bf3590a11807e4df5ef82c5e2c3d336 (patch) | |
tree | fddbad948d6fe2ced790c407f72fe1fcd29dcfa2 | |
parent | a7266442c2675df1016e44bbb39b296d179d707f (diff) |
Retry opening the DSound device with 16-bit short if 32-bit float output fails
-rw-r--r-- | Alc/backends/dsound.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c index f1dd0762..371c1045 100644 --- a/Alc/backends/dsound.c +++ b/Alc/backends/dsound.c @@ -421,6 +421,8 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) break; } +retry_open: + hr = S_OK; OutputType.Format.wFormatTag = WAVE_FORMAT_PCM; OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans); OutputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; @@ -439,6 +441,10 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; else OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + + if(pData->DSpbuffer) + IDirectSoundBuffer_Release(pData->DSpbuffer); + pData->DSpbuffer = NULL; } else { @@ -469,6 +475,11 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) OutputType.Format.nBlockAlign; DSBDescription.lpwfxFormat=&OutputType.Format; hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSsbuffer, NULL); + if(FAILED(hr) && device->FmtType == DevFmtFloat) + { + device->FmtType = DevFmtShort; + goto retry_open; + } } if(SUCCEEDED(hr)) |