Commit 1a23836f authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

dsound: Reset device playpos/mixpos on buflen change.

parent f2626bab
...@@ -100,6 +100,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device) ...@@ -100,6 +100,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
merr = DSERR_OUTOFMEMORY; merr = DSERR_OUTOFMEMORY;
/* but the old buffer might still exist and must be re-prepared */ /* but the old buffer might still exist and must be re-prepared */
} else { } else {
device->playpos = 0;
device->mixpos = 0;
device->buffer = newbuf; device->buffer = newbuf;
device->buflen = buflen; device->buflen = buflen;
} }
...@@ -139,6 +141,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device) ...@@ -139,6 +141,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
if ((err == DS_OK) && (merr != DS_OK)) if ((err == DS_OK) && (merr != DS_OK))
err = merr; err = merr;
} else if (!device->hwbuf) { } else if (!device->hwbuf) {
device->playpos = 0;
device->mixpos = 0;
err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx,
DSBCAPS_PRIMARYBUFFER,0, DSBCAPS_PRIMARYBUFFER,0,
&(device->buflen),&(device->buffer), &(device->buflen),&(device->buffer),
...@@ -190,6 +194,8 @@ HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device) ...@@ -190,6 +194,8 @@ HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device)
HRESULT err = DS_OK; HRESULT err = DS_OK;
TRACE("(%p)\n", device); TRACE("(%p)\n", device);
device->playpos = 0;
device->mixpos = 0;
device->buflen = device->pwfx->nAvgBytesPerSec; device->buflen = device->pwfx->nAvgBytesPerSec;
/* FIXME: verify that hardware capabilities (DSCAPS_PRIMARY flags) match */ /* FIXME: verify that hardware capabilities (DSCAPS_PRIMARY flags) match */
...@@ -299,6 +305,8 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device) ...@@ -299,6 +305,8 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD)device, device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD)device,
flags)); flags));
if (err == DS_OK) { if (err == DS_OK) {
device->playpos = 0;
device->mixpos = 0;
err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx,
DSBCAPS_PRIMARYBUFFER,0, DSBCAPS_PRIMARYBUFFER,0,
&(device->buflen),&(device->buffer), &(device->buflen),&(device->buffer),
...@@ -425,6 +433,8 @@ HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) ...@@ -425,6 +433,8 @@ HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex)
if (err == DSERR_BUFFERLOST) { if (err == DSERR_BUFFERLOST) {
/* Wine-only: the driver wants us to recreate the HW buffer */ /* Wine-only: the driver wants us to recreate the HW buffer */
IDsDriverBuffer_Release(device->hwbuf); IDsDriverBuffer_Release(device->hwbuf);
device->playpos = 0;
device->mixpos = 0;
err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx,
DSBCAPS_PRIMARYBUFFER,0, DSBCAPS_PRIMARYBUFFER,0,
&(device->buflen),&(device->buffer), &(device->buflen),&(device->buffer),
......
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