Michael Stefaniuc : dsound: Move the primary buffer description into the buffer object.
Alexandre Julliard
julliard at winehq.org
Wed Aug 31 13:19:20 CDT 2011
Module: wine
Branch: master
Commit: 3747fb74a17fb077a1bb82c9655b8e02b770417e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3747fb74a17fb077a1bb82c9655b8e02b770417e
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Aug 31 01:15:36 2011 +0200
dsound: Move the primary buffer description into the buffer object.
---
dlls/dsound/dsound.c | 20 ++++++++++----------
dlls/dsound/dsound_private.h | 1 -
dlls/dsound/primary.c | 15 +++++++--------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index 1c7b13f..cc27699 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -1552,16 +1552,16 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(device->primary));
*ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary);
} else {
- device->dsbd = *dsbd;
- device->dsbd.dwFlags &= ~(DSBCAPS_LOCHARDWARE | DSBCAPS_LOCSOFTWARE);
- if (device->hwbuf)
- device->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE;
- else device->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
- hres = primarybuffer_create(device, &(device->primary), &(device->dsbd));
- if (device->primary)
- *ppdsb = (IDirectSoundBuffer*)&device->primary->IDirectSoundBuffer8_iface;
- else
- WARN("primarybuffer_create() failed\n");
+ hres = primarybuffer_create(device, &device->primary, dsbd);
+ if (device->primary) {
+ *ppdsb = (IDirectSoundBuffer*)&device->primary->IDirectSoundBuffer8_iface;
+ device->primary->dsbd.dwFlags &= ~(DSBCAPS_LOCHARDWARE | DSBCAPS_LOCSOFTWARE);
+ if (device->hwbuf)
+ device->primary->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE;
+ else
+ device->primary->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
+ } else
+ WARN("primarybuffer_create() failed\n");
}
} else {
IDirectSoundBufferImpl * dsb;
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index 43a800f..ed13b71 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -93,7 +93,6 @@ struct DirectSoundDevice
RTL_RWLOCK buffer_list_lock;
CRITICAL_SECTION mixlock;
IDirectSoundBufferImpl *primary;
- DSBUFFERDESC dsbd;
DWORD speaker_config;
LPBYTE tmp_buffer, mix_buffer;
DWORD tmp_buffer_len, mix_buffer_len;
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 2e0a6a4..b3d1517 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -642,7 +642,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
HRESULT hres = DS_OK;
TRACE("(%p,%d)\n", iface, vol);
- if (!(device->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
+ if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL;
}
@@ -686,7 +686,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
DWORD ampfactors;
TRACE("(%p,%p)\n", iface, vol);
- if (!(device->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
+ if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL;
}
@@ -985,7 +985,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
HRESULT hres = DS_OK;
TRACE("(%p,%d)\n", iface, pan);
- if (!(device->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
+ if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL;
}
@@ -1032,7 +1032,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
DWORD ampfactors;
TRACE("(%p,%p)\n", iface, pan);
- if (!(device->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
+ if (!(This->dsbd.dwFlags & DSBCAPS_CTRLPAN)) {
WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL;
}
@@ -1102,7 +1102,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetFrequency(
return DSERR_INVALIDPARAM;
}
- if (!(device->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
+ if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
WARN("control unavailable\n");
return DSERR_CONTROLUNAVAIL;
}
@@ -1138,7 +1138,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetCaps(
return DSERR_INVALIDPARAM;
}
- caps->dwFlags = device->dsbd.dwFlags;
+ caps->dwFlags = This->dsbd.dwFlags;
caps->dwBufferBytes = device->buflen;
/* Windows reports these as zero */
@@ -1258,8 +1258,7 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl *
dsb->numIfaces = 1;
dsb->device = device;
dsb->IDirectSoundBuffer8_iface.lpVtbl = (IDirectSoundBuffer8Vtbl *)&dspbvt;
-
- device->dsbd = *dsbd;
+ dsb->dsbd = *dsbd;
TRACE("Created primary buffer at %p\n", dsb);
TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
More information about the wine-cvs
mailing list