Commit fdebace9 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Fix buffering problems in HEL mode.

parent 909bcde2
......@@ -2047,6 +2047,11 @@ static HRESULT WINAPI IDirectSoundImpl_CreateSoundBuffer(
primarybuf->dsbd.dwFlags = dsbd->dwFlags;
return DS_OK;
} /* Else create primary buffer */
} else {
if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
ERR("invalid sound buffer size %ld\n", dsbd->dwBufferBytes);
return DSERR_INVALIDPARAM; /* FIXME: which error? */
}
}
*ippdsb = (IDirectSoundBufferImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectSoundBufferImpl));
......@@ -3215,6 +3220,10 @@ static void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw
} else mixq = 0;
if (forced) mixq = DS_SND_QUEUE;
/* Make sure that we don't rewrite any fragments that have already been
written and are waiting to be played */
mixq = (dsound->pwqueue > mixq) ? 0 : (mixq - dsound->pwqueue);
/* output it */
for (; mixq; mixq--) {
waveOutWrite(dsound->hwo, dsound->pwave[dsound->pwwrite], sizeof(WAVEHDR));
......
......@@ -130,6 +130,8 @@ typedef struct _DSCAPS
#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 /* More accurate play cursor under emulation*/
#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000
#define DSBSIZE_MIN 4
#define DSBSIZE_MAX 0xFFFFFFF
#define DSBPAN_LEFT -10000
#define DSBPAN_RIGHT 10000
#define DSBVOLUME_MAX 0
......
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