Module: wine Branch: master Commit: 6d965b8fb6cbb892662e5324155e6c5b2efb430d URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d965b8fb6cbb892662e532415...
Author: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Fri Mar 14 11:47:42 2008 -0700
quartz: Silence the directsound buffer on starting.
If the buffer is created and stopped, the contents of the buffer are indeterminate, by zeroing it you won't get leftovers from last play.
---
dlls/quartz/dsoundrender.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index af9fb37..6c5d3f1 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -498,6 +498,15 @@ static HRESULT WINAPI DSoundRender_Run(IBaseFilter * iface, REFERENCE_TIME tStar /* It's okay if there's no buffer yet. It'll start when it's created */ if (This->dsbuffer) { + if (This->state == State_Stopped) + { + char *buf1; + DWORD size1; + + IDirectSoundBuffer_Lock(This->dsbuffer, 0, 0, (void**)&buf1, &size1, NULL, NULL, DSBLOCK_ENTIREBUFFER); + memset(buf1, 0, size1); + IDirectSoundBuffer_Unlock(This->dsbuffer, buf1, size1, NULL, 0); + } hr = IDirectSoundBuffer_Play(This->dsbuffer, 0, 0, DSBPLAY_LOOPING); if (FAILED(hr)) ERR("Can't start playing! (%x)\n", hr);