Changeset 57382 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Aug 17, 2015 12:11:08 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r57054 r57382 310 310 } 311 311 312 void audio_pcm_info_clear_buf(PPDMPCMPROPS pPCMInfo, void *pvBuf, int len) 313 { 314 if (!len) 312 void drvAudioClearBuf(PPDMPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf) 313 { 314 AssertPtrReturnVoid(pPCMInfo); 315 AssertPtrReturnVoid(pvBuf); 316 317 if (!cbBuf) 315 318 return; 316 319 317 320 if (pPCMInfo->fSigned) 318 321 { 319 memset (pvBuf, 0, len<< pPCMInfo->cShift);322 memset(pvBuf, 0, cbBuf << pPCMInfo->cShift); 320 323 } 321 324 else … … 325 328 326 329 case 8: 327 memset (pvBuf, 0x80, len<< pPCMInfo->cShift);330 memset(pvBuf, 0x80, cbBuf << pPCMInfo->cShift); 328 331 break; 329 332 330 333 case 16: 331 332 333 334 335 336 337 338 339 340 for (i = 0; i < len<< shift; i++)341 342 } 334 { 335 int i; 336 uint16_t *p = (uint16_t *)pvBuf; 337 int shift = pPCMInfo->cChannels - 1; 338 short s = INT16_MAX; 339 340 if (pPCMInfo->fSwapEndian) 341 s = RT_BSWAP_U16(s); 342 343 for (i = 0; i < cbBuf << shift; i++) 344 p[i] = s; 345 343 346 break; 347 } 344 348 345 349 case 32: 346 347 348 349 350 351 352 353 354 355 for (i = 0; i < len<< shift; i++)356 357 } 350 { 351 int i; 352 uint32_t *p = (uint32_t *)pvBuf; 353 int shift = pPCMInfo->cChannels - 1; 354 int32_t s = INT32_MAX; 355 356 if (pPCMInfo->fSwapEndian) 357 s = RT_BSWAP_U32(s); 358 359 for (i = 0; i < cbBuf << shift; i++) 360 p[i] = s; 361 358 362 break; 363 } 359 364 360 365 default: 361 LogFlowFunc(("audio_pcm_info_clear_buf: invalid bits %d\n", pPCMInfo->cBits));366 AssertMsgFailed(("Invalid bits: %RU8\n", pPCMInfo->cBits)); 362 367 break; 363 368 } … … 1479 1484 } 1480 1485 1481 pHstStrmOut->fPendingDisable = cGstStrmsActive == 1;1486 pHstStrmOut->fPendingDisable = cGstStrmsActive >= 1; 1482 1487 } 1483 1488 } -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r56292 r57382 145 145 /* Common functions between DrvAudio and backends (host audio drivers). */ 146 146 int drvAudioAttachCapture(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMOUT pHstStrmOut); 147 void drvAudioClearBuf(PPDMPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf); 147 148 void drvAudioDetachCapture(PPDMAUDIOHSTSTRMOUT pHstStrmOut); 148 149 uint32_t drvAudioHstOutSamplesLive(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcStreamsLive); 149 150 150 void audio_pcm_info_clear_buf(PPDMPCMPROPS pPCMInfo, void *pvBuf, int len);151 151 152 152 typedef struct fixed_settings -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r57375 r57382 498 498 499 499 if (pv1 && len1) 500 audio_pcm_info_clear_buf(&pDSoundStrmOut->strmOut.Props, pv1, len1);500 drvAudioClearBuf(&pDSoundStrmOut->strmOut.Props, pv1, len1); 501 501 502 502 if (pv2 && len2) 503 audio_pcm_info_clear_buf(&pDSoundStrmOut->strmOut.Props, pv2, len2);503 drvAudioClearBuf(&pDSoundStrmOut->strmOut.Props, pv2, len2); 504 504 505 505 dsoundUnlockOutput(pDSoundStrmOut->pDSB, pv1, pv2, cb1, cb2); -
trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp
r56992 r57382 353 353 case PDMAUDIOSTREAMCMD_ENABLE: 354 354 { 355 audio_pcm_info_clear_buf(&pHstStrmOut->Props,356 355 drvAudioClearBuf(&pHstStrmOut->Props, 356 pThisStrmOut->pvPCMBuf, AudioMixBufSize(&pHstStrmOut->MixBuf)); 357 357 358 358 mask = PCM_ENABLE_OUTPUT;
Note:
See TracChangeset
for help on using the changeset viewer.