Changeset 76992 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jan 25, 2019 2:02:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r76991 r76992 1019 1019 pStreamDS->Cfg.enmDir == PDMAUDIODIR_IN ? "capture" : "playback")); 1020 1020 1021 if (fEnable) 1022 dsoundStreamReset(pThis, pStreamDS); 1023 1021 1024 pStreamDS->fEnabled = fEnable; 1022 1025 … … 1045 1048 pStreamDS->In.offReadPos = 0; 1046 1049 pStreamDS->In.cOverruns = 0; 1050 1051 /* Also reset the DirectSound Capture Buffer (DSCB) by clearing all data to make sure 1052 * not stale audio data is left. */ 1053 if (pStreamDS->In.pDSCB) 1054 { 1055 PVOID pv1; PVOID pv2; DWORD cb1; DWORD cb2; 1056 HRESULT hr = directSoundCaptureLock(pStreamDS, 0 /* Offset */, pStreamDS->cbBufSize, &pv1, &pv2, &cb1, &cb2, 1057 0 /* Flags */); 1058 if (SUCCEEDED(hr)) 1059 { 1060 DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1)); 1061 if (pv2 && cb2) 1062 DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2)); 1063 directSoundCaptureUnlock(pStreamDS->In.pDSCB, pv1, pv2, cb1, cb2); 1064 } 1065 } 1047 1066 } 1048 1067 else if (pStreamDS->Cfg.enmDir == PDMAUDIODIR_OUT) … … 1061 1080 pStreamDS->Out.offPlayCursorLastPending = 0; 1062 1081 pStreamDS->Out.offPlayCursorLastPlayed = 0; 1082 1083 /* Also reset the DirectSound Buffer (DSB) by setting the position to 0 and clear all data to make sure 1084 * not stale audio data is left. */ 1085 if (pStreamDS->Out.pDSB) 1086 { 1087 HRESULT hr = IDirectSoundBuffer8_SetCurrentPosition(pStreamDS->Out.pDSB, 0); 1088 if (SUCCEEDED(hr)) 1089 { 1090 PVOID pv1; PVOID pv2; DWORD cb1; DWORD cb2; 1091 hr = directSoundPlayLock(pThis, pStreamDS, 0 /* Offset */, pStreamDS->cbBufSize, &pv1, &pv2, &cb1, &cb2, 1092 0 /* Flags */); 1093 if (SUCCEEDED(hr)) 1094 { 1095 DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1)); 1096 if (pv2 && cb2) 1097 DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2)); 1098 directSoundPlayUnlock(pThis, pStreamDS->Out.pDSB, pv1, pv2, cb1, cb2); 1099 } 1100 } 1101 } 1063 1102 } 1064 1103
Note:
See TracChangeset
for help on using the changeset viewer.