Commit 4354be12 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dsound: Don't derive the secondary position from the primary position.

parent f393a98a
......@@ -516,15 +516,12 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuff
{
IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface);
HRESULT hres = DS_OK;
DWORD oldpos;
TRACE("(%p,%d)\n",This,newpos);
/* **** */
RtlAcquireResourceExclusive(&This->lock, TRUE);
oldpos = This->sec_mixpos;
/* start mixing from this new location instead */
newpos %= This->buflen;
newpos -= newpos%This->pwfx->nBlockAlign;
......@@ -533,10 +530,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuff
/* at this point, do not attempt to reset buffers, mess with primary mix position,
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 (oldpos != newpos)
This->buf_mixpos = DSOUND_secpos_to_bufpos(This, newpos, 0, NULL);
RtlReleaseResource(&This->lock);
/* **** */
......@@ -909,7 +902,7 @@ HRESULT IDirectSoundBufferImpl_Create(
/* It's not necessary to initialize values to zero since */
/* we allocated this structure with HEAP_ZERO_MEMORY... */
dsb->buf_mixpos = dsb->sec_mixpos = 0;
dsb->sec_mixpos = 0;
dsb->state = STATE_STOPPED;
dsb->freqAdjust = dsb->freq / (float)device->pwfx->nSamplesPerSec;
......@@ -1024,7 +1017,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
dsb->refiks = 0;
dsb->numIfaces = 0;
dsb->state = STATE_STOPPED;
dsb->buf_mixpos = dsb->sec_mixpos = 0;
dsb->sec_mixpos = 0;
dsb->notifies = NULL;
dsb->nrofnotifies = 0;
dsb->device = device;
......
......@@ -178,14 +178,15 @@ struct IDirectSoundBufferImpl
DWORD playflags,state,leadin;
DWORD writelead,buflen;
DWORD nAvgBytesPerSec;
DWORD freq, tmp_buffer_len;
DWORD freq;
DSVOLUMEPAN volpan;
DSBUFFERDESC dsbd;
/* used for frequency conversion (PerfectPitch) */
ULONG freqneeded;
float freqAcc, freqAccNext, freqAdjust;
float freqAcc, freqAdjust;
/* used for mixing */
DWORD primary_mixpos, buf_mixpos, sec_mixpos;
DWORD primary_mixpos, sec_mixpos;
/* IDirectSoundNotify fields */
LPDSBPOSITIONNOTIFY notifies;
int nrofnotifies;
......
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