Changeset 70840 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jan 31, 2018 4:06:48 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120652
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r70839 r70840 803 803 804 804 805 static void dsoundPlayClear Samples(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)805 static void dsoundPlayClearBuffer(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 806 806 { 807 807 AssertPtrReturnVoid(pStreamDS); … … 810 810 PPDMAUDIOPCMPROPS pProps = &pStreamDS->pCfg->Props; 811 811 812 PVOID pv1, pv2; 813 DWORD cb1, cb2; 814 HRESULT hr = directSoundPlayLock(pThis, pStreamDS, 815 0 /* dwOffset */, pStreamDS->Out.cbBufSize, 816 &pv1, &pv2, &cb1, &cb2, DSBLOCK_ENTIREBUFFER); 812 HRESULT hr = IDirectSoundBuffer_SetCurrentPosition(pStreamDS->Out.pDSB, 0 /* Position */); 813 if (FAILED(hr)) 814 DSLOGREL(("DSound: Setting current position to 0 when clearing buffer failed with %Rhrc\n", hr)); 815 816 PVOID pv1; 817 hr = directSoundPlayLock(pThis, pStreamDS, 818 0 /* dwOffset */, pStreamDS->Out.cbBufSize, 819 &pv1, NULL, 0, 0, DSBLOCK_ENTIREBUFFER); 817 820 if (SUCCEEDED(hr)) 818 821 { 819 D WORD len1 = PDMAUDIOPCMPROPS_B2F(pProps, cb1);820 DWORD len2 = PDMAUDIOPCMPROPS_B2F(pProps, cb2); 821 822 if (pv1 && len1) 823 DrvAudioHlpClearBuf(pProps, pv1, cb1, len1);824 825 if (pv2 && len2)826 DrvAudioHlpClearBuf(pProps, pv2, cb2, len2);827 828 directSoundPlayUnlock(pThis, pStreamDS->Out.pDSB, pv1, pv2, cb1, cb2);822 DrvAudioHlpClearBuf(pProps, pv1, pStreamDS->Out.cbBufSize, PDMAUDIOPCMPROPS_B2F(pProps, pStreamDS->Out.cbBufSize)); 823 824 directSoundPlayUnlock(pThis, pStreamDS->Out.pDSB, pv1, NULL, 0, 0); 825 826 /* Make sure to get the last playback position and current write position from DirectSound again. 827 * Those positions in theory could have changed, re-fetch them to be sure. */ 828 hr = IDirectSoundBuffer_GetCurrentPosition(pStreamDS->Out.pDSB, 829 &pStreamDS->Out.offPlayCursorLastPlayed, &pStreamDS->Out.offWritePos); 830 if (FAILED(hr)) 831 DSLOGREL(("DSound: Re-fetching current position when clearing buffer failed with %Rhrc\n", hr)); 829 832 } 830 833 } … … 917 920 else 918 921 { 919 dsoundPlayClear Samples(pThis, pStreamDS);922 dsoundPlayClearBuffer(pThis, pStreamDS); 920 923 921 924 pStreamDS->Out.fRestartPlayback = true;
Note:
See TracChangeset
for help on using the changeset viewer.