Module: wine Branch: master Commit: 1a23836f91c34f627c641256688f0e6fa22c1e0e URL: http://source.winehq.org/git/wine.git/?a=commit;h=1a23836f91c34f627c64125668...
Author: Alex Villacís Lasso a_villacis@palosanto.com Date: Mon Jun 25 13:15:08 2007 -0500
dsound: Reset device playpos/mixpos on buflen change.
---
dlls/dsound/primary.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 0068e5a..39c097a 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -100,6 +100,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device) merr = DSERR_OUTOFMEMORY; /* but the old buffer might still exist and must be re-prepared */ } else { + device->playpos = 0; + device->mixpos = 0; device->buffer = newbuf; device->buflen = buflen; } @@ -139,6 +141,8 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device) if ((err == DS_OK) && (merr != DS_OK)) err = merr; } else if (!device->hwbuf) { + device->playpos = 0; + device->mixpos = 0; err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, DSBCAPS_PRIMARYBUFFER,0, &(device->buflen),&(device->buffer), @@ -190,6 +194,8 @@ HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device) HRESULT err = DS_OK; TRACE("(%p)\n", device);
+ device->playpos = 0; + device->mixpos = 0; device->buflen = device->pwfx->nAvgBytesPerSec;
/* FIXME: verify that hardware capabilities (DSCAPS_PRIMARY flags) match */ @@ -299,6 +305,8 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device) device->pwfx, (DWORD_PTR)DSOUND_callback, (DWORD)device, flags)); if (err == DS_OK) { + device->playpos = 0; + device->mixpos = 0; err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, DSBCAPS_PRIMARYBUFFER,0, &(device->buflen),&(device->buffer), @@ -425,6 +433,8 @@ HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) if (err == DSERR_BUFFERLOST) { /* Wine-only: the driver wants us to recreate the HW buffer */ IDsDriverBuffer_Release(device->hwbuf); + device->playpos = 0; + device->mixpos = 0; err = IDsDriver_CreateSoundBuffer(device->driver,device->pwfx, DSBCAPS_PRIMARYBUFFER,0, &(device->buflen),&(device->buffer),