dsound: Remove hardware acceleration support.

oldstable
Andrew Eikum 2011-09-24 09:02:52 -05:00 committed by Alexandre Julliard
parent a773b16d79
commit b1fdaa81b0
16 changed files with 415 additions and 1443 deletions

View File

@ -31,7 +31,6 @@
#include "vfwmsgs.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
#include "dsconf.h"
@ -108,13 +107,7 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
notify[i].dwOffset,notify[i].hEventNotify);
}
if (This->dsb->hwnotify) {
HRESULT hres;
hres = IDsDriverNotify_SetNotificationPositions(This->dsb->hwnotify, howmuch, notify);
if (hres != DS_OK)
WARN("IDsDriverNotify_SetNotificationPositions failed\n");
return hres;
} else if (howmuch > 0) {
if (howmuch > 0) {
/* Make an internal copy of the caller-supplied array.
* Replace the existing copy if one is already present. */
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
@ -127,11 +120,11 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
}
CopyMemory(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
This->dsb->nrofnotifies = howmuch;
} else {
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
This->dsb->notifies = NULL;
This->dsb->nrofnotifies = 0;
}
} else {
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
This->dsb->notifies = NULL;
This->dsb->nrofnotifies = 0;
}
return S_OK;
}
@ -242,14 +235,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(IDirectSoundBuffer8 *ifac
DSOUND_RecalcVolPan(&(This->volpan));
}
if (vol != oldVol) {
if (This->hwbuf) {
hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan));
if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n");
}
}
RtlReleaseResource(&This->lock);
/* **** */
@ -332,18 +317,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Play(IDirectSoundBuffer8 *iface, DW
RtlAcquireResourceExclusive(&This->lock, TRUE);
This->playflags = flags;
if (This->state == STATE_STOPPED && !This->hwbuf) {
if (This->state == STATE_STOPPED) {
This->leadin = TRUE;
This->state = STATE_STARTING;
} else if (This->state == STATE_STOPPING)
This->state = STATE_PLAYING;
if (This->hwbuf) {
hres = IDsDriverBuffer_Play(This->hwbuf, 0, 0, This->playflags);
if (hres != DS_OK)
WARN("IDsDriverBuffer_Play failed\n");
else
This->state = STATE_PLAYING;
}
RtlReleaseResource(&This->lock);
/* **** */
@ -368,13 +346,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface)
This->state = STATE_STOPPED;
DSOUND_CheckEvent(This, 0, 0);
}
if (This->hwbuf) {
hres = IDsDriverBuffer_Stop(This->hwbuf);
if (hres != DS_OK)
WARN("IDsDriverBuffer_Stop failed\n");
else
This->state = STATE_STOPPED;
}
RtlReleaseResource(&This->lock);
/* **** */
@ -415,36 +386,31 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(IDirectSoundBuff
DWORD *playpos, DWORD *writepos)
{
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
HRESULT hres;
DWORD pos;
TRACE("(%p,%p,%p)\n",This,playpos,writepos);
RtlAcquireResourceShared(&This->lock, TRUE);
if (This->hwbuf) {
hres=IDsDriverBuffer_GetPosition(This->hwbuf,playpos,writepos);
if (hres != DS_OK) {
WARN("IDsDriverBuffer_GetPosition failed\n");
return hres;
}
} else {
DWORD pos = This->sec_mixpos;
/* sanity */
if (pos >= This->buflen){
FIXME("Bad play position. playpos: %d, buflen: %d\n", pos, This->buflen);
pos %= This->buflen;
}
pos = This->sec_mixpos;
if (playpos)
*playpos = pos;
if (writepos)
*writepos = pos;
/* sanity */
if (pos >= This->buflen){
FIXME("Bad play position. playpos: %d, buflen: %d\n", pos, This->buflen);
pos %= This->buflen;
}
if (writepos && This->state != STATE_STOPPED && (!This->hwbuf || !(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDWRITELEAD))) {
if (playpos)
*playpos = pos;
if (writepos)
*writepos = pos;
if (writepos && This->state != STATE_STOPPED) {
/* apply the documented 10ms lead to writepos */
*writepos += This->writelead;
*writepos %= This->buflen;
}
RtlReleaseResource(&This->lock);
TRACE("playpos = %d, writepos = %d, buflen=%d (%p, time=%d)\n",
@ -554,44 +520,31 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(IDirectSoundBuffer8 *iface, DW
/* **** */
RtlAcquireResourceShared(&This->lock, TRUE);
if (!(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) {
hres = IDsDriverBuffer_Lock(This->hwbuf,
lplpaudioptr1, audiobytes1,
lplpaudioptr2, audiobytes2,
writecursor, writebytes,
0);
if (hres != DS_OK) {
WARN("IDsDriverBuffer_Lock failed\n");
RtlReleaseResource(&This->lock);
return hres;
}
if (writecursor+writebytes <= This->buflen) {
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 1\n");
*audiobytes1 = writebytes;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = NULL;
if (audiobytes2)
*audiobytes2 = 0;
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n",
*(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
TRACE("->%d.0\n",writebytes);
} else {
if (writecursor+writebytes <= This->buflen) {
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 1\n");
*audiobytes1 = writebytes;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = NULL;
if (audiobytes2)
*audiobytes2 = 0;
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n",
*(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
TRACE("->%d.0\n",writebytes);
} else {
DWORD remainder = writebytes + writecursor - This->buflen;
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
*audiobytes1 = This->buflen-writecursor;
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 2\n");
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = This->buffer->memory;
if (audiobytes2)
*audiobytes2 = writebytes-(This->buflen-writecursor);
if (audiobytes2 && This->sec_mixpos < remainder && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 3\n");
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n", *(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
}
DWORD remainder = writebytes + writecursor - This->buflen;
*(LPBYTE*)lplpaudioptr1 = This->buffer->memory+writecursor;
*audiobytes1 = This->buflen-writecursor;
if (This->sec_mixpos >= writecursor && This->sec_mixpos < writecursor + writebytes && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 2\n");
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = This->buffer->memory;
if (audiobytes2)
*audiobytes2 = writebytes-(This->buflen-writecursor);
if (audiobytes2 && This->sec_mixpos < remainder && This->state == STATE_PLAYING)
WARN("Overwriting mixing position, case 3\n");
TRACE("Locked %p(%i bytes) and %p(%i bytes) writecursor=%d\n", *(LPBYTE*)lplpaudioptr1, *audiobytes1, lplpaudioptr2 ? *(LPBYTE*)lplpaudioptr2 : NULL, audiobytes2 ? *audiobytes2: 0, writecursor);
}
RtlReleaseResource(&This->lock);
@ -623,12 +576,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuff
or anything like that to reduce latency. The data already prebuffered cannot be changed */
/* position HW buffer if applicable, else just start mixing from new location instead */
if (This->hwbuf) {
hres = IDsDriverBuffer_SetPosition(This->hwbuf, This->buf_mixpos);
if (hres != DS_OK)
WARN("IDsDriverBuffer_SetPosition failed\n");
}
else if (oldpos != newpos)
if (oldpos != newpos)
/* FIXME: Perhaps add a call to DSOUND_MixToTemporary here? Not sure it's needed */
This->buf_mixpos = DSOUND_secpos_to_bufpos(This, newpos, 0, NULL);
@ -663,12 +611,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetPan(IDirectSoundBuffer8 *iface,
if (This->volpan.lPan != pan) {
This->volpan.lPan = pan;
DSOUND_RecalcVolPan(&(This->volpan));
if (This->hwbuf) {
hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan));
if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n");
}
}
RtlReleaseResource(&This->lock);
@ -706,22 +648,10 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(IDirectSoundBuffer8 *iface,
TRACE("(%p,%p,%d,%p,%d)\n", This,p1,x1,p2,x2);
/* **** */
RtlAcquireResourceShared(&This->lock, TRUE);
if (!(This->device->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) {
hres = IDsDriverBuffer_Unlock(This->hwbuf, p1, x1, p2, x2);
if (hres != DS_OK)
WARN("IDsDriverBuffer_Unlock failed\n");
}
RtlReleaseResource(&This->lock);
/* **** */
if (!p2)
x2 = 0;
if (!This->hwbuf && (x1 || x2))
if (x1 || x2)
{
RtlAcquireResourceShared(&This->device->buffer_list_lock, TRUE);
LIST_FOR_EACH_ENTRY(iter, &This->buffer->buffers, IDirectSoundBufferImpl, entry )
@ -836,8 +766,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetCaps(IDirectSoundBuffer8 *iface,
}
caps->dwFlags = This->dsbd.dwFlags;
if (This->hwbuf) caps->dwFlags |= DSBCAPS_LOCHARDWARE;
else caps->dwFlags |= DSBCAPS_LOCSOFTWARE;
caps->dwFlags |= DSBCAPS_LOCSOFTWARE;
caps->dwBufferBytes = This->buflen;
@ -953,7 +882,6 @@ HRESULT IDirectSoundBufferImpl_Create(
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
HRESULT err = DS_OK;
DWORD capf = 0;
int use_hw;
TRACE("(%p,%p,%p)\n",device,pdsb,dsbd);
if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
@ -972,10 +900,10 @@ HRESULT IDirectSoundBufferImpl_Create(
TRACE("Created buffer at %p\n", dsb);
dsb->ref = 1;
dsb->numIfaces = 1;
dsb->ref = 1;
dsb->numIfaces = 1;
dsb->device = device;
dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
dsb->iks = NULL;
/* size depends on version */
@ -999,7 +927,6 @@ HRESULT IDirectSoundBufferImpl_Create(
dsb->notify = NULL;
dsb->notifies = NULL;
dsb->nrofnotifies = 0;
dsb->hwnotify = 0;
/* Check necessary hardware mixing capabilities */
if (wfex->nChannels==2) capf |= DSCAPS_SECONDARYSTEREO;
@ -1007,24 +934,7 @@ HRESULT IDirectSoundBufferImpl_Create(
if (wfex->wBitsPerSample==16) capf |= DSCAPS_SECONDARY16BIT;
else capf |= DSCAPS_SECONDARY8BIT;
use_hw = !!(dsbd->dwFlags & DSBCAPS_LOCHARDWARE);
TRACE("use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", use_hw, capf, device->drvcaps.dwFlags);
if (use_hw && ((device->drvcaps.dwFlags & capf) != capf || !device->driver))
{
if (device->driver)
WARN("Format not supported for hardware buffer\n");
HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb);
*pdsb = NULL;
if ((device->drvcaps.dwFlags & capf) != capf)
return DSERR_BADFORMAT;
return DSERR_GENERIC;
}
/* FIXME: check hardware sample rate mixing capabilities */
/* FIXME: check app hints for software/hardware buffer (STATIC, LOCHARDWARE, etc) */
/* FIXME: check whether any hardware buffers are left */
/* FIXME: handle DSDHEAP_CREATEHEAP for hardware buffers */
TRACE("capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", capf, device->drvcaps.dwFlags);
/* Allocate an empty buffer */
dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
@ -1036,35 +946,15 @@ HRESULT IDirectSoundBufferImpl_Create(
return DSERR_OUTOFMEMORY;
}
/* Allocate system memory for buffer if applicable */
if ((device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) || !use_hw) {
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
if (dsb->buffer->memory == NULL) {
WARN("out of memory\n");
HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb->buffer);
HeapFree(GetProcessHeap(),0,dsb);
*pdsb = NULL;
return DSERR_OUTOFMEMORY;
}
}
/* Allocate the hardware buffer */
if (use_hw) {
err = IDsDriver_CreateSoundBuffer(device->driver,wfex,dsbd->dwFlags,0,
&(dsb->buflen),&(dsb->buffer->memory),
(LPVOID*)&(dsb->hwbuf));
if (FAILED(err))
{
WARN("Failed to create hardware secondary buffer: %08x\n", err);
if (device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)
HeapFree(GetProcessHeap(),0,dsb->buffer->memory);
HeapFree(GetProcessHeap(),0,dsb->buffer);
HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb);
*pdsb = NULL;
return DSERR_GENERIC;
}
/* Allocate system memory for buffer */
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
if (dsb->buffer->memory == NULL) {
WARN("out of memory\n");
HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb->buffer);
HeapFree(GetProcessHeap(),0,dsb);
*pdsb = NULL;
return DSERR_OUTOFMEMORY;
}
dsb->buffer->ref = 1;
@ -1131,15 +1021,11 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
DirectSoundDevice_RemoveBuffer(This->device, This);
RtlDeleteResource(&This->lock);
if (This->hwbuf)
IDsDriverBuffer_Release(This->hwbuf);
if (!This->hwbuf || (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)) {
This->buffer->ref--;
list_remove(&This->entry);
if (This->buffer->ref == 0) {
HeapFree(GetProcessHeap(), 0, This->buffer->memory);
HeapFree(GetProcessHeap(), 0, This->buffer);
}
This->buffer->ref--;
list_remove(&This->entry);
if (This->buffer->ref == 0) {
HeapFree(GetProcessHeap(), 0, This->buffer->memory);
HeapFree(GetProcessHeap(), 0, This->buffer);
}
HeapFree(GetProcessHeap(), 0, This->tmp_buffer);
@ -1206,20 +1092,6 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
return DSERR_OUTOFMEMORY;
}
if (pdsb->hwbuf) {
TRACE("duplicating hardware buffer\n");
hres = IDsDriver_DuplicateSoundBuffer(device->driver, pdsb->hwbuf,
(LPVOID *)&dsb->hwbuf);
if (FAILED(hres)) {
WARN("IDsDriver_DuplicateSoundBuffer failed (%08x)\n", hres);
HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb);
*ppdsb = NULL;
return hres;
}
}
dsb->buffer->ref++;
list_add_head(&dsb->buffer->buffers, &dsb->entry);
dsb->ref = 1;
@ -1304,31 +1176,10 @@ static HRESULT WINAPI IKsBufferPropertySetImpl_Get(
PULONG pcbReturned )
{
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
PIDSDRIVERPROPERTYSET ps;
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%d,pInstanceData=%p,cbInstanceData=%d,pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
if (This->dsb->hwbuf) {
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
if (ps) {
DSPROPERTY prop;
HRESULT hres;
prop.s.Set = *guidPropSet;
prop.s.Id = dwPropID;
prop.s.Flags = 0; /* unused */
prop.s.InstanceId = (ULONG)This->dsb->device;
hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
IDsDriverPropertySet_Release(ps);
return hres;
}
}
return E_PROP_ID_UNSUPPORTED;
}
@ -1342,28 +1193,9 @@ static HRESULT WINAPI IKsBufferPropertySetImpl_Set(
ULONG cbPropData )
{
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
PIDSDRIVERPROPERTYSET ps;
TRACE("(%p,%s,%d,%p,%d,%p,%d)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
if (This->dsb->hwbuf) {
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
if (ps) {
DSPROPERTY prop;
HRESULT hres;
prop.s.Set = *guidPropSet;
prop.s.Id = dwPropID;
prop.s.Flags = 0; /* unused */
prop.s.InstanceId = (ULONG)This->dsb->device;
hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData);
IDsDriverPropertySet_Release(ps);
return hres;
}
}
return E_PROP_ID_UNSUPPORTED;
}
@ -1374,23 +1206,9 @@ static HRESULT WINAPI IKsBufferPropertySetImpl_QuerySupport(
PULONG pTypeSupport )
{
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
PIDSDRIVERPROPERTYSET ps;
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
if (This->dsb->hwbuf) {
IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps);
if (ps) {
HRESULT hres;
hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport);
IDsDriverPropertySet_Release(ps);
return hres;
}
}
return E_PROP_ID_UNSUPPORTED;
}

View File

@ -38,7 +38,6 @@
#include "winnls.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
@ -89,8 +88,6 @@ static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY if
TRACE("(%p) ref was %d\n", This, ref + 1);
if (!ref) {
if (This->dscb->hwnotify)
IDsDriverNotify_Release(This->dscb->hwnotify);
This->dscb->notify=NULL;
IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb);
HeapFree(GetProcessHeap(),0,This);
@ -119,13 +116,7 @@ static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(
notify[i].dwOffset,notify[i].hEventNotify);
}
if (This->dscb->hwnotify) {
HRESULT hres;
hres = IDsDriverNotify_SetNotificationPositions(This->dscb->hwnotify, howmuch, notify);
if (hres != DS_OK)
WARN("IDsDriverNotify_SetNotificationPositions failed\n");
return hres;
} else if (howmuch > 0) {
if (howmuch > 0) {
/* Make an internal copy of the caller-supplied array.
* Replace the existing copy if one is already present. */
if (This->dscb->notifies)
@ -202,6 +193,7 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
{
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
HRESULT hres;
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
if (ppobj == NULL) {
@ -212,27 +204,15 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
if (!This->notify)
if (!This->notify){
hres = IDirectSoundCaptureNotifyImpl_Create(This, &This->notify);
if (This->notify) {
IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify);
if (This->device->hwbuf && !This->hwnotify) {
hres = IDsCaptureDriverBuffer_QueryInterface(This->device->hwbuf,
&IID_IDsDriverNotify, (LPVOID*)&(This->hwnotify));
if (hres != DS_OK) {
WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
*ppobj = 0;
return hres;
}
}
*ppobj = This->notify;
return DS_OK;
if(FAILED(hres))
return hres;
}
WARN("IID_IDirectSoundNotify\n");
return E_FAIL;
IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify);
*ppobj = This->notify;
return DS_OK;
}
if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
@ -277,21 +257,12 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
This->device->hwi = 0;
}
if (This->device->hwbuf)
IDsCaptureDriverBuffer_Release(This->device->hwbuf);
/* remove from DirectSoundCaptureDevice */
This->device->capture_buffer = NULL;
if (This->notify)
IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
/* If driver manages its own buffer, IDsCaptureDriverBuffer_Release
should have freed the buffer. Prevent freeing it again in
IDirectSoundCaptureBufferImpl_Create */
if (!(This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY))
This->device->buffer = NULL;
HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree( GetProcessHeap(), 0, This );
TRACE("(%p) released\n", This);
@ -346,11 +317,7 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
return DSERR_INVALIDPARAM;
}
if (This->device->driver) {
hres = IDsCaptureDriverBuffer_GetPosition(This->device->hwbuf, lpdwCapturePosition, lpdwReadPosition );
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
} else if (This->device->hwi) {
if (This->device->hwi) {
DWORD pos;
EnterCriticalSection(&This->device->lock);
@ -493,14 +460,7 @@ IDirectSoundCaptureBufferImpl_Lock(
EnterCriticalSection(&(This->device->lock));
if (This->device->driver) {
hres = IDsCaptureDriverBuffer_Lock(This->device->hwbuf, lplpvAudioPtr1,
lpdwAudioBytes1, lplpvAudioPtr2,
lpdwAudioBytes2, dwReadCusor,
dwReadBytes, dwFlags);
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_Lock failed\n");
} else if (This->device->hwi) {
if (This->device->hwi) {
*lplpvAudioPtr1 = This->device->buffer + dwReadCusor;
if ( (dwReadCusor + dwReadBytes) > This->device->buflen) {
*lpdwAudioBytes1 = This->device->buflen - dwReadCusor;
@ -540,7 +500,7 @@ IDirectSoundCaptureBufferImpl_Start(
return DSERR_INVALIDPARAM;
}
if ( (This->device->driver == 0) && (This->device->hwi == 0) ) {
if ( This->device->hwi == 0 ) {
WARN("no driver\n");
return DSERR_NODRIVER;
}
@ -557,11 +517,7 @@ IDirectSoundCaptureBufferImpl_Start(
LeaveCriticalSection(&(This->device->lock));
if (This->device->driver) {
hres = IDsCaptureDriverBuffer_Start(This->device->hwbuf, dwFlags);
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_Start failed\n");
} else if (This->device->hwi) {
if (This->device->hwi) {
DirectSoundCaptureDevice *device = This->device;
if (device->buffer) {
@ -652,11 +608,7 @@ IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
LeaveCriticalSection(&(This->device->lock));
if (This->device->driver) {
hres = IDsCaptureDriverBuffer_Stop(This->device->hwbuf);
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_Stop() failed\n");
} else if (This->device->hwi) {
if (This->device->hwi) {
hres = mmErr(waveInReset(This->device->hwi));
if (hres != DS_OK)
WARN("waveInReset() failed\n");
@ -687,12 +639,7 @@ IDirectSoundCaptureBufferImpl_Unlock(
return DSERR_INVALIDPARAM;
}
if (This->device->driver) {
hres = IDsCaptureDriverBuffer_Unlock(This->device->hwbuf, lpvAudioPtr1,
dwAudioBytes1, lpvAudioPtr2, dwAudioBytes2);
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_Unlock failed\n");
} else if (!This->device->hwi) {
if (!This->device->hwi) {
WARN("invalid call\n");
hres = DSERR_INVALIDCALL;
}
@ -877,7 +824,7 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
*ppobj = NULL;
return DSERR_OUTOFMEMORY;
} else {
HRESULT err = DS_OK;
HRESULT err = DS_OK;
LPBYTE newbuf;
DWORD buflen;
IDirectSoundCaptureBufferImpl *This = *ppobj;
@ -885,9 +832,8 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
This->ref = 1;
This->device = device;
This->device->capture_buffer = This;
This->notify = NULL;
This->nrofnotifies = 0;
This->hwnotify = NULL;
This->notify = NULL;
This->nrofnotifies = 0;
This->pdscbd = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
lpcDSCBufferDesc->dwSize);
@ -903,72 +849,32 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
This->lpVtbl = &dscbvt;
if (device->driver) {
if (This->device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
err = mmErr(waveInOpen(&(device->hwi),
device->drvdesc.dnDevNode, device->pwfx,
(DWORD_PTR)DSOUND_capture_callback, (DWORD_PTR)device,
CALLBACK_FUNCTION | WAVE_MAPPED));
if (err != DS_OK) {
WARN("waveInOpen failed\n");
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
*ppobj = NULL;
return err;
}
if (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
/* allocate buffer from system memory */
buflen = lpcDSCBufferDesc->dwBufferBytes;
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
if (newbuf == NULL) {
WARN("failed to allocate capture buffer\n");
err = DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */
} else {
device->buffer = newbuf;
device->buflen = buflen;
}
} else {
/* let driver allocate memory */
device->buflen = lpcDSCBufferDesc->dwBufferBytes;
/* FIXME: */
HeapFree( GetProcessHeap(), 0, device->buffer);
device->buffer = NULL;
}
err = IDsCaptureDriver_CreateCaptureBuffer(device->driver,
device->pwfx,0,0,&(device->buflen),&(device->buffer),(LPVOID*)&(device->hwbuf));
if (err != DS_OK) {
WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
*ppobj = NULL;
return err;
}
} else {
DWORD flags = CALLBACK_FUNCTION | WAVE_MAPPED;
err = mmErr(waveInOpen(&(device->hwi),
device->drvdesc.dnDevNode, device->pwfx,
(DWORD_PTR)DSOUND_capture_callback, (DWORD_PTR)device, flags));
if (err != DS_OK) {
WARN("waveInOpen failed\n");
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
*ppobj = NULL;
return err;
}
buflen = lpcDSCBufferDesc->dwBufferBytes;
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
if (newbuf == NULL) {
WARN("failed to allocate capture buffer\n");
err = DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */
} else {
device->buffer = newbuf;
device->buflen = buflen;
}
}
buflen = lpcDSCBufferDesc->dwBufferBytes;
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
if (newbuf == NULL) {
WARN("failed to allocate capture buffer\n");
err = DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */
} else {
device->buffer = newbuf;
device->buflen = buflen;
}
}
TRACE("returning DS_OK\n");
@ -1018,11 +924,6 @@ static ULONG DirectSoundCaptureDevice_Release(
IDirectSoundCaptureBufferImpl_Release(
(LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
if (device->driver) {
IDsCaptureDriver_Close(device->driver);
IDsCaptureDriver_Release(device->driver);
}
HeapFree(GetProcessHeap(), 0, device->pwfx);
device->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &(device->lock) );
@ -1042,6 +943,8 @@ static HRESULT DirectSoundCaptureDevice_Initialize(
BOOLEAN found = FALSE;
GUID devGUID;
DirectSoundCaptureDevice *device = *ppDevice;
WAVEINCAPSA wic;
TRACE("(%p, %s)\n", ppDevice, debugstr_guid(lpcGUID));
/* Default device? */
@ -1086,64 +989,22 @@ static HRESULT DirectSoundCaptureDevice_Initialize(
*ppDevice = device;
device->guid = devGUID;
/* Disable the direct sound driver to force emulation if requested. */
device->driver = NULL;
if (ds_hw_accel != DS_HW_ACCEL_EMULATION)
{
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&device->driver,0));
if ( (err != DS_OK) && (err != DSERR_UNSUPPORTED) ) {
WARN("waveInMessage failed; err=%x\n",err);
return err;
}
}
err = DS_OK;
/* Get driver description */
if (device->driver) {
TRACE("using DirectSound driver\n");
err = IDsCaptureDriver_GetDriverDesc(device->driver, &(device->drvdesc));
if (err != DS_OK) {
WARN("IDsCaptureDriver_GetDriverDesc failed\n");
return err;
}
} else {
TRACE("using WINMM\n");
/* if no DirectSound interface available, use WINMM API instead */
device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN |
DSDDESC_DOMMSYSTEMSETFORMAT;
}
device->drvdesc.dwFlags = 0;
device->drvdesc.dnDevNode = wid;
/* open the DirectSound driver if available */
if (device->driver && (err == DS_OK))
err = IDsCaptureDriver_Open(device->driver);
*ppDevice = device;
err = mmErr(waveInGetDevCapsA((UINT)device->drvdesc.dnDevNode, &wic, sizeof(wic)));
if (err == DS_OK) {
*ppDevice = device;
device->drvcaps.dwFlags = 0;
lstrcpynA(device->drvdesc.szDrvname, wic.szPname,
sizeof(device->drvdesc.szDrvname));
/* the driver is now open, so it's now allowed to call GetCaps */
if (device->driver) {
device->drvcaps.dwSize = sizeof(device->drvcaps);
err = IDsCaptureDriver_GetCaps(device->driver,&(device->drvcaps));
if (err != DS_OK) {
WARN("IDsCaptureDriver_GetCaps failed\n");
return err;
}
} else /*if (device->hwi)*/ {
WAVEINCAPSA wic;
err = mmErr(waveInGetDevCapsA((UINT)device->drvdesc.dnDevNode, &wic, sizeof(wic)));
if (err == DS_OK) {
device->drvcaps.dwFlags = 0;
lstrcpynA(device->drvdesc.szDrvname, wic.szPname,
sizeof(device->drvdesc.szDrvname));
device->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER;
device->drvcaps.dwFormats = wic.dwFormats;
device->drvcaps.dwChannels = wic.wChannels;
}
}
device->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER;
device->drvcaps.dwFormats = wic.dwFormats;
device->drvcaps.dwChannels = wic.wChannels;
}
return err;

View File

@ -37,7 +37,6 @@
#include "ksmedia.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
@ -1265,21 +1264,13 @@ ULONG DirectSoundDevice_Release(DirectSoundDevice * device)
if (hr != DS_OK)
WARN("DSOUND_PrimaryDestroy failed\n");
if (device->driver)
IDsDriver_Close(device->driver);
if (device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
waveOutClose(device->hwo);
if (device->driver)
IDsDriver_Release(device->driver);
waveOutClose(device->hwo);
DSOUND_renderer[device->drvdesc.dnDevNode] = NULL;
HeapFree(GetProcessHeap(), 0, device->tmp_buffer);
HeapFree(GetProcessHeap(), 0, device->mix_buffer);
if (device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)
HeapFree(GetProcessHeap(), 0, device->buffer);
HeapFree(GetProcessHeap(), 0, device->buffer);
RtlDeleteResource(&device->buffer_list_lock);
device->mixlock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&device->mixlock);
@ -1350,6 +1341,8 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
BOOLEAN found = FALSE;
GUID devGUID;
DirectSoundDevice * device = *ppDevice;
WAVEOUTCAPSA woc;
TRACE("(%p,%s)\n",ppDevice,debugstr_guid(lpcGUID));
if (*ppDevice != NULL) {
@ -1406,7 +1399,6 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
*ppDevice = device;
device->guid = devGUID;
device->driver = NULL;
device->drvdesc.dnDevNode = wod;
hr = DSOUND_ReopenDevice(device, FALSE);
@ -1416,59 +1408,50 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
return hr;
}
if (device->driver) {
/* the driver is now open, so it's now allowed to call GetCaps */
hr = IDsDriver_GetCaps(device->driver,&(device->drvcaps));
if (hr != DS_OK) {
WARN("IDsDriver_GetCaps failed\n");
return hr;
}
} else {
WAVEOUTCAPSA woc;
hr = mmErr(waveOutGetDevCapsA(device->drvdesc.dnDevNode, &woc, sizeof(woc)));
if (hr != DS_OK) {
WARN("waveOutGetDevCaps failed\n");
return hr;
}
ZeroMemory(&device->drvcaps, sizeof(device->drvcaps));
if ((woc.dwFormats & WAVE_FORMAT_1M08) ||
(woc.dwFormats & WAVE_FORMAT_2M08) ||
(woc.dwFormats & WAVE_FORMAT_4M08) ||
(woc.dwFormats & WAVE_FORMAT_48M08) ||
(woc.dwFormats & WAVE_FORMAT_96M08)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
}
if ((woc.dwFormats & WAVE_FORMAT_1M16) ||
(woc.dwFormats & WAVE_FORMAT_2M16) ||
(woc.dwFormats & WAVE_FORMAT_4M16) ||
(woc.dwFormats & WAVE_FORMAT_48M16) ||
(woc.dwFormats & WAVE_FORMAT_96M16)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
}
if ((woc.dwFormats & WAVE_FORMAT_1S08) ||
(woc.dwFormats & WAVE_FORMAT_2S08) ||
(woc.dwFormats & WAVE_FORMAT_4S08) ||
(woc.dwFormats & WAVE_FORMAT_48S08) ||
(woc.dwFormats & WAVE_FORMAT_96S08)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
}
if ((woc.dwFormats & WAVE_FORMAT_1S16) ||
(woc.dwFormats & WAVE_FORMAT_2S16) ||
(woc.dwFormats & WAVE_FORMAT_4S16) ||
(woc.dwFormats & WAVE_FORMAT_48S16) ||
(woc.dwFormats & WAVE_FORMAT_96S16)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
}
if (ds_emuldriver)
device->drvcaps.dwFlags |= DSCAPS_EMULDRIVER;
device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN;
device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX;
ZeroMemory(&device->volpan, sizeof(device->volpan));
hr = mmErr(waveOutGetDevCapsA(device->drvdesc.dnDevNode, &woc, sizeof(woc)));
if (hr != DS_OK) {
WARN("waveOutGetDevCaps failed\n");
return hr;
}
ZeroMemory(&device->drvcaps, sizeof(device->drvcaps));
if ((woc.dwFormats & WAVE_FORMAT_1M08) ||
(woc.dwFormats & WAVE_FORMAT_2M08) ||
(woc.dwFormats & WAVE_FORMAT_4M08) ||
(woc.dwFormats & WAVE_FORMAT_48M08) ||
(woc.dwFormats & WAVE_FORMAT_96M08)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
}
if ((woc.dwFormats & WAVE_FORMAT_1M16) ||
(woc.dwFormats & WAVE_FORMAT_2M16) ||
(woc.dwFormats & WAVE_FORMAT_4M16) ||
(woc.dwFormats & WAVE_FORMAT_48M16) ||
(woc.dwFormats & WAVE_FORMAT_96M16)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
}
if ((woc.dwFormats & WAVE_FORMAT_1S08) ||
(woc.dwFormats & WAVE_FORMAT_2S08) ||
(woc.dwFormats & WAVE_FORMAT_4S08) ||
(woc.dwFormats & WAVE_FORMAT_48S08) ||
(woc.dwFormats & WAVE_FORMAT_96S08)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
}
if ((woc.dwFormats & WAVE_FORMAT_1S16) ||
(woc.dwFormats & WAVE_FORMAT_2S16) ||
(woc.dwFormats & WAVE_FORMAT_4S16) ||
(woc.dwFormats & WAVE_FORMAT_48S16) ||
(woc.dwFormats & WAVE_FORMAT_96S16)) {
device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
}
if(ds_emuldriver)
device->drvcaps.dwFlags |= DSCAPS_EMULDRIVER;
device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN;
device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX;
ZeroMemory(&device->volpan, sizeof(device->volpan));
hr = DSOUND_PrimaryCreate(device);
if (hr == DS_OK) {
@ -1556,10 +1539,7 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
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;
device->primary->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
} else
WARN("primarybuffer_create() failed\n");
}

View File

@ -46,7 +46,6 @@
#include "winternl.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);

View File

@ -52,7 +52,6 @@
#include "rpcproxy.h"
#include "initguid.h"
#include "ksmedia.h"
#include "dsdriver.h"
#include "dsound_private.h"
@ -93,9 +92,7 @@ HRESULT mmErr(UINT err)
int ds_emuldriver = 0;
int ds_hel_buflen = 32768 * 2;
int ds_snd_queue_max = 10;
int ds_snd_queue_min = 6;
int ds_snd_shadow_maxsize = 2;
int ds_hw_accel = DS_HW_ACCEL_FULL;
int ds_default_sample_rate = 44100;
int ds_default_bits_per_sample = 16;
static int ds_default_playback;
@ -158,20 +155,6 @@ void setup_dsound_options(void)
if (!get_config_key( hkey, appkey, "SndQueueMax", buffer, MAX_PATH ))
ds_snd_queue_max = atoi(buffer);
if (!get_config_key( hkey, appkey, "SndQueueMin", buffer, MAX_PATH ))
ds_snd_queue_min = atoi(buffer);
if (!get_config_key( hkey, appkey, "HardwareAcceleration", buffer, MAX_PATH )) {
if (strcmp(buffer, "Full") == 0)
ds_hw_accel = DS_HW_ACCEL_FULL;
else if (strcmp(buffer, "Standard") == 0)
ds_hw_accel = DS_HW_ACCEL_STANDARD;
else if (strcmp(buffer, "Basic") == 0)
ds_hw_accel = DS_HW_ACCEL_BASIC;
else if (strcmp(buffer, "Emulation") == 0)
ds_hw_accel = DS_HW_ACCEL_EMULATION;
}
if (!get_config_key( hkey, appkey, "DefaultPlayback", buffer, MAX_PATH ))
ds_default_playback = atoi(buffer);
@ -193,15 +176,8 @@ void setup_dsound_options(void)
TRACE("ds_emuldriver = %d\n", ds_emuldriver);
TRACE("ds_hel_buflen = %d\n", ds_hel_buflen);
TRACE("ds_snd_queue_max = %d\n", ds_snd_queue_max);
TRACE("ds_snd_queue_min = %d\n", ds_snd_queue_min);
TRACE("ds_hw_accel = %s\n",
ds_hw_accel==DS_HW_ACCEL_FULL ? "Full" :
ds_hw_accel==DS_HW_ACCEL_STANDARD ? "Standard" :
ds_hw_accel==DS_HW_ACCEL_BASIC ? "Basic" :
ds_hw_accel==DS_HW_ACCEL_EMULATION ? "Emulation" :
"Unknown");
TRACE("ds_default_playback = %d\n", ds_default_playback);
TRACE("ds_default_capture = %d\n", ds_default_playback);
TRACE("ds_default_capture = %d\n", ds_default_capture);
TRACE("ds_default_sample_rate = %d\n", ds_default_sample_rate);
TRACE("ds_default_bits_per_sample = %d\n", ds_default_bits_per_sample);
TRACE("ds_snd_shadow_maxsize = %d\n", ds_snd_shadow_maxsize);
@ -339,11 +315,13 @@ HRESULT WINAPI DirectSoundEnumerateW(
LPVOID lpContext )
{
unsigned devs, wod;
DSDRIVERDESC desc;
GUID guid;
int err;
WCHAR wDesc[MAXPNAMELEN];
WCHAR wName[MAXPNAMELEN];
WAVEOUTCAPSW caps;
const static WCHAR winmmW[] = {'w','i','n','m','m','.','d','l','l',0};
const static WCHAR primary_driverW[] = {'P','r','i','m','a','r','y',' ',
'S','o','u','n','d',' ','D','r','i','v','e','r',0};
TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
lpDSEnumCallback, lpContext);
@ -361,13 +339,11 @@ HRESULT WINAPI DirectSoundEnumerateW(
static const WCHAR empty[] = { 0 };
for (wod = 0; wod < devs; ++wod) {
if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) {
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel));
err = mmErr(waveOutGetDevCapsW(wod, &caps, sizeof(caps)));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
"Primary Sound Driver",desc.szDrvname,lpContext);
MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
wDesc, sizeof(wDesc)/sizeof(WCHAR) );
if (lpDSEnumCallback(NULL, wDesc, empty, lpContext) == FALSE)
"Primary Sound Driver","",lpContext);
if (lpDSEnumCallback(NULL, primary_driverW, empty, lpContext) == FALSE)
return DS_OK;
}
}
@ -376,19 +352,13 @@ HRESULT WINAPI DirectSoundEnumerateW(
}
for (wod = 0; wod < devs; ++wod) {
err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel));
err = mmErr(waveOutGetDevCapsW(wod, &caps, sizeof(caps)));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext);
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
wDesc, sizeof(wDesc)/sizeof(WCHAR) );
wDesc[(sizeof(wDesc)/sizeof(WCHAR)) - 1] = '\0';
debugstr_guid(&DSOUND_renderer_guids[wod]),
wine_dbgstr_w(caps.szPname),"winmm.dll",lpContext);
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
wName, sizeof(wName)/sizeof(WCHAR) );
wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '\0';
if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE)
if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], caps.szPname, winmmW, lpContext) == FALSE)
return DS_OK;
}
}
@ -464,7 +434,7 @@ DirectSoundCaptureEnumerateW(
if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) {
for (wid = 0; wid < devs; ++wid) {
if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) {
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel));
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
"Primary Sound Capture Driver",desc.szDrvname,lpContext);
@ -483,7 +453,7 @@ DirectSoundCaptureEnumerateW(
}
for (wid = 0; wid < devs; ++wid) {
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel));
err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
if (err == DS_OK) {
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext);

View File

@ -25,18 +25,10 @@
#include "wine/list.h"
/* direct sound hardware acceleration levels */
#define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
#define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
#define DS_HW_ACCEL_BASIC 2
#define DS_HW_ACCEL_EMULATION 3
extern int ds_emuldriver DECLSPEC_HIDDEN;
extern int ds_hel_buflen DECLSPEC_HIDDEN;
extern int ds_snd_queue_max DECLSPEC_HIDDEN;
extern int ds_snd_queue_min DECLSPEC_HIDDEN;
extern int ds_snd_shadow_maxsize DECLSPEC_HIDDEN;
extern int ds_hw_accel DECLSPEC_HIDDEN;
extern int ds_default_sample_rate DECLSPEC_HIDDEN;
extern int ds_default_bits_per_sample DECLSPEC_HIDDEN;
@ -68,6 +60,66 @@ extern const mixfunc mixfunctions[4] DECLSPEC_HIDDEN;
typedef void (*normfunc)(const void *, void *, unsigned);
extern const normfunc normfunctions[4] DECLSPEC_HIDDEN;
typedef struct _DSDRIVERDESC
{
DWORD dwFlags;
CHAR szDesc[256];
CHAR szDrvname[256];
DWORD dnDevNode;
WORD wVxdId;
WORD wReserved;
ULONG ulDeviceNum;
DWORD dwHeapType;
LPVOID pvDirectDrawHeap;
DWORD dwMemStartAddress;
DWORD dwMemEndAddress;
DWORD dwMemAllocExtra;
LPVOID pvReserved1;
LPVOID pvReserved2;
} DSDRIVERDESC,*PDSDRIVERDESC;
typedef struct _DSDRIVERCAPS
{
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
} DSDRIVERCAPS,*PDSDRIVERCAPS;
typedef struct _DSVOLUMEPAN
{
DWORD dwTotalLeftAmpFactor;
DWORD dwTotalRightAmpFactor;
LONG lVolume;
DWORD dwVolAmpFactor;
LONG lPan;
DWORD dwPanLeftAmpFactor;
DWORD dwPanRightAmpFactor;
} DSVOLUMEPAN,*PDSVOLUMEPAN;
typedef struct _DSCDRIVERCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFormats;
DWORD dwChannels;
} DSCDRIVERCAPS,*PDSCDRIVERCAPS;
/*****************************************************************************
* IDirectSoundDevice implementation structure
*/
@ -76,7 +128,6 @@ struct DirectSoundDevice
LONG ref;
GUID guid;
PIDSDRIVER driver;
DSDRIVERDESC drvdesc;
DSDRIVERCAPS drvcaps;
DWORD priolevel;
@ -85,7 +136,6 @@ struct DirectSoundDevice
LPWAVEHDR pwave;
UINT timerID, pwplay, pwqueue, prebuf, helfrags;
DWORD fraglen;
PIDSDRIVERBUFFER hwbuf;
LPBYTE buffer;
DWORD writelead, buflen, state, playpos, mixpos;
int nrofbuffers;
@ -162,7 +212,6 @@ struct IDirectSoundBufferImpl
/* IDirectSoundBufferImpl fields */
DirectSoundDevice* device;
RTL_RWLOCK lock;
PIDSDRIVERBUFFER hwbuf;
PWAVEFORMATEX pwfx;
BufferMemory* buffer;
LPBYTE tmp_buffer;
@ -181,7 +230,6 @@ struct IDirectSoundBufferImpl
IDirectSoundNotifyImpl* notify;
LPDSBPOSITIONNOTIFY notifies;
int nrofnotifies;
PIDSDRIVERNOTIFY hwnotify;
/* DirectSound3DBuffer fields */
IDirectSound3DBufferImpl* ds3db;
@ -217,10 +265,8 @@ struct DirectSoundCaptureDevice
LONG ref;
/* DirectSound driver stuff */
PIDSCDRIVER driver;
DSDRIVERDESC drvdesc;
DSCDRIVERCAPS drvcaps;
PIDSCDRIVERBUFFER hwbuf;
/* wave driver info */
HWAVEIN hwi;
@ -258,7 +304,6 @@ struct IDirectSoundCaptureBufferImpl
IDirectSoundCaptureNotifyImpl* notify;
LPDSBPOSITIONNOTIFY notifies;
int nrofnotifies;
PIDSDRIVERNOTIFY hwnotify;
};
/*****************************************************************************

View File

@ -33,7 +33,6 @@
#include "winternl.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);

View File

@ -38,7 +38,6 @@
#include "dsound.h"
#include "ks.h"
#include "ksmedia.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
@ -694,7 +693,7 @@ static DWORD DSOUND_MixToPrimary(const DirectSoundDevice *device, DWORD writepos
TRACE("MixToPrimary for %p, state=%d\n", dsb, dsb->state);
if (dsb->buflen && dsb->state && !dsb->hwbuf) {
if (dsb->buflen && dsb->state) {
TRACE("Checking %p, mixlen=%d\n", dsb, mixlen);
RtlAcquireResourceShared(&dsb->lock, TRUE);
/* if buffer is stopping it is stopped now */
@ -814,7 +813,6 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
BOOL recover = FALSE, all_stopped = FALSE;
DWORD playpos, writepos, writelead, maxq, frag, prebuff_max, prebuff_left, size1, size2, mixplaypos, mixplaypos2;
LPVOID buf1, buf2;
BOOL lock = (device->hwbuf && !(device->drvdesc.dwFlags & DSDDESC_DONTNEEDPRIMARYLOCK));
int nfiller;
/* the sound of silence */
@ -835,7 +833,7 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
/* calc maximum prebuff */
prebuff_max = (device->prebuf * device->fraglen);
if (!device->hwbuf && playpos + prebuff_max >= device->helfrags * device->fraglen)
if (playpos + prebuff_max >= device->helfrags * device->fraglen)
prebuff_max += device->buflen - device->helfrags * device->fraglen;
/* check how close we are to an underrun. It occurs when the writepos overtakes the mixpos */
@ -864,30 +862,22 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
size2 = playpos;
FillMemory(device->mix_buffer + mixplaypos, device->mix_buffer_len - mixplaypos, 0);
FillMemory(device->mix_buffer, mixplaypos2, 0);
if (lock)
IDsDriverBuffer_Lock(device->hwbuf, &buf1, &size1, &buf2, &size2, device->playpos, size1+size2, 0);
FillMemory(buf1, size1, nfiller);
if (playpos && (!buf2 || !size2))
FIXME("%d: (%d, %d)=>(%d, %d) There should be an additional buffer here!!\n", __LINE__, device->playpos, device->mixpos, playpos, writepos);
FillMemory(buf2, size2, nfiller);
if (lock)
IDsDriverBuffer_Unlock(device->hwbuf, buf1, size1, buf2, size2);
} else {
buf1 = device->buffer + device->playpos;
buf2 = NULL;
size1 = playpos - device->playpos;
size2 = 0;
FillMemory(device->mix_buffer + mixplaypos, mixplaypos2 - mixplaypos, 0);
if (lock)
IDsDriverBuffer_Lock(device->hwbuf, &buf1, &size1, &buf2, &size2, device->playpos, size1+size2, 0);
FillMemory(buf1, size1, nfiller);
if (buf2 && size2)
{
FIXME("%d: There should be no additional buffer here!!\n", __LINE__);
FillMemory(buf2, size2, nfiller);
}
if (lock)
IDsDriverBuffer_Unlock(device->hwbuf, buf1, size1, buf2, size2);
}
device->playpos = playpos;
@ -897,9 +887,6 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
TRACE("prebuff_left = %d, prebuff_max = %dx%d=%d, writelead=%d\n",
prebuff_left, device->prebuf, device->fraglen, prebuff_max, writelead);
if (lock)
IDsDriverBuffer_Lock(device->hwbuf, &buf1, &size1, &buf2, &size2, writepos, maxq, 0);
/* do the mixing */
frag = DSOUND_MixToPrimary(device, writepos, maxq, recover, &all_stopped);
@ -916,27 +903,14 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
device->mixpos = writepos + frag;
device->mixpos %= device->buflen;
if (lock)
{
DWORD frag2 = (frag > size1 ? frag - size1 : 0);
frag -= frag2;
if (frag2 > size2)
{
FIXME("Buffering too much! (%d, %d, %d, %d)\n", maxq, frag, size2, frag2 - size2);
frag2 = size2;
}
IDsDriverBuffer_Unlock(device->hwbuf, buf1, frag, buf2, frag2);
}
/* update prebuff left */
prebuff_left = DSOUND_BufPtrDiff(device->buflen, device->mixpos, playpos);
/* check if have a whole fragment */
if (prebuff_left >= device->fraglen){
/* update the wave queue if using wave system */
if (!device->hwbuf)
DSOUND_WaveQueue(device, FALSE);
/* update the wave queue */
DSOUND_WaveQueue(device, FALSE);
/* buffers are full. start playing if applicable */
if(device->state == STATE_STARTING){
@ -974,12 +948,7 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
} else {
/* update the wave queue if using wave system */
if (!device->hwbuf)
DSOUND_WaveQueue(device, TRUE);
else
/* Keep alsa happy, which needs GetPosition called once every 10 ms */
IDsDriverBuffer_GetPosition(device->hwbuf, NULL, NULL);
DSOUND_WaveQueue(device, TRUE);
/* in the DSSCL_WRITEPRIMARY mode, the app is totally in charge... */
if (device->state == STATE_STARTING) {

View File

@ -35,7 +35,6 @@
#include "mmddk.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
@ -78,11 +77,8 @@ static void DSOUND_RecalcPrimary(DirectSoundDevice *device)
device->helfrags = device->buflen / device->fraglen;
TRACE("fraglen=%d helfrags=%d\n", device->fraglen, device->helfrags);
if (device->hwbuf && device->drvdesc.dwFlags & DSDDESC_DONTNEEDWRITELEAD)
device->writelead = 0;
else
/* calculate the 10ms write lead */
device->writelead = (device->pwfx->nSamplesPerSec / 100) * device->pwfx->nBlockAlign;
/* calculate the 10ms write lead */
device->writelead = (device->pwfx->nSamplesPerSec / 100) * device->pwfx->nBlockAlign;
}
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
@ -90,60 +86,17 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
HRESULT hres = DS_OK;
TRACE("(%p, %d)\n", device, forcewave);
if (device->driver)
{
IDsDriver_Close(device->driver);
if (device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
waveOutClose(device->hwo);
IDsDriver_Release(device->driver);
device->driver = NULL;
device->buffer = NULL;
device->hwo = 0;
}
else if (device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
waveOutClose(device->hwo);
waveOutClose(device->hwo);
/* DRV_QUERYDSOUNDIFACE is a "Wine extension" to get the DSound interface */
if (ds_hw_accel != DS_HW_ACCEL_EMULATION && !forcewave)
waveOutMessage((HWAVEOUT)device->drvdesc.dnDevNode, DRV_QUERYDSOUNDIFACE, (DWORD_PTR)&device->driver, 0);
device->drvdesc.dwFlags = 0;
/* Get driver description */
if (device->driver) {
DWORD wod = device->drvdesc.dnDevNode;
hres = IDsDriver_GetDriverDesc(device->driver,&(device->drvdesc));
device->drvdesc.dnDevNode = wod;
if (FAILED(hres)) {
WARN("IDsDriver_GetDriverDesc failed: %08x\n", hres);
IDsDriver_Release(device->driver);
device->driver = NULL;
}
}
/* if no DirectSound interface available, use WINMM API instead */
if (!device->driver)
device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN | DSDDESC_DOMMSYSTEMSETFORMAT;
if (device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
{
DWORD flags = CALLBACK_FUNCTION | WAVE_MAPPED;
if (device->driver)
flags |= WAVE_DIRECTSOUND;
hres = mmErr(waveOutOpen(&(device->hwo), device->drvdesc.dnDevNode, device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD_PTR)device, flags));
if (FAILED(hres)) {
WARN("waveOutOpen failed\n");
if (device->driver)
{
IDsDriver_Release(device->driver);
device->driver = NULL;
}
return hres;
}
}
if (device->driver)
hres = IDsDriver_Open(device->driver);
hres = mmErr(waveOutOpen(&(device->hwo), device->drvdesc.dnDevNode,
device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD_PTR)device,
CALLBACK_FUNCTION | WAVE_MAPPED));
if (FAILED(hres)) {
WARN("waveOutOpen failed: %08x\n", hres);
return hres;
}
return hres;
}
@ -152,6 +105,11 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
{
DWORD buflen;
HRESULT err = DS_OK;
LPBYTE newbuf;
LPWAVEHDR headers = NULL;
DWORD overshot;
unsigned int c;
TRACE("(%p)\n", device);
/* on original windows, the buffer it set to a fixed size, no matter what the settings are.
@ -162,122 +120,72 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
buflen -= buflen % device->pwfx->nBlockAlign;
device->buflen = buflen;
if (device->driver)
{
err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx,
DSBCAPS_PRIMARYBUFFER,0,
&(device->buflen),&(device->buffer),
(LPVOID*)&(device->hwbuf));
if (err != DS_OK) {
WARN("IDsDriver_CreateSoundBuffer failed (%08x), falling back to waveout\n", err);
err = DSOUND_ReopenDevice(device, TRUE);
if (FAILED(err))
{
WARN("Falling back to waveout failed too! Giving up\n");
return err;
}
}
if (device->hwbuf)
IDsDriverBuffer_SetVolumePan(device->hwbuf, &device->volpan);
DSOUND_RecalcPrimary(device);
device->prebuf = ds_snd_queue_max;
if (device->helfrags < ds_snd_queue_min)
{
WARN("Too little sound buffer to be effective (%d/%d) falling back to waveout\n", device->buflen, ds_snd_queue_min * device->fraglen);
device->buflen = buflen;
IDsDriverBuffer_Release(device->hwbuf);
device->hwbuf = NULL;
err = DSOUND_ReopenDevice(device, TRUE);
if (FAILED(err))
{
WARN("Falling back to waveout failed too! Giving up\n");
return err;
}
}
else if (device->helfrags < ds_snd_queue_max)
device->prebuf = device->helfrags;
}
device->mix_buffer_len = DSOUND_bufpos_to_mixpos(device, device->buflen);
device->mix_buffer = HeapAlloc(GetProcessHeap(), 0, device->mix_buffer_len);
if (!device->mix_buffer)
{
if (device->hwbuf)
IDsDriverBuffer_Release(device->hwbuf);
device->hwbuf = NULL;
return DSERR_OUTOFMEMORY;
}
if (device->state == STATE_PLAYING) device->state = STATE_STARTING;
else if (device->state == STATE_STOPPING) device->state = STATE_STOPPED;
/* are we using waveOut stuff? */
if (!device->driver) {
LPBYTE newbuf;
LPWAVEHDR headers = NULL;
DWORD overshot;
unsigned int c;
/* Start in pause mode, to allow buffers to get filled */
waveOutPause(device->hwo);
/* Start in pause mode, to allow buffers to get filled */
waveOutPause(device->hwo);
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
/* reallocate emulated primary buffer */
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer, buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0, buflen);
/* reallocate emulated primary buffer */
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer, buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0, buflen);
if (!newbuf) {
ERR("failed to allocate primary buffer\n");
return DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */
}
if (!newbuf) {
ERR("failed to allocate primary buffer\n");
return DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */
}
DSOUND_RecalcPrimary(device);
if (device->pwave)
headers = HeapReAlloc(GetProcessHeap(),0,device->pwave, device->helfrags * sizeof(WAVEHDR));
else
headers = HeapAlloc(GetProcessHeap(),0,device->helfrags * sizeof(WAVEHDR));
DSOUND_RecalcPrimary(device);
if (device->pwave)
headers = HeapReAlloc(GetProcessHeap(),0,device->pwave, device->helfrags * sizeof(WAVEHDR));
else
headers = HeapAlloc(GetProcessHeap(),0,device->helfrags * sizeof(WAVEHDR));
if (!headers) {
ERR("failed to allocate wave headers\n");
HeapFree(GetProcessHeap(), 0, newbuf);
DSOUND_RecalcPrimary(device);
return DSERR_OUTOFMEMORY;
}
if (!headers) {
ERR("failed to allocate wave headers\n");
HeapFree(GetProcessHeap(), 0, newbuf);
DSOUND_RecalcPrimary(device);
return DSERR_OUTOFMEMORY;
}
device->buffer = newbuf;
device->pwave = headers;
device->buffer = newbuf;
device->pwave = headers;
/* prepare fragment headers */
for (c=0; c<device->helfrags; c++) {
device->pwave[c].lpData = (char*)device->buffer + c*device->fraglen;
device->pwave[c].dwBufferLength = device->fraglen;
device->pwave[c].dwUser = (DWORD_PTR)device;
device->pwave[c].dwFlags = 0;
device->pwave[c].dwLoops = 0;
err = mmErr(waveOutPrepareHeader(device->hwo,&device->pwave[c],sizeof(WAVEHDR)));
if (err != DS_OK) {
while (c--)
waveOutUnprepareHeader(device->hwo,&device->pwave[c],sizeof(WAVEHDR));
break;
}
}
/* prepare fragment headers */
for (c=0; c<device->helfrags; c++) {
device->pwave[c].lpData = (char*)device->buffer + c*device->fraglen;
device->pwave[c].dwBufferLength = device->fraglen;
device->pwave[c].dwUser = (DWORD_PTR)device;
device->pwave[c].dwFlags = 0;
device->pwave[c].dwLoops = 0;
err = mmErr(waveOutPrepareHeader(device->hwo,&device->pwave[c],sizeof(WAVEHDR)));
if (err != DS_OK) {
while (c--)
waveOutUnprepareHeader(device->hwo,&device->pwave[c],sizeof(WAVEHDR));
break;
}
}
overshot = device->buflen % device->fraglen;
/* sanity */
if(overshot)
{
overshot -= overshot % device->pwfx->nBlockAlign;
device->pwave[device->helfrags - 1].dwBufferLength += overshot;
}
overshot = device->buflen % device->fraglen;
/* sanity */
if(overshot)
{
overshot -= overshot % device->pwfx->nBlockAlign;
device->pwave[device->helfrags - 1].dwBufferLength += overshot;
}
TRACE("fraglen=%d, overshot=%d\n", device->fraglen, overshot);
TRACE("fraglen=%d, overshot=%d\n", device->fraglen, overshot);
}
device->mixfunction = mixfunctions[device->pwfx->wBitsPerSample/8 - 1];
device->normfunction = normfunctions[device->pwfx->wBitsPerSample/8 - 1];
FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
@ -289,31 +197,22 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
static void DSOUND_PrimaryClose(DirectSoundDevice *device)
{
unsigned c;
TRACE("(%p)\n", device);
/* are we using waveOut stuff? */
if (!device->hwbuf) {
unsigned c;
/* get out of CS when calling the wave system */
LeaveCriticalSection(&(device->mixlock));
/* **** */
device->pwqueue = (DWORD)-1; /* resetting queues */
waveOutReset(device->hwo);
for (c=0; c<device->helfrags; c++)
waveOutUnprepareHeader(device->hwo, &device->pwave[c], sizeof(WAVEHDR));
/* **** */
EnterCriticalSection(&(device->mixlock));
/* get out of CS when calling the wave system */
LeaveCriticalSection(&(device->mixlock));
/* **** */
device->pwqueue = (DWORD)-1; /* resetting queues */
waveOutReset(device->hwo);
for (c=0; c<device->helfrags; c++)
waveOutUnprepareHeader(device->hwo, &device->pwave[c], sizeof(WAVEHDR));
/* **** */
EnterCriticalSection(&(device->mixlock));
/* clear the queue */
device->pwqueue = 0;
} else {
ULONG ref = IDsDriverBuffer_Release(device->hwbuf);
if (!ref)
device->hwbuf = 0;
else
ERR("Still %d references on primary buffer, refcount leak?\n", ref);
}
/* clear the queue */
device->pwqueue = 0;
}
HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device)
@ -341,15 +240,9 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
EnterCriticalSection(&(device->mixlock));
DSOUND_PrimaryClose(device);
if (device->driver) {
if (device->hwbuf) {
if (IDsDriverBuffer_Release(device->hwbuf) == 0)
device->hwbuf = 0;
}
} else
HeapFree(GetProcessHeap(),0,device->pwave);
HeapFree(GetProcessHeap(),0,device->pwfx);
device->pwfx=NULL;
HeapFree(GetProcessHeap(),0,device->pwave);
HeapFree(GetProcessHeap(),0,device->pwfx);
device->pwfx=NULL;
LeaveCriticalSection(&(device->mixlock));
/* **** */
@ -362,15 +255,9 @@ HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device)
HRESULT err = DS_OK;
TRACE("(%p)\n", device);
if (device->hwbuf) {
err = IDsDriverBuffer_Play(device->hwbuf, 0, 0, DSBPLAY_LOOPING);
if (err != DS_OK)
WARN("IDsDriverBuffer_Play failed\n");
} else {
err = mmErr(waveOutRestart(device->hwo));
if (err != DS_OK)
WARN("waveOutRestart failed\n");
}
err = mmErr(waveOutRestart(device->hwo));
if (err != DS_OK)
WARN("waveOutRestart failed\n");
return err;
}
@ -380,36 +267,15 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
HRESULT err = DS_OK;
TRACE("(%p)\n", device);
if (device->hwbuf) {
err = IDsDriverBuffer_Stop(device->hwbuf);
if (err == DSERR_BUFFERLOST) {
DSOUND_PrimaryClose(device);
err = DSOUND_ReopenDevice(device, FALSE);
if (FAILED(err))
ERR("DSOUND_ReopenDevice failed\n");
else
{
err = DSOUND_PrimaryOpen(device);
if (FAILED(err))
WARN("DSOUND_PrimaryOpen failed\n");
}
} else if (err != DS_OK) {
WARN("IDsDriverBuffer_Stop failed\n");
}
} else {
/* don't call the wave system with the lock set */
LeaveCriticalSection(&(device->mixlock));
/* don't call the wave system with the lock set */
LeaveCriticalSection(&(device->mixlock));
/* **** */
err = mmErr(waveOutPause(device->hwo));
err = mmErr(waveOutPause(device->hwo));
EnterCriticalSection(&(device->mixlock));
/* **** */
EnterCriticalSection(&(device->mixlock));
if (err != DS_OK)
WARN("waveOutPause failed\n");
}
if (err != DS_OK)
WARN("waveOutPause failed\n");
return err;
}
@ -418,25 +284,18 @@ HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LP
{
TRACE("(%p,%p,%p)\n", device, playpos, writepos);
if (device->hwbuf) {
HRESULT err=IDsDriverBuffer_GetPosition(device->hwbuf,playpos,writepos);
if (err != S_OK) {
WARN("IDsDriverBuffer_GetPosition failed\n");
return err;
}
} else {
TRACE("pwplay=%i, pwqueue=%i\n", device->pwplay, device->pwqueue);
TRACE("pwplay=%i, pwqueue=%i\n", device->pwplay, device->pwqueue);
/* check if playpos was requested */
if (playpos)
/* use the cached play position */
*playpos = device->pwplay * device->fraglen;
/* check if playpos was requested */
if (playpos)
/* use the cached play position */
*playpos = device->pwplay * device->fraglen;
/* check if writepos was requested */
if (writepos)
/* the writepos is the first non-queued position */
*writepos = ((device->pwplay + device->pwqueue) % device->helfrags) * device->fraglen;
/* check if writepos was requested */
if (writepos)
/* the writepos is the first non-queued position */
*writepos = ((device->pwplay + device->pwqueue) % device->helfrags) * device->fraglen;
}
TRACE("playpos = %d, writepos = %d (%p, time=%d)\n", playpos?*playpos:-1, writepos?*writepos:-1, device, GetTickCount());
return DS_OK;
}
@ -515,72 +374,29 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex)
goto done;
}
if (!(device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMSETFORMAT) && device->hwbuf) {
err = IDsDriverBuffer_SetFormat(device->hwbuf, device->pwfx);
DSOUND_PrimaryClose(device);
/* On bad format, try to re-create, big chance it will work then, only do this if we <HAVE> to */
if (forced && (device->pwfx->nSamplesPerSec/100 != wfex->nSamplesPerSec/100 || err == DSERR_BADFORMAT))
{
DWORD cp_size = wfex->wFormatTag == WAVE_FORMAT_PCM ?
sizeof(PCMWAVEFORMAT) : sizeof(WAVEFORMATEX) + wfex->cbSize;
err = DSERR_BUFFERLOST;
CopyMemory(device->pwfx, wfex, cp_size);
}
if (err != DSERR_BUFFERLOST && FAILED(err)) {
DWORD size = DSOUND_GetFormatSize(oldpwfx);
WARN("IDsDriverBuffer_SetFormat failed\n");
if (!forced) {
CopyMemory(device->pwfx, oldpwfx, size);
err = DS_OK;
}
goto done;
}
if (err == S_FALSE)
{
/* ALSA specific: S_FALSE tells that recreation was successful,
* but size and location may be changed, and buffer has to be restarted
* I put it here, so if frequency doesn't match the error will be changed to DSERR_BUFFERLOST
* and the entire re-initialization will occur anyway
*/
IDsDriverBuffer_Lock(device->hwbuf, (LPVOID *)&device->buffer, &device->buflen, NULL, NULL, 0, 0, DSBLOCK_ENTIREBUFFER);
IDsDriverBuffer_Unlock(device->hwbuf, device->buffer, 0, NULL, 0);
if (device->state == STATE_PLAYING) device->state = STATE_STARTING;
else if (device->state == STATE_STOPPING) device->state = STATE_STOPPED;
device->pwplay = device->pwqueue = device->playpos = device->mixpos = 0;
err = DS_OK;
}
DSOUND_RecalcPrimary(device);
err = DSOUND_ReopenDevice(device, FALSE);
if (FAILED(err))
{
WARN("DSOUND_ReopenDevice failed: %08x\n", err);
goto done;
}
err = DSOUND_PrimaryOpen(device);
if (err != DS_OK) {
WARN("DSOUND_PrimaryOpen failed\n");
goto done;
}
if (err == DSERR_BUFFERLOST)
if (wfex->nSamplesPerSec/100 != device->pwfx->nSamplesPerSec/100 && forced && device->buffer)
{
DSOUND_PrimaryClose(device);
err = DSOUND_ReopenDevice(device, FALSE);
device->pwfx->nSamplesPerSec = wfex->nSamplesPerSec;
err = DSOUND_ReopenDevice(device, TRUE);
if (FAILED(err))
{
WARN("DSOUND_ReopenDevice failed: %08x\n", err);
goto done;
}
err = DSOUND_PrimaryOpen(device);
if (err != DS_OK) {
WARN("DSOUND_PrimaryOpen failed\n");
goto done;
}
if (wfex->nSamplesPerSec/100 != device->pwfx->nSamplesPerSec/100 && forced && device->buffer)
{
DSOUND_PrimaryClose(device);
device->pwfx->nSamplesPerSec = wfex->nSamplesPerSec;
err = DSOUND_ReopenDevice(device, TRUE);
if (FAILED(err))
WARN("DSOUND_ReopenDevice(2) failed: %08x\n", err);
else if (FAILED((err = DSOUND_PrimaryOpen(device))))
WARN("DSOUND_PrimaryOpen(2) failed: %08x\n", err);
}
WARN("DSOUND_ReopenDevice(2) failed: %08x\n", err);
else if (FAILED((err = DSOUND_PrimaryOpen(device))))
WARN("DSOUND_PrimaryOpen(2) failed: %08x\n", err);
}
device->mix_buffer_len = DSOUND_bufpos_to_mixpos(device, device->buflen);
@ -640,7 +456,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer(iface);
DirectSoundDevice *device = This->device;
DWORD ampfactors;
HRESULT hres = DS_OK;
HRESULT hres = DS_OK;
TRACE("(%p,%d)\n", iface, vol);
if (!(This->dsbd.dwFlags & DSBCAPS_CTRLVOLUME)) {
@ -656,22 +472,16 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
/* **** */
EnterCriticalSection(&(device->mixlock));
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
if (vol != device->volpan.lVolume) {
device->volpan.lVolume=vol;
DSOUND_RecalcVolPan(&device->volpan);
if (device->hwbuf) {
hres = IDsDriverBuffer_SetVolumePan(device->hwbuf, &device->volpan);
if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n");
} else {
ampfactors = (device->volpan.dwTotalLeftAmpFactor & 0xffff) | (device->volpan.dwTotalRightAmpFactor << 16);
waveOutSetVolume(device->hwo, ampfactors);
}
}
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
if (vol != device->volpan.lVolume) {
device->volpan.lVolume=vol;
DSOUND_RecalcVolPan(&device->volpan);
ampfactors = (device->volpan.dwTotalLeftAmpFactor & 0xffff) | (device->volpan.dwTotalRightAmpFactor << 16);
waveOutSetVolume(device->hwo, ampfactors);
}
LeaveCriticalSection(&(device->mixlock));
/* **** */
@ -697,14 +507,12 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
return DSERR_INVALIDPARAM;
}
if (!device->hwbuf)
{
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
}
*vol = device->volpan.lVolume;
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
*vol = device->volpan.lVolume;
return DS_OK;
}
@ -934,34 +742,22 @@ static HRESULT WINAPI PrimaryBufferImpl_Lock(
return DSERR_INVALIDPARAM;
}
if (!(device->drvdesc.dwFlags & DSDDESC_DONTNEEDPRIMARYLOCK) && device->hwbuf) {
hres = IDsDriverBuffer_Lock(device->hwbuf,
lplpaudioptr1, audiobytes1,
lplpaudioptr2, audiobytes2,
writecursor, writebytes,
0);
if (hres != DS_OK) {
WARN("IDsDriverBuffer_Lock failed\n");
return hres;
}
if (writecursor+writebytes <= device->buflen) {
*(LPBYTE*)lplpaudioptr1 = device->buffer+writecursor;
*audiobytes1 = writebytes;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = NULL;
if (audiobytes2)
*audiobytes2 = 0;
TRACE("->%d.0\n",writebytes);
} else {
if (writecursor+writebytes <= device->buflen) {
*(LPBYTE*)lplpaudioptr1 = device->buffer+writecursor;
*audiobytes1 = writebytes;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = NULL;
if (audiobytes2)
*audiobytes2 = 0;
TRACE("->%d.0\n",writebytes);
} else {
*(LPBYTE*)lplpaudioptr1 = device->buffer+writecursor;
*audiobytes1 = device->buflen-writecursor;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = device->buffer;
if (audiobytes2)
*audiobytes2 = writebytes-(device->buflen-writecursor);
TRACE("->%d.%d\n",*audiobytes1,audiobytes2?*audiobytes2:0);
}
*(LPBYTE*)lplpaudioptr1 = device->buffer+writecursor;
*audiobytes1 = device->buflen-writecursor;
if (lplpaudioptr2)
*(LPBYTE*)lplpaudioptr2 = device->buffer;
if (audiobytes2)
*audiobytes2 = writebytes-(device->buflen-writecursor);
TRACE("->%d.%d\n",*audiobytes1,audiobytes2?*audiobytes2:0);
}
return DS_OK;
}
@ -999,25 +795,16 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
/* **** */
EnterCriticalSection(&(device->mixlock));
if (!device->hwbuf)
{
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
}
if (pan != device->volpan.lPan) {
device->volpan.lPan=pan;
DSOUND_RecalcVolPan(&device->volpan);
if (device->hwbuf) {
hres = IDsDriverBuffer_SetVolumePan(device->hwbuf, &device->volpan);
if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n");
} else {
ampfactors = (device->volpan.dwTotalLeftAmpFactor & 0xffff) | (device->volpan.dwTotalRightAmpFactor << 16);
waveOutSetVolume(device->hwo, ampfactors);
}
}
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
if (pan != device->volpan.lPan) {
device->volpan.lPan=pan;
DSOUND_RecalcVolPan(&device->volpan);
ampfactors = (device->volpan.dwTotalLeftAmpFactor & 0xffff) | (device->volpan.dwTotalRightAmpFactor << 16);
waveOutSetVolume(device->hwo, ampfactors);
}
LeaveCriticalSection(&(device->mixlock));
/* **** */
@ -1043,13 +830,10 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
return DSERR_INVALIDPARAM;
}
if (!device->hwbuf)
{
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
}
waveOutGetVolume(device->hwo, &ampfactors);
device->volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff;
device->volpan.dwTotalRightAmpFactor=ampfactors >> 16;
DSOUND_AmpFactorToVolPan(&device->volpan);
*pan = device->volpan.lPan;
return DS_OK;
}
@ -1066,20 +850,6 @@ static HRESULT WINAPI PrimaryBufferImpl_Unlock(
return DSERR_PRIOLEVELNEEDED;
}
if (!(device->drvdesc.dwFlags & DSDDESC_DONTNEEDPRIMARYLOCK) && device->hwbuf) {
HRESULT hres;
if ((char *)p1 - (char *)device->buffer + x1 > device->buflen)
hres = DSERR_INVALIDPARAM;
else
hres = IDsDriverBuffer_Unlock(device->hwbuf, p1, x1, p2, x2);
if (hres != DS_OK) {
WARN("IDsDriverBuffer_Unlock failed\n");
return hres;
}
}
return DS_OK;
}

View File

@ -32,7 +32,6 @@
#include "mmddk.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
#include "dsconf.h"
@ -252,9 +251,9 @@ static HRESULT DSPROPERTY_DescriptionW(
}
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
err = waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel);
err = waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0);
else
err = waveInMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel);
err = waveInMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0);
if (err != MMSYSERR_NOERROR)
{

View File

@ -50,7 +50,6 @@
#include "mmddk.h"
#include "wine/debug.h"
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
/* default velocity of sound in the air */

View File

@ -50,7 +50,6 @@
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
#include "dsdriver.h"
#include "wine/debug.h"
#include <alsa/asoundlib.h>

View File

@ -42,7 +42,6 @@
#include "endpointvolume.h"
#include "audioclient.h"
#include "audiopolicy.h"
#include "dsdriver.h"
#include <alsa/asoundlib.h>

View File

@ -46,11 +46,6 @@
#include "wine/debug.h"
/* TODO: Remove after dsound has been rewritten for mmdevapi */
#include "dsound.h"
#include "dsdriver.h"
#define DS_HW_ACCEL_FULL 0
WINE_DEFAULT_DEBUG_CHANNEL(winmm);
/* FIXME: Should be localized */
@ -2763,53 +2758,6 @@ static UINT WINMM_QueryInstanceID(UINT device, WCHAR *str, DWORD_PTR len,
return MMSYSERR_NOERROR;
}
static UINT WINMM_DRVMessage(UINT dev, UINT message, DWORD_PTR param1,
DWORD_PTR param2, BOOL is_out)
{
WINE_MLD *wmld;
UINT type = is_out ? MMDRV_WAVEOUT : MMDRV_WAVEIN;
TRACE("(%u, %u, %ld, %ld, %d)\n", dev, message, param1, param2, is_out);
if((wmld = MMDRV_Get(ULongToHandle(dev), type, FALSE)) == NULL){
if((wmld = MMDRV_Get(ULongToHandle(dev), type, TRUE)) != NULL)
return MMDRV_PhysicalFeatures(wmld, message, param1, param2);
return MMSYSERR_INVALHANDLE;
}
if(message < DRVM_IOCTL ||
(message >= DRVM_IOCTL_LAST && message < DRVM_MAPPER))
return MMSYSERR_INVALPARAM;
return MMDRV_Message(wmld, message, param1, param2);
}
static UINT WINMM_FillDSDriverDesc(UINT dev, DSDRIVERDESC *desc, BOOL is_out)
{
WCHAR *name;
if(is_out){
if(dev >= g_outmmdevices_count)
return MMSYSERR_INVALHANDLE;
name = g_out_mmdevices[dev].out_caps.szPname;
}else{
if(dev >= g_inmmdevices_count)
return MMSYSERR_INVALHANDLE;
name = g_in_mmdevices[dev].in_caps.szPname;
}
memset(desc, 0, sizeof(*desc));
strcpy(desc->szDesc, "WinMM: ");
WideCharToMultiByte(CP_ACP, 0, name, -1,
desc->szDesc + strlen(desc->szDesc),
sizeof(desc->szDesc) - strlen(desc->szDesc), NULL, NULL);
strcpy(desc->szDrvname, "winmm.dll");
return MMSYSERR_NOERROR;
}
/**************************************************************************
* waveOutMessage [WINMM.@]
*/
@ -2824,14 +2772,6 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
(DWORD_PTR*)dwParam1, TRUE);
case DRV_QUERYFUNCTIONINSTANCEID:
return WINMM_QueryInstanceID(HandleToULong(hWaveOut), (WCHAR*)dwParam1, dwParam2, TRUE);
/* TODO: Remove after dsound has been rewritten for mmdevapi */
case DRV_QUERYDSOUNDDESC:
case DRV_QUERYDSOUNDIFACE:
if(dwParam2 == DS_HW_ACCEL_FULL)
return WINMM_DRVMessage(HandleToULong(hWaveOut), uMessage,
dwParam1, 0, TRUE);
return WINMM_FillDSDriverDesc(HandleToULong(hWaveOut),
(DSDRIVERDESC*)dwParam1, TRUE);
}
return MMSYSERR_NOTSUPPORTED;
@ -3203,14 +3143,6 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
(DWORD_PTR*)dwParam1, FALSE);
case DRV_QUERYFUNCTIONINSTANCEID:
return WINMM_QueryInstanceID(HandleToULong(hWaveIn), (WCHAR*)dwParam1, dwParam2, FALSE);
/* TODO: Remove after dsound has been rewritten for mmdevapi */
case DRV_QUERYDSOUNDDESC:
case DRV_QUERYDSOUNDIFACE:
if(dwParam2 == DS_HW_ACCEL_FULL)
return WINMM_DRVMessage(HandleToULong(hWaveIn), uMessage,
dwParam1, 0, FALSE);
return WINMM_FillDSDriverDesc(HandleToULong(hWaveIn),
(DSDRIVERDESC*)dwParam1, FALSE);
}
return MMSYSERR_NOTSUPPORTED;

View File

@ -248,7 +248,6 @@ SRCDIR_INCLUDES = \
dplobby8.h \
dpnathlp.h \
dsconf.h \
dsdriver.h \
dsgetdc.h \
dshow.h \
dsound.h \

View File

@ -1,366 +0,0 @@
/*
* DirectSound driver
* (DirectX 5 version)
*
* Copyright (C) 2000 Ove Kaaven
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DSDRIVER_H
#define __WINE_DSDRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* Predeclare the interfaces
*/
DEFINE_GUID(IID_IDsDriver, 0x8C4233C0l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
typedef struct IDsDriver *PIDSDRIVER;
DEFINE_GUID(IID_IDsDriverBuffer, 0x8C4233C1l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
typedef struct IDsDriverBuffer *PIDSDRIVERBUFFER;
DEFINE_GUID(IID_IDsDriverPropertySet, 0x0F6F2E8E0, 0xD842, 0x11D0, 0x8F, 0x75, 0x00, 0xC0, 0x4F, 0xC2, 0x8A, 0xCA);
typedef struct IDsDriverPropertySet *PIDSDRIVERPROPERTYSET;
DEFINE_GUID(IID_IDsDriverNotify, 0x00363EF44, 0x3B57, 0x11D3, 0xAC, 0x79, 0x00, 0x10, 0x5A, 0x01, 0x7f, 0xe1);
typedef struct IDsDriverNotify *PIDSDRIVERNOTIFY;
DEFINE_GUID(IID_IDsCaptureDriver, 0x03DD10C47, 0x74FB, 0x11D3, 0x90, 0x49, 0xCB, 0xB4, 0xB3, 0x2E, 0xAA, 0x08);
typedef struct IDsCaptureDriver *PIDSCDRIVER;
DEFINE_GUID(IID_IDsCaptureDriverBuffer, 0x03DD10C48, 0x74FB, 0x11D3, 0x90, 0x49, 0xCB, 0xB4, 0xB3, 0x2E, 0xAA, 0x08);
typedef struct IDsCaptureDriverBuffer *PIDSCDRIVERBUFFER;
#define DSDDESC_DOMMSYSTEMOPEN 0x00000001
#define DSDDESC_DOMMSYSTEMSETFORMAT 0x00000002
#define DSDDESC_USESYSTEMMEMORY 0x00000004
#define DSDDESC_DONTNEEDPRIMARYLOCK 0x00000008
#define DSDDESC_DONTNEEDSECONDARYLOCK 0x00000010
#define DSDDESC_DONTNEEDWRITELEAD 0x00000020
#define DSDHEAP_NOHEAP 0
#define DSDHEAP_CREATEHEAP 1
#define DSDHEAP_USEDIRECTDRAWHEAP 2
#define DSDHEAP_PRIVATEHEAP 3
typedef struct _DSDRIVERDESC
{
DWORD dwFlags;
CHAR szDesc[256];
CHAR szDrvname[256];
DWORD dnDevNode;
WORD wVxdId;
WORD wReserved;
ULONG ulDeviceNum;
DWORD dwHeapType;
LPVOID pvDirectDrawHeap;
DWORD dwMemStartAddress;
DWORD dwMemEndAddress;
DWORD dwMemAllocExtra;
LPVOID pvReserved1;
LPVOID pvReserved2;
} DSDRIVERDESC,*PDSDRIVERDESC;
typedef struct _DSDRIVERCAPS
{
DWORD dwFlags;
DWORD dwMinSecondarySampleRate;
DWORD dwMaxSecondarySampleRate;
DWORD dwPrimaryBuffers;
DWORD dwMaxHwMixingAllBuffers;
DWORD dwMaxHwMixingStaticBuffers;
DWORD dwMaxHwMixingStreamingBuffers;
DWORD dwFreeHwMixingAllBuffers;
DWORD dwFreeHwMixingStaticBuffers;
DWORD dwFreeHwMixingStreamingBuffers;
DWORD dwMaxHw3DAllBuffers;
DWORD dwMaxHw3DStaticBuffers;
DWORD dwMaxHw3DStreamingBuffers;
DWORD dwFreeHw3DAllBuffers;
DWORD dwFreeHw3DStaticBuffers;
DWORD dwFreeHw3DStreamingBuffers;
DWORD dwTotalHwMemBytes;
DWORD dwFreeHwMemBytes;
DWORD dwMaxContigFreeHwMemBytes;
} DSDRIVERCAPS,*PDSDRIVERCAPS;
typedef struct _DSVOLUMEPAN
{
DWORD dwTotalLeftAmpFactor;
DWORD dwTotalRightAmpFactor;
LONG lVolume;
DWORD dwVolAmpFactor;
LONG lPan;
DWORD dwPanLeftAmpFactor;
DWORD dwPanRightAmpFactor;
} DSVOLUMEPAN,*PDSVOLUMEPAN;
typedef union _DSPROPERTY
{
struct {
GUID Set;
ULONG Id;
ULONG Flags;
ULONG InstanceId;
} DUMMYSTRUCTNAME;
ULONGLONG Alignment;
} DSPROPERTY,*PDSPROPERTY;
typedef struct _DSCDRIVERCAPS
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwFormats;
DWORD dwChannels;
} DSCDRIVERCAPS,*PDSCDRIVERCAPS;
/*****************************************************************************
* IDsDriver interface
*/
#define INTERFACE IDsDriver
DECLARE_INTERFACE_(IDsDriver,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsDriver methods ***/
STDMETHOD(GetDriverDesc)(THIS_ PDSDRIVERDESC pDsDriverDesc) PURE;
STDMETHOD(Open)(THIS) PURE;
STDMETHOD(Close)(THIS) PURE;
STDMETHOD(GetCaps)(THIS_ PDSDRIVERCAPS pDsDrvCaps) PURE;
STDMETHOD(CreateSoundBuffer)(THIS_ LPWAVEFORMATEX pwfx,DWORD dwFlags,DWORD dwCardAddress,LPDWORD pdwcbBufferSize,LPBYTE *ppbBuffer,LPVOID *ppvObj) PURE;
STDMETHOD(DuplicateSoundBuffer)(THIS_ PIDSDRIVERBUFFER pIDsDriverBuffer,LPVOID *ppvObj) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsDriver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsDriver_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsDriver_Release(p) (p)->lpVtbl->Release(p)
/*** IDsDriver methods ***/
#define IDsDriver_GetDriverDesc(p,a) (p)->lpVtbl->GetDriverDesc(p,a)
#define IDsDriver_Open(p) (p)->lpVtbl->Open(p)
#define IDsDriver_Close(p) (p)->lpVtbl->Close(p)
#define IDsDriver_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDsDriver_CreateSoundBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c,d,e,f)
#define IDsDriver_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b)
#endif
/*****************************************************************************
* IDsDriverBuffer interface
*/
#define INTERFACE IDsDriverBuffer
DECLARE_INTERFACE_(IDsDriverBuffer,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsDriverBuffer methods ***/
STDMETHOD(Lock)(THIS_ LPVOID *ppvAudio1,LPDWORD pdwLen1,LPVOID *pdwAudio2,LPDWORD pdwLen2,DWORD dwWritePosition,DWORD dwWriteLen,DWORD dwFlags) PURE;
STDMETHOD(Unlock)(THIS_ LPVOID pvAudio1,DWORD dwLen1,LPVOID pvAudio2,DWORD dwLen2) PURE;
STDMETHOD(SetFormat)(THIS_ LPWAVEFORMATEX pwfxToSet) PURE;
STDMETHOD(SetFrequency)(THIS_ DWORD dwFrequency) PURE;
STDMETHOD(SetVolumePan)(THIS_ PDSVOLUMEPAN pDsVolumePan) PURE;
STDMETHOD(SetPosition)(THIS_ DWORD dwNewPosition) PURE;
STDMETHOD(GetPosition)(THIS_ LPDWORD lpdwCurrentPlayCursor,LPDWORD lpdwCurrentWriteCursor) PURE;
STDMETHOD(Play)(THIS_ DWORD dwReserved1,DWORD dwReserved2,DWORD dwFlags) PURE;
STDMETHOD(Stop)(THIS) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsDriverBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsDriverBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsDriverBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** IDsDriverBuffer methods ***/
#define IDsDriverBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDsDriverBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDsDriverBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDsDriverBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a)
#define IDsDriverBuffer_SetVolumePan(p,a) (p)->lpVtbl->SetVolumePan(p,a)
#define IDsDriverBuffer_SetPosition(p,a) (p)->lpVtbl->SetPosition(p,a)
#define IDsDriverBuffer_GetPosition(p,a,b) (p)->lpVtbl->GetPosition(p,a,b)
#define IDsDriverBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c)
#define IDsDriverBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#endif
/*****************************************************************************
* IDsDriverPropertySet interface
*/
#define INTERFACE IDsDriverPropertySet
DECLARE_INTERFACE_(IDsDriverPropertySet,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsDriverPropertySet methods ***/
STDMETHOD(Get)(THIS_ PDSPROPERTY pDsProperty,LPVOID pPropertyParams,ULONG cbPropertyParams,LPVOID pPropertyData,ULONG cbPropertyData,PULONG pcbReturnedData) PURE;
STDMETHOD(Set)(THIS_ PDSPROPERTY pDsProperty,LPVOID pPropertyParams,ULONG cbPropertyParams,LPVOID pPropertyData,ULONG cbPropertyData) PURE;
STDMETHOD(QuerySupport)(THIS_ REFGUID PropertySetId,ULONG PropertyId,PULONG pSupport) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsDriverPropertySet_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsDriverPropertySet_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsDriverPropertySet_Release(p) (p)->lpVtbl->Release(p)
/*** IDsDriverPropertySet methods ***/
#define IDsDriverPropertySet_Get(p,a,b,c,d,e,f) (p)->lpVtbl->Get(p,a,b,c,d,e,f)
#define IDsDriverPropertySet_Set(p,a,b,c,d,e) (p)->lpVtbl->Set(p,a,b,c,d,e)
#define IDsDriverPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c)
#endif
/* Defined property sets */
DEFINE_GUID(DSPROPSETID_DirectSound3DListener, 0x6D047B40, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
typedef enum
{
DSPROPERTY_DIRECTSOUND3DLISTENER_ALL,
DSPROPERTY_DIRECTSOUND3DLISTENER_POSITION,
DSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY,
DSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION,
DSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR,
DSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR,
DSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR,
DSPROPERTY_DIRECTSOUND3DLISTENER_BATCH,
DSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION
} DSPROPERTY_DIRECTSOUND3DLISTENER;
DEFINE_GUID(DSPROPSETID_DirectSound3DBuffer, 0x6D047B41, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
typedef enum
{
DSPROPERTY_DIRECTSOUND3DBUFFER_ALL,
DSPROPERTY_DIRECTSOUND3DBUFFER_POSITION,
DSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY,
DSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES,
DSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION,
DSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME,
DSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE,
DSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE,
DSPROPERTY_DIRECTSOUND3DBUFFER_MODE
} DSPROPERTY_DIRECTSOUND3DBUFFER;
DEFINE_GUID(DSPROPSETID_DirectSoundSpeakerConfig, 0x6D047B42, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
typedef enum
{
DSPROPERTY_DIRECTSOUNDSPEAKERCONFIG_SPEAKERCONFIG
} DSPROPERTY_DIRECTSOUNDSPEAKERCONFIG;
/*****************************************************************************
* IDsDriverNotify interface
*/
#define INTERFACE IDsDriverNotify
DECLARE_INTERFACE_(IDsDriverNotify,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsDriverNotify methods ***/
STDMETHOD(SetNotificationPositions)(THIS_ DWORD dwPositionNotifies,LPCDSBPOSITIONNOTIFY pcPositionNotifies) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsDriverNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsDriverNotify_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsDriverNotify_Release(p) (p)->lpVtbl->Release(p)
/*** IDsDriverNotify methods ***/
#define IDsDriverNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b)
#endif
/*****************************************************************************
* IDsCaptureDriver interface
*/
#define INTERFACE IDsCaptureDriver
DECLARE_INTERFACE_(IDsCaptureDriver,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsCaptureDriver methods ***/
STDMETHOD(GetDriverDesc)(THIS_ PDSDRIVERDESC pDsDriverDesc) PURE;
STDMETHOD(Open)(THIS) PURE;
STDMETHOD(Close)(THIS) PURE;
STDMETHOD(GetCaps)(THIS_ PDSCDRIVERCAPS pDsDrvCaps) PURE;
STDMETHOD(CreateCaptureBuffer)(THIS_ LPWAVEFORMATEX pwfx,DWORD dwFlags,DWORD dwCardAddress,LPDWORD pdwcbBufferSize,LPBYTE *ppbBuffer,LPVOID *ppvObj) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsCaptureDriver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsCaptureDriver_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsCaptureDriver_Release(p) (p)->lpVtbl->Release(p)
/*** IDsCaptureDriver methods ***/
#define IDsCaptureDriver_GetDriverDesc(p,a) (p)->lpVtbl->GetDriverDesc(p,a)
#define IDsCaptureDriver_Open(p) (p)->lpVtbl->Open(p)
#define IDsCaptureDriver_Close(p) (p)->lpVtbl->Close(p)
#define IDsCaptureDriver_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDsCaptureDriver_CreateCaptureBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c,d,e,f)
#endif
/*****************************************************************************
* IDsCaptureDriverBuffer interface
*/
#define INTERFACE IDsCaptureDriverBuffer
DECLARE_INTERFACE_(IDsCaptureDriverBuffer,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDsCaptureDriverBuffer methods ***/
STDMETHOD(Lock)(THIS_ LPVOID *ppvAudio1,LPDWORD pdwLen1,LPVOID *ppvAudio2,LPDWORD pdwLen2,DWORD dwWritePosition,DWORD dwWriteLen,DWORD dwFlags) PURE;
STDMETHOD(Unlock)(THIS_ LPVOID pvAudio1,DWORD dwLen1,LPVOID pvAudio2,DWORD dwLen2) PURE;
STDMETHOD(SetFormat)(THIS_ LPWAVEFORMATEX pwfxToSet) PURE;
STDMETHOD(GetPosition)(THIS_ LPDWORD lpdwCurrentPlayCursor,LPDWORD lpdwCurrentWriteCursor) PURE;
STDMETHOD(GetStatus)(THIS_ LPDWORD lpdwStatus) PURE;
STDMETHOD(Start)(THIS_ DWORD dwFlags) PURE;
STDMETHOD(Stop)(THIS) PURE;
};
#undef INTERFACE
#if !defined (__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDsCaptureDriverBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDsCaptureDriverBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDsCaptureDriverBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** IDsCaptureDriverBuffer methods ***/
#define IDsCaptureDriverBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g)
#define IDsCaptureDriverBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d)
#define IDsCaptureDriverBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
#define IDsCaptureDriverBuffer_GetPosition(p,a,b) (p)->lpVtbl->GetPosition(p,a,b)
#define IDsCaptureDriverBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a)
#define IDsCaptureDriverBuffer_Start(p,a) (p)->lpVtbl->Start(p,a)
#define IDsCaptureDriverBuffer_Stop(p) (p)->lpVtbl->Stop(p)
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WINE_DSDRIVER_H */