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)
if (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);
RtlDeleteResource(&This->lock);
......
......@@ -271,8 +271,15 @@ static HRESULT WINAPI IDirectSound8Impl_GetCaps(IDirectSound8 *iface, DSCAPS *ds
dscaps->dwMaxHwMixingStaticBuffers = This->device->drvcaps.dwMaxHwMixingStaticBuffers;
dscaps->dwMaxHwMixingStreamingBuffers = This->device->drvcaps.dwMaxHwMixingStreamingBuffers;
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->dwMaxHw3DStaticBuffers = This->device->drvcaps.dwMaxHw3DStaticBuffers;
dscaps->dwMaxHw3DStreamingBuffers = This->device->drvcaps.dwMaxHw3DStreamingBuffers;
......@@ -913,9 +920,12 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
device->drvcaps.dwPrimaryBuffers = 1;
device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN;
device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX;
device->drvcaps.dwMaxHwMixingAllBuffers = 1;
device->drvcaps.dwMaxHwMixingAllBuffers = 16;
device->drvcaps.dwMaxHwMixingStaticBuffers = 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));
......@@ -975,10 +985,12 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
TRACE("(lpwfxFormat=%p)\n",dsbd->lpwfxFormat);
}
if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE &&
!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) {
TRACE("LOCHARDWARE is not supported, returning E_NOTIMPL\n");
return E_NOTIMPL;
if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) &&
dsbd->dwFlags & DSBCAPS_LOCHARDWARE &&
device->drvcaps.dwFreeHwMixingAllBuffers == 0)
{
WARN("ran out of emulated hardware buffers\n");
return DSERR_ALLOCATED;
}
if (dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) {
......@@ -1062,9 +1074,11 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
}
hres = IDirectSoundBufferImpl_Create(device, &dsb, dsbd);
if (dsb)
if (dsb) {
*ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
else
if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE)
device->drvcaps.dwFreeHwMixingAllBuffers--;
} else
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