Commit d4d14cde authored by Mark Harmstone's avatar Mark Harmstone Committed by Alexandre Julliard

dsound: Pretend we have hardware buffers.

When running in Windows XP mode, XAudio2 will refuse to output surround sound unless it can open a buffer with DSBCAPS_LOCHARDWARE.
parent b5aec2e4
...@@ -994,6 +994,9 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This) ...@@ -994,6 +994,9 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
if (ref > 1) if (ref > 1)
WARN("Destroying buffer with %u in use interfaces\n", ref - 1); WARN("Destroying buffer with %u in use interfaces\n", ref - 1);
if (This->dsbd.dwFlags & DSBCAPS_LOCHARDWARE)
This->device->drvcaps.dwFreeHwMixingAllBuffers++;
DirectSoundDevice_RemoveBuffer(This->device, This); DirectSoundDevice_RemoveBuffer(This->device, This);
RtlDeleteResource(&This->lock); RtlDeleteResource(&This->lock);
......
...@@ -271,8 +271,15 @@ static HRESULT WINAPI IDirectSound8Impl_GetCaps(IDirectSound8 *iface, DSCAPS *ds ...@@ -271,8 +271,15 @@ static HRESULT WINAPI IDirectSound8Impl_GetCaps(IDirectSound8 *iface, DSCAPS *ds
dscaps->dwMaxHwMixingStaticBuffers = This->device->drvcaps.dwMaxHwMixingStaticBuffers; dscaps->dwMaxHwMixingStaticBuffers = This->device->drvcaps.dwMaxHwMixingStaticBuffers;
dscaps->dwMaxHwMixingStreamingBuffers = This->device->drvcaps.dwMaxHwMixingStreamingBuffers; dscaps->dwMaxHwMixingStreamingBuffers = This->device->drvcaps.dwMaxHwMixingStreamingBuffers;
dscaps->dwFreeHwMixingAllBuffers = This->device->drvcaps.dwFreeHwMixingAllBuffers; dscaps->dwFreeHwMixingAllBuffers = This->device->drvcaps.dwFreeHwMixingAllBuffers;
dscaps->dwFreeHwMixingStaticBuffers = This->device->drvcaps.dwFreeHwMixingStaticBuffers;
dscaps->dwFreeHwMixingStreamingBuffers = This->device->drvcaps.dwFreeHwMixingStreamingBuffers; if (This->device->drvcaps.dwFreeHwMixingAllBuffers > 0) {
dscaps->dwFreeHwMixingStaticBuffers = This->device->drvcaps.dwFreeHwMixingStaticBuffers;
dscaps->dwFreeHwMixingStreamingBuffers = This->device->drvcaps.dwFreeHwMixingStreamingBuffers;
} else {
dscaps->dwFreeHwMixingStaticBuffers = 0;
dscaps->dwFreeHwMixingStreamingBuffers = 0;
}
dscaps->dwMaxHw3DAllBuffers = This->device->drvcaps.dwMaxHw3DAllBuffers; dscaps->dwMaxHw3DAllBuffers = This->device->drvcaps.dwMaxHw3DAllBuffers;
dscaps->dwMaxHw3DStaticBuffers = This->device->drvcaps.dwMaxHw3DStaticBuffers; dscaps->dwMaxHw3DStaticBuffers = This->device->drvcaps.dwMaxHw3DStaticBuffers;
dscaps->dwMaxHw3DStreamingBuffers = This->device->drvcaps.dwMaxHw3DStreamingBuffers; dscaps->dwMaxHw3DStreamingBuffers = This->device->drvcaps.dwMaxHw3DStreamingBuffers;
...@@ -913,9 +920,12 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG ...@@ -913,9 +920,12 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
device->drvcaps.dwPrimaryBuffers = 1; device->drvcaps.dwPrimaryBuffers = 1;
device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN; device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN;
device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX; device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX;
device->drvcaps.dwMaxHwMixingAllBuffers = 1; device->drvcaps.dwMaxHwMixingAllBuffers = 16;
device->drvcaps.dwMaxHwMixingStaticBuffers = 1; device->drvcaps.dwMaxHwMixingStaticBuffers = 1;
device->drvcaps.dwMaxHwMixingStreamingBuffers = 1; device->drvcaps.dwMaxHwMixingStreamingBuffers = 1;
device->drvcaps.dwFreeHwMixingAllBuffers = device->drvcaps.dwMaxHwMixingAllBuffers;
device->drvcaps.dwFreeHwMixingStaticBuffers = device->drvcaps.dwMaxHwMixingStaticBuffers;
device->drvcaps.dwFreeHwMixingStreamingBuffers = device->drvcaps.dwMaxHwMixingStreamingBuffers;
ZeroMemory(&device->volpan, sizeof(device->volpan)); ZeroMemory(&device->volpan, sizeof(device->volpan));
...@@ -975,10 +985,12 @@ HRESULT DirectSoundDevice_CreateSoundBuffer( ...@@ -975,10 +985,12 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
TRACE("(lpwfxFormat=%p)\n",dsbd->lpwfxFormat); TRACE("(lpwfxFormat=%p)\n",dsbd->lpwfxFormat);
} }
if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE && if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) &&
!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) { dsbd->dwFlags & DSBCAPS_LOCHARDWARE &&
TRACE("LOCHARDWARE is not supported, returning E_NOTIMPL\n"); device->drvcaps.dwFreeHwMixingAllBuffers == 0)
return E_NOTIMPL; {
WARN("ran out of emulated hardware buffers\n");
return DSERR_ALLOCATED;
} }
if (dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) { if (dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) {
...@@ -1062,9 +1074,11 @@ HRESULT DirectSoundDevice_CreateSoundBuffer( ...@@ -1062,9 +1074,11 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
} }
hres = IDirectSoundBufferImpl_Create(device, &dsb, dsbd); hres = IDirectSoundBufferImpl_Create(device, &dsb, dsbd);
if (dsb) if (dsb) {
*ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface; *ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
else if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE)
device->drvcaps.dwFreeHwMixingAllBuffers--;
} else
WARN("IDirectSoundBufferImpl_Create failed\n"); WARN("IDirectSoundBufferImpl_Create failed\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment