Commit ffb51208 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dsound: Use the same struct for the primary buffer object as for the secondary.

parent ee9c0279
......@@ -1557,12 +1557,12 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
if (device->hwbuf)
device->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE;
else device->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
hres = PrimaryBufferImpl_Create(device, &(device->primary), &(device->dsbd));
hres = primarybuffer_create(device, &(device->primary), &(device->dsbd));
if (device->primary) {
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(device->primary));
*ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary);
} else
WARN("PrimaryBufferImpl_Create failed\n");
WARN("primarybuffer_create() failed\n");
}
} else {
IDirectSoundBufferImpl * dsb;
......@@ -1664,7 +1664,7 @@ HRESULT DirectSoundDevice_DuplicateSoundBuffer(
}
/* make sure we have a secondary buffer */
if ((PrimaryBufferImpl *)psb == device->primary) {
if (psb == (IDirectSoundBuffer *)&device->primary->IDirectSoundBuffer8_iface) {
WARN("trying to duplicate primary buffer\n");
*ppdsb = NULL;
return DSERR_INVALIDCALL;
......
......@@ -57,7 +57,6 @@ typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
typedef struct DirectSoundDevice DirectSoundDevice;
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
......@@ -93,7 +92,7 @@ struct DirectSoundDevice
IDirectSoundBufferImpl** buffers;
RTL_RWLOCK buffer_list_lock;
CRITICAL_SECTION mixlock;
PrimaryBufferImpl* primary;
IDirectSoundBufferImpl *primary;
DSBUFFERDESC dsbd;
DWORD speaker_config;
LPBYTE tmp_buffer, mix_buffer;
......@@ -210,21 +209,6 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
void secondarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN;
/*****************************************************************************
* PrimaryBuffer implementation structure
*/
struct PrimaryBufferImpl
{
const IDirectSoundBufferVtbl *lpVtbl;
LONG ref;
DirectSoundDevice* device;
};
HRESULT PrimaryBufferImpl_Create(
DirectSoundDevice * device,
PrimaryBufferImpl **ppdsb,
LPCDSBUFFERDESC dsbd) DECLSPEC_HIDDEN;
/*****************************************************************************
* DirectSoundCaptureDevice implementation structure
*/
struct DirectSoundCaptureDevice
......@@ -350,6 +334,8 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device) DECLSPEC_HIDDEN;
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos) DECLSPEC_HIDDEN;
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN;
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) DECLSPEC_HIDDEN;
HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb,
const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN;
/* duplex.c */
......
......@@ -758,7 +758,7 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(
if ( IsEqualGUID(riid, &IID_IDirectSoundBuffer) ) {
if (!This->device->primary)
PrimaryBufferImpl_Create(This->device, &(This->device->primary), &(This->device->dsbd));
primarybuffer_create(This->device, &This->device->primary, &This->device->dsbd);
if (This->device->primary) {
*ppobj = This->device->primary;
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)*ppobj);
......
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