Commit b1fdaa81 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dsound: Remove hardware acceleration support.

parent a773b16d
......@@ -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");
}
......
......@@ -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);
......
......@@ -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';
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
wName, sizeof(wName)/sizeof(WCHAR) );
wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '\0';
debugstr_guid(&DSOUND_renderer_guids[wod]),
wine_dbgstr_w(caps.szPname),"winmm.dll",lpContext);
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);
......
......@@ -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;
};
/*****************************************************************************
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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)
{
......
......@@ -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 */
......
......@@ -50,7 +50,6 @@
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
#include "dsdriver.h"
#include "wine/debug.h"
#include <alsa/asoundlib.h>
......
......@@ -42,7 +42,6 @@
#include "endpointvolume.h"
#include "audioclient.h"
#include "audiopolicy.h"
#include "dsdriver.h"
#include <alsa/asoundlib.h>
......
......@@ -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;
......
......@@ -248,7 +248,6 @@ SRCDIR_INCLUDES = \
dplobby8.h \
dpnathlp.h \
dsconf.h \
dsdriver.h \
dsgetdc.h \
dshow.h \
dsound.h \
......
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