- Timestamp:
- Mar 25, 2015 5:23:46 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99197
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r54947 r54949 48 48 typedef struct DSOUNDHOSTCFG 49 49 { 50 intcbBufferIn;51 intcbBufferOut;50 DWORD cbBufferIn; 51 DWORD cbBufferOut; 52 52 RTUUID uuidPlay; 53 53 LPCGUID pGuidPlay; … … 115 115 static void dsoundDevRemove(PDSOUNDDEV pDev); 116 116 117 static size_t dsoundRingDistance(size_t offEnd, size_t offBegin, size_tcSize)118 { 119 return offEnd >= offBegin ? offEnd - offBegin : cSize - offBegin + offEnd;117 static DWORD dsoundRingDistance(DWORD offEnd, DWORD offBegin, DWORD cSize) 118 { 119 return offEnd >= offBegin ? offEnd - offBegin : cSize - offBegin + offEnd; 120 120 } 121 121 … … 367 367 static int dsoundPlayOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut) 368 368 { 369 DSLOG(("DSound: playback open %p size % d bytes, freq %d, chan %d, bits %d, sign %d\n",369 DSLOG(("DSound: playback open %p size %u bytes, freq %u, chan %u, bits %u, sign %d\n", 370 370 pDSoundStrmOut, 371 371 pThis->cfg.cbBufferOut, … … 696 696 static int dsoundCaptureOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn) 697 697 { 698 DSLOG(("DSound: capture open %p size % d bytes freq %d, chan %d, bits %d, sign %d\n",698 DSLOG(("DSound: capture open %p size %u bytes freq %u, chan %u, bits %u, sign %d\n", 699 699 pDSoundStrmIn, 700 700 pThis->cfg.cbBufferIn, … … 792 792 if (bc.dwBufferBytes != pThis->cfg.cbBufferIn) 793 793 { 794 DSLOGREL(("DSound: buffer size mismatch dsound % d, requested %dbytes\n",794 DSLOGREL(("DSound: buffer size mismatch dsound %u, requested %u bytes\n", 795 795 bc.dwBufferBytes, pThis->cfg.cbBufferIn)); 796 796 } … … 1075 1075 1076 1076 int cShift = pHstStrmOut->Props.cShift; 1077 intcbBuffer = pDSoundStrmOut->csPlaybackBufferSize << cShift;1077 DWORD cbBuffer = pDSoundStrmOut->csPlaybackBufferSize << cShift; 1078 1078 1079 1079 DWORD cbPlayPos, cbWritePos; … … 1106 1106 } 1107 1107 1108 intcbFree;1108 DWORD cbFree; 1109 1109 DWORD cbPlayWritePos; 1110 1110 if (pDSoundStrmOut->fReinitPlayPos) … … 1115 1115 1116 1116 cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos; 1117 cbFree = cbBuffer - (int)dsoundRingDistance(cbWritePos, cbPlayPos, cbBuffer);1117 cbFree = cbBuffer - dsoundRingDistance(cbWritePos, cbPlayPos, cbBuffer); 1118 1118 } 1119 1119 else … … 1128 1128 1129 1129 cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos; 1130 cbFree = (int)dsoundRingDistance(cbPlayPos, cbPlayWritePos, cbBuffer);1130 cbFree = dsoundRingDistance(cbPlayPos, cbPlayWritePos, cbBuffer); 1131 1131 } 1132 1132 1133 1133 uint32_t csLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */); 1134 int cbLive = csLive << cShift;1134 uint32_t cbLive = csLive << cShift; 1135 1135 1136 1136 /* Do not write more than available space in the DirectSound playback buffer. */ … … 1138 1138 1139 1139 cbLive &= ~pHstStrmOut->Props.uAlign; 1140 if (cbLive <= 0 || cbLive > cbBuffer)1140 if (cbLive == 0 || cbLive > cbBuffer) 1141 1141 { 1142 1142 DSLOG(("DSound: cbLive=%d cbBuffer=%d cbPlayWritePos=%d cbPlayPos=%d\n", … … 1354 1354 1355 1355 /* Get number of free samples in the mix buffer and check that is has free space */ 1356 size_t csMixFree = audioMixBufFree(&pHstStrmIn->MixBuf);1356 uint32_t csMixFree = audioMixBufFree(&pHstStrmIn->MixBuf); 1357 1357 if (csMixFree == 0) 1358 1358 { … … 1363 1363 } 1364 1364 1365 LogFlow(("DSound: CaptureIn csMixFree = % d, csReadPos = %d, csCaptureReadPos = %d, csCaptured = %d\n",1365 LogFlow(("DSound: CaptureIn csMixFree = %u, csReadPos = %d, csCaptureReadPos = %d, csCaptured = %u\n", 1366 1366 csMixFree, csReadPos, pDSoundStrmIn->csCaptureReadPos, csCaptured)); 1367 1367 … … 1568 1568 static void dSoundConfigInit(PDRVHOSTDSOUND pThis, PCFGMNODE pCfg) 1569 1569 { 1570 CFGMR3QuerySIntDef(pCfg, "BufsizeOut", &pThis->cfg.cbBufferOut, _16K); 1571 CFGMR3QuerySIntDef(pCfg, "BufsizeIn", &pThis->cfg.cbBufferIn, _16K); 1570 uint32_t uBufsizeOut, uBufsizeIn; 1571 1572 CFGMR3QueryUIntDef(pCfg, "BufsizeOut", &uBufsizeOut, _16K); 1573 CFGMR3QueryUIntDef(pCfg, "BufsizeIn", &uBufsizeIn, _16K); 1574 pThis->cfg.cbBufferOut = uBufsizeOut; 1575 pThis->cfg.cbBufferIn = uBufsizeIn; 1572 1576 1573 1577 pThis->cfg.pGuidPlay = dsoundConfigQueryGUID(pCfg, "DeviceGuidOut", &pThis->cfg.uuidPlay);
Note:
See TracChangeset
for help on using the changeset viewer.