Commit 3747fb74 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dsound: Move the primary buffer description into the buffer object.

parent c0565143
...@@ -1552,16 +1552,16 @@ HRESULT DirectSoundDevice_CreateSoundBuffer( ...@@ -1552,16 +1552,16 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(device->primary)); IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(device->primary));
*ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary); *ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary);
} else { } else {
device->dsbd = *dsbd; hres = primarybuffer_create(device, &device->primary, dsbd);
device->dsbd.dwFlags &= ~(DSBCAPS_LOCHARDWARE | DSBCAPS_LOCSOFTWARE); if (device->primary) {
if (device->hwbuf) *ppdsb = (IDirectSoundBuffer*)&device->primary->IDirectSoundBuffer8_iface;
device->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE; device->primary->dsbd.dwFlags &= ~(DSBCAPS_LOCHARDWARE | DSBCAPS_LOCSOFTWARE);
else device->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE; if (device->hwbuf)
hres = primarybuffer_create(device, &(device->primary), &(device->dsbd)); device->primary->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE;
if (device->primary) else
*ppdsb = (IDirectSoundBuffer*)&device->primary->IDirectSoundBuffer8_iface; device->primary->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
else } else
WARN("primarybuffer_create() failed\n"); WARN("primarybuffer_create() failed\n");
} }
} else { } else {
IDirectSoundBufferImpl * dsb; IDirectSoundBufferImpl * dsb;
......
...@@ -93,7 +93,6 @@ struct DirectSoundDevice ...@@ -93,7 +93,6 @@ struct DirectSoundDevice
RTL_RWLOCK buffer_list_lock; RTL_RWLOCK buffer_list_lock;
CRITICAL_SECTION mixlock; CRITICAL_SECTION mixlock;
IDirectSoundBufferImpl *primary; IDirectSoundBufferImpl *primary;
DSBUFFERDESC dsbd;
DWORD speaker_config; DWORD speaker_config;
LPBYTE tmp_buffer, mix_buffer; LPBYTE tmp_buffer, mix_buffer;
DWORD tmp_buffer_len, mix_buffer_len; DWORD tmp_buffer_len, mix_buffer_len;
......
...@@ -642,7 +642,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume( ...@@ -642,7 +642,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
HRESULT hres = DS_OK; HRESULT hres = DS_OK;
TRACE("(%p,%d)\n", iface, vol); TRACE("(%p,%d)\n", iface, vol);
if (!(device->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) { if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
WARN("control unavailable\n"); WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL; return DSERR_CONTROLUNAVAIL;
} }
...@@ -686,7 +686,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume( ...@@ -686,7 +686,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
DWORD ampfactors; DWORD ampfactors;
TRACE("(%p,%p)\n", iface, vol); TRACE("(%p,%p)\n", iface, vol);
if (!(device->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) { if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
WARN("control unavailable\n"); WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL; return DSERR_CONTROLUNAVAIL;
} }
...@@ -985,7 +985,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan( ...@@ -985,7 +985,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
HRESULT hres = DS_OK; HRESULT hres = DS_OK;
TRACE("(%p,%d)\n", iface, pan); TRACE("(%p,%d)\n", iface, pan);
if (!(device->dsbd.dwFlags & DSBCAPS_CTRLPAN)) { if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
WARN("control unavailable\n"); WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL; return DSERR_CONTROLUNAVAIL;
} }
...@@ -1032,7 +1032,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan( ...@@ -1032,7 +1032,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
DWORD ampfactors; DWORD ampfactors;
TRACE("(%p,%p)\n", iface, pan); TRACE("(%p,%p)\n", iface, pan);
if (!(device->dsbd.dwFlags & DSBCAPS_CTRLPAN)) { if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
WARN("control unavailable\n"); WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL; return DSERR_CONTROLUNAVAIL;
} }
...@@ -1102,7 +1102,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetFrequency( ...@@ -1102,7 +1102,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetFrequency(
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
if (!(device->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) { if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
WARN("control unavailable\n"); WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL; return DSERR_CONTROLUNAVAIL;
} }
...@@ -1138,7 +1138,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetCaps( ...@@ -1138,7 +1138,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetCaps(
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
caps->dwFlags = device->dsbd.dwFlags; caps->dwFlags = This->dsbd.dwFlags;
caps->dwBufferBytes = device->buflen; caps->dwBufferBytes = device->buflen;
/* Windows reports these as zero */ /* Windows reports these as zero */
...@@ -1258,8 +1258,7 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl * ...@@ -1258,8 +1258,7 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl *
dsb->numIfaces = 1; dsb->numIfaces = 1;
dsb->device = device; dsb->device = device;
dsb->IDirectSoundBuffer8_iface.lpVtbl = (IDirectSoundBuffer8Vtbl *)&dspbvt; dsb->IDirectSoundBuffer8_iface.lpVtbl = (IDirectSoundBuffer8Vtbl *)&dspbvt;
dsb->dsbd = *dsbd;
device->dsbd = *dsbd;
TRACE("Created primary buffer at %p\n", dsb); TRACE("Created primary buffer at %p\n", dsb);
TRACE("(formattag=0x%04x,chans=%d,samplerate=%d," TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
......
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