Changeset 87994 in vbox
- Timestamp:
- Mar 7, 2021 3:22:36 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r87991 r87994 1715 1715 break; 1716 1716 1717 const uint32_t cbChunk = DrvAudioHlpFramesToBytes( cfChunk, &pSink->PCMProps);1717 const uint32_t cbChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfChunk); 1718 1718 Assert(cbChunk <= pSink->cbScratchBuf); 1719 1719 … … 2119 2119 break; 2120 2120 2121 const uint32_t cbWrittenChunk = DrvAudioHlpFramesToBytes( cfWritten, &pSink->PCMProps);2121 const uint32_t cbWrittenChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfWritten); 2122 2122 2123 2123 Assert(cbToWrite >= cbWrittenChunk); -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r87993 r87994 204 204 uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 205 205 uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 206 uint32_t DrvAudioHlpFramesToBytes( uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps);206 uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames); 207 207 uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames); 208 208 uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r87993 r87994 137 137 138 138 Assert(pPCMProps->cbSample); 139 size_t cbToClear = DrvAudioHlpFramesToBytes( cFrames, pPCMProps);139 size_t cbToClear = DrvAudioHlpFramesToBytes(pPCMProps, cFrames); 140 140 Assert(cbBuf >= cbToClear); 141 141 … … 1324 1324 1325 1325 /** 1326 * Returns the bytes for a given audio frames amount and PCM properties.1327 * 1328 * @return Calculated bytes for given audio frames.1329 * @param cFrames Amount of audio frames to calculate bytes for.1330 * @param pProps PCM properties to calculate bytes for.1331 */ 1332 uint32_t DrvAudioHlpFramesToBytes( uint32_t cFrames, PCPDMAUDIOPCMPROPS pProps)1326 * Converts frames to bytes. 1327 * 1328 * @return Number of bytes. 1329 * @param pProps The PCM properties to use. 1330 * @param cFrames Number of audio frames to convert. 1331 */ 1332 uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames) 1333 1333 { 1334 1334 AssertPtrReturn(pProps, 0); 1335 1336 if (!cFrames) 1337 return 0; 1338 1339 return cFrames * PDMAUDIOPCMPROPS_F2B(pProps, 1 /* Frame */); 1335 return PDMAUDIOPCMPROPS_F2B(pProps, cFrames); 1340 1336 } 1341 1337 -
trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
r87300 r87994 1501 1501 Log2Func(("cFramesDelay=%RI32, enmState=%d, rc=%d\n", cFramesDelay, enmState, rc)); 1502 1502 1503 return DrvAudioHlpFramesToBytes( cFramesDelay, &pStreamALSA->pCfg->Props);1503 return DrvAudioHlpFramesToBytes(&pStreamALSA->pCfg->Props, cFramesDelay); 1504 1504 } 1505 1505 -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r87639 r87994 1305 1305 return VERR_GENERAL_FAILURE; /** @todo Fudge! */ 1306 1306 1307 const size_t cbBufSize = DrvAudioHlpFramesToBytes( pCAStream->pCfg->Backend.cFramesPeriod, &pCAStream->pCfg->Props);1307 const size_t cbBufSize = DrvAudioHlpFramesToBytes(&pCAStream->pCfg->Props, pCAStream->pCfg->Backend.cFramesPeriod); 1308 1308 1309 1309 /* -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r87991 r87994 666 666 */ 667 667 bd.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_LOCSOFTWARE; 668 bd.dwBufferBytes = DrvAudioHlpFramesToBytes( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);668 bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize); 669 669 670 670 DSLOG(("DSound: Requested playback buffer is %RU64ms (%ld bytes)\n", … … 895 895 896 896 if ( pStreamDS->Out.fFirstTransfer 897 && pStreamDS->Out.cbTransferred >= DrvAudioHlpFramesToBytes( pStreamDS->Cfg.Backend.cFramesPreBuffering, &pStreamDS->Cfg.Props))897 && pStreamDS->Out.cbTransferred >= DrvAudioHlpFramesToBytes(&pStreamDS->Cfg.Props, pStreamDS->Cfg.Backend.cFramesPreBuffering)) 898 898 { 899 899 hr = directSoundPlayStart(pThis, pStreamDS); … … 1401 1401 bd.dwSize = sizeof(bd); 1402 1402 bd.lpwfxFormat = &wfx; 1403 bd.dwBufferBytes = DrvAudioHlpFramesToBytes( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);1403 bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize); 1404 1404 1405 1405 DSLOG(("DSound: Requested capture buffer is %RU64ms (%ld bytes)\n", -
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r87993 r87994 803 803 pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */ 804 804 pStreamPA->BufAttr.prebuf = cbLatency; 805 pStreamPA->BufAttr.minreq = DrvAudioHlpFramesToBytes( pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props);805 pStreamPA->BufAttr.minreq = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod); 806 806 807 807 LogFunc(("Requested: BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n", … … 849 849 pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels; 850 850 851 pStreamPA->BufAttr.fragsize = DrvAudioHlpFramesToBytes( pCfgReq->Backend.cFramesPeriod, &pCfgReq->Props);851 pStreamPA->BufAttr.fragsize = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod); 852 852 pStreamPA->BufAttr.maxlength = -1; /* Let the PulseAudio server choose the biggest size it can handle. */ 853 853 -
trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp
r82968 r87994 145 145 pStreamDbg->uSamplesSinceStarted = 0; 146 146 pStreamDbg->Out.tsLastPlayed = 0; 147 pStreamDbg->Out.cbPlayBuffer = DrvAudioHlpFramesToBytes( pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);147 pStreamDbg->Out.cbPlayBuffer = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize); 148 148 pStreamDbg->Out.pu8PlayBuffer = (uint8_t *)RTMemAlloc(pStreamDbg->Out.cbPlayBuffer); 149 149 AssertReturn(pStreamDbg->Out.pu8PlayBuffer, VERR_NO_MEMORY); -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r87993 r87994 50 50 51 51 uint32_t u32; 52 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes( 44100, &s_Cfg441StereoS16)) == 44100 * 2 * 2,52 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2, 53 53 ("cb=%RU32\n", u32)); 54 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes( 2, &s_Cfg441StereoS16)) == 2 * 2 * 2,54 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2, 55 55 ("cb=%RU32\n", u32)); 56 56
Note:
See TracChangeset
for help on using the changeset viewer.