VirtualBox

Changeset 88022 in vbox


Ignore:
Timestamp:
Mar 8, 2021 5:50:57 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Preparing to move some of the DrvAudio.h stuff into PDM. bugref:9890

Location:
trunk/src/VBox
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioMixer.cpp

    r88016 r88022  
    656656    if (RT_SUCCESS(rc))
    657657    {
    658         rc = RTCircBufCreate(&pMixStream->pCircBuf, DrvAudioHlpMilliToBytes(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable. */
     658        rc = RTCircBufCreate(&pMixStream->pCircBuf, PDMAudioPropsMilliToBytes(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable. */
    659659        AssertRC(rc);
    660660    }
     
    10361036
    10371037    Log3Func(("[%s] cbWritable=%RU32 (%RU64ms)\n",
    1038               pSink->pszName, cbWritable, DrvAudioHlpBytesToMilli(&pSink->PCMProps, cbWritable)));
     1038              pSink->pszName, cbWritable, PDMAudioPropsBytesToMilli(&pSink->PCMProps, cbWritable)));
    10391039
    10401040    int rc2 = RTCritSectLeave(&pSink->CritSect);
     
    14751475        return rc;
    14761476
    1477     if (DrvAudioHlpPcmPropsAreEqual(&pSink->PCMProps, pPCMProps)) /* Bail out early if PCM properties are equal. */
     1477    if (PDMAudioPropsAreEqual(&pSink->PCMProps, pPCMProps)) /* Bail out early if PCM properties are equal. */
    14781478    {
    14791479        rc = RTCritSectLeave(&pSink->CritSect);
     
    14951495    AudioMixBufDestroy(&pSink->MixBuf);
    14961496    rc = AudioMixBufInit(&pSink->MixBuf, pSink->pszName, &pSink->PCMProps,
    1497                          DrvAudioHlpMilliToFrames(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable? */
     1497                         PDMAudioPropsMilliToFrames(&pSink->PCMProps, 100 /*ms*/)); /** @todo Make this configurable? */
    14981498    if (RT_SUCCESS(rc))
    14991499    {
     
    17151715            break;
    17161716
    1717         const uint32_t cbChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfChunk);
     1717        const uint32_t cbChunk = PDMAudioPropsFramesToBytes(&pSink->PCMProps, cfChunk);
    17181718        Assert(cbChunk <= pSink->cbScratchBuf);
    17191719
     
    21192119            break;
    21202120
    2121         const uint32_t cbWrittenChunk = DrvAudioHlpFramesToBytes(&pSink->PCMProps, cfWritten);
     2121        const uint32_t cbWrittenChunk = PDMAudioPropsFramesToBytes(&pSink->PCMProps, cfWritten);
    21222122
    21232123        Assert(cbToWrite >= cbWrittenChunk);
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r88015 r88022  
    16431643                Log3Func(("[SD%RU8] PICB=%zu (%RU64ms), cbFree=%zu (%RU64ms), cbTransferChunk=%zu (%RU64ms)\n",
    16441644                          pStream->u8SD,
    1645                           (pStream->Regs.picb << 1), DrvAudioHlpBytesToMilli(&pStreamCC->State.Cfg.Props, pStream->Regs.picb << 1),
    1646                           cbStreamFree, DrvAudioHlpBytesToMilli(&pStreamCC->State.Cfg.Props, cbStreamFree),
    1647                           pStreamCC->State.cbTransferChunk, DrvAudioHlpBytesToMilli(&pStreamCC->State.Cfg.Props, pStreamCC->State.cbTransferChunk)));
     1645                          (pStream->Regs.picb << 1), PDMAudioPropsBytesToMilli(&pStreamCC->State.Cfg.Props, pStream->Regs.picb << 1),
     1646                          cbStreamFree, PDMAudioPropsBytesToMilli(&pStreamCC->State.Cfg.Props, cbStreamFree),
     1647                          pStreamCC->State.cbTransferChunk, PDMAudioPropsBytesToMilli(&pStreamCC->State.Cfg.Props, pStreamCC->State.cbTransferChunk)));
    16481648
    16491649                /* Do the DMA transfer. */
     
    20882088        return 0;
    20892089
    2090     const uint64_t usBytes        = DrvAudioHlpBytesToMicro(&pStreamCC->State.Cfg.Props, cbBytes);
     2090    const uint64_t usBytes        = PDMAudioPropsBytesToMicro(&pStreamCC->State.Cfg.Props, cbBytes);
    20912091    const uint64_t cTransferTicks = PDMDevHlpTimerFromMicro(pDevIns, pStream->hTimer, usBytes);
    20922092
     
    22282228                }
    22292229
    2230                 rc = RTCircBufCreate(&pStreamCC->State.pCircBuf, DrvAudioHlpMilliToBytes(&Cfg.Props, 100 /*ms*/)); /** @todo Make this configurable. */
     2230                rc = RTCircBufCreate(&pStreamCC->State.pCircBuf, PDMAudioPropsMilliToBytes(&Cfg.Props, 100 /*ms*/)); /** @todo Make this configurable. */
    22312231                if (RT_SUCCESS(rc))
    22322232                {
     
    28122812
    28132813#ifdef VBOX_STRICT
    2814     const unsigned cbFrame = DrvAudioHlpBytesPerFrame(&pStreamCC->State.Cfg.Props);
     2814    const unsigned cbFrame = PDMAudioPropsBytesPerFrame(&pStreamCC->State.Cfg.Props);
    28152815#endif
    28162816
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88016 r88022  
    592592    if (CfgHostAcq.Backend.cFramesBufferSize != pCfgHost->Backend.cFramesBufferSize)
    593593        LogRel2(("Audio: Backend changed buffer size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    594                  DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesBufferSize), pCfgHost->Backend.cFramesBufferSize,
    595                  DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize));
     594                 PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesBufferSize), pCfgHost->Backend.cFramesBufferSize,
     595                 PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize), CfgHostAcq.Backend.cFramesBufferSize));
    596596
    597597    if (CfgHostAcq.Backend.cFramesPeriod != pCfgHost->Backend.cFramesPeriod)
    598598        LogRel2(("Audio: Backend changed period size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    599                  DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPeriod), pCfgHost->Backend.cFramesPeriod,
    600                  DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod), CfgHostAcq.Backend.cFramesPeriod));
     599                 PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPeriod), pCfgHost->Backend.cFramesPeriod,
     600                 PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod), CfgHostAcq.Backend.cFramesPeriod));
    601601
    602602    if (CfgHostAcq.Backend.cFramesPreBuffering != pCfgHost->Backend.cFramesPreBuffering)
    603603        LogRel2(("Audio: Backend changed pre-buffering size from %RU64ms (%RU32 frames) to %RU64ms (%RU32 frames)\n",
    604                  DrvAudioHlpFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPreBuffering), pCfgHost->Backend.cFramesPreBuffering,
    605                  DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering));
     604                 PDMAudioPropsFramesToMilli(&pCfgHost->Props, pCfgHost->Backend.cFramesPreBuffering), pCfgHost->Backend.cFramesPreBuffering,
     605                 PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering), CfgHostAcq.Backend.cFramesPreBuffering));
    606606    /*
    607607     * Configure host buffers.
     
    625625    }
    626626
    627     uint64_t msBufferSize = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize);
     627    uint64_t msBufferSize = PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesBufferSize);
    628628
    629629    LogRel2(("Audio: Buffer size of stream '%s' is %RU64ms (%RU32 frames)\n",
     
    631631
    632632    /* If no own pre-buffer is set, let the backend choose. */
    633     uint64_t msPreBuf = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering);
     633    uint64_t msPreBuf = PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPreBuffering);
    634634    LogRel2(("Audio: Pre-buffering size of stream '%s' is %RU64ms (%RU32 frames)\n",
    635635             pStream->szName, msPreBuf, CfgHostAcq.Backend.cFramesPreBuffering));
    636636
    637637    /* Make sure the configured buffer size by the backend at least can hold the configured latency. */
    638     const uint32_t msPeriod = DrvAudioHlpFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod);
     638    const uint32_t msPeriod = PDMAudioPropsFramesToMilli(&CfgHostAcq.Props, CfgHostAcq.Backend.cFramesPeriod);
    639639
    640640    LogRel2(("Audio: Period size of stream '%s' is %RU64ms (%RU32 frames)\n",
     
    668668        LogRel2(("Audio: Stream '%s' got a scheduling hint of %RU32ms (%RU32 bytes)\n",
    669669                 pStream->szName, pCfgGuest->Device.cMsSchedulingHint,
    670                  DrvAudioHlpMilliToBytes(&pCfgGuest->Props, pCfgGuest->Device.cMsSchedulingHint)));
     670                 PDMAudioPropsMilliToBytes(&pCfgGuest->Props, pCfgGuest->Device.cMsSchedulingHint)));
    671671
    672672    /* Destroy any former mixing buffer. */
     
    940940               pStream->szName, DrvAudioHlpAudDirToStr(pStream->enmDir)));
    941941
    942     AssertMsg(DrvAudioHlpIsBytesAligned(&pStream->Guest.Cfg.Props, cbBuf),
     942    AssertMsg(PDMAudioPropsIsSizeAligned(&pStream->Guest.Cfg.Props, cbBuf),
    943943              ("Stream '%s' got a non-frame-aligned write (%RU32 bytes)\n", pStream->szName, cbBuf));
    944944
     
    990990        if (cbFree < cbBuf)
    991991            LogRel2(("Audio: Lost audio output (%RU64ms, %RU32 free but needs %RU32) due to full host stream buffer '%s'\n",
    992                      DrvAudioHlpBytesToMilli(&pStream->Host.Cfg.Props, cbBuf - cbFree), cbFree, cbBuf, pStream->szName));
     992                     PDMAudioPropsBytesToMilli(&pStream->Host.Cfg.Props, cbBuf - cbFree), cbFree, cbBuf, pStream->szName));
    993993
    994994        uint32_t cbToWrite = RT_MIN(cbBuf, cbFree);
     
    10291029
    10301030                Log3Func(("[%s] Writing %RU32 frames (%RU64ms)\n",
    1031                           pStream->szName, cfGstWritten, DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfGstWritten)));
     1031                          pStream->szName, cfGstWritten, PDMAudioPropsFramesToMilli(&pStream->Guest.Cfg.Props, cfGstWritten)));
    10321032
    10331033                Log3Func(("[%s] Last written %RU64ns (%RU64ms), now filled with %RU64ms -- %RU8%%\n",
    10341034                          pStream->szName, tsNowNs - pStream->tsLastReadWrittenNs,
    10351035                          (tsNowNs - pStream->tsLastReadWrittenNs) / RT_NS_1MS,
    1036                           DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
     1036                          PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
    10371037                          AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf)));
    10381038
     
    15441544#endif
    15451545        const uint64_t tsDeltaPlayedCapturedNs = RTTimeNanoTS() - pStream->tsLastPlayedCapturedNs;
    1546         const uint32_t cfPassedReal            = DrvAudioHlpNanoToFrames(&pStream->Host.Cfg.Props, tsDeltaPlayedCapturedNs);
     1546        const uint32_t cfPassedReal            = PDMAudioPropsNanoToFrames(&pStream->Host.Cfg.Props, tsDeltaPlayedCapturedNs);
    15471547
    15481548        const uint32_t cFramesPeriod     = pStream->Host.Cfg.Backend.cFramesPeriod;
     
    15501550        Log3Func(("[%s] Last played %RU64ns (%RU64ms), filled with %RU64ms (%RU8%%) total (fThresholdReached=%RTbool)\n",
    15511551                  pStream->szName, tsDeltaPlayedCapturedNs, tsDeltaPlayedCapturedNs / RT_NS_1MS_64,
    1552                   DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), uLivePercent, pStream->fThresholdReached));
     1552                  PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive), uLivePercent, pStream->fThresholdReached));
    15531553
    15541554        if (   pStream->fThresholdReached         /* Has the treshold been reached (e.g. are we in playing stage) ... */
     
    15561556        {
    15571557            LogRel2(("Audio: Buffer underrun for stream '%s' occurred (%RU64ms passed)\n",
    1558                      pStream->szName, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal)));
     1558                     pStream->szName, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal)));
    15591559
    15601560            if (pStream->Host.Cfg.Backend.cFramesPreBuffering) /* Any pre-buffering configured? */
     
    16141614                /* Did we reach/pass (in real time) the device scheduling slot?
    16151615                 * Play as much as we can write to the backend then. */
    1616                 if (cfPassedReal >= DrvAudioHlpMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint))
     1616                if (cfPassedReal >= PDMAudioPropsMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint))
    16171617                    cfToPlay = cfWritable;
    16181618            }
     
    16221622#ifdef DEBUG
    16231623            Log3Func(("[%s] Playing %RU32 frames (%RU64ms), now filled with %RU64ms -- %RU8%%\n",
    1624                       pStream->szName, cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
    1625                       DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
     1624                      pStream->szName, cfToPlay, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
     1625                      PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, AudioMixBufUsed(&pStream->Host.MixBuf)),
    16261626                      AudioMixBufUsed(&pStream->Host.MixBuf) * 100 / AudioMixBufSize(&pStream->Host.MixBuf)));
    16271627#endif
     
    16521652                      "-> cfToPlay=%RU32 (%RU64ms), cfPlayed=%RU32 (%RU64ms)\n",
    16531653                      pStream->szName, fJustStarted,
    1654                       DrvAudioHlpMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint),
     1654                      PDMAudioPropsMilliToFrames(&pStream->Host.Cfg.Props, pStream->Guest.Cfg.Device.cMsSchedulingHint),
    16551655                      pStream->Guest.Cfg.Device.cMsSchedulingHint,
    1656                       cfPassedReal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal),
    1657                       cFramesLive, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive),
    1658                       cFramesPeriod, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cFramesPeriod),
    1659                       cfWritable, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfWritable),
    1660                       cfToPlay, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
    1661                       cfPlayedTotal, DrvAudioHlpFramesToMilli(&pStream->Host.Cfg.Props, cfPlayedTotal)));
     1656                      cfPassedReal, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfPassedReal),
     1657                      cFramesLive, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesLive),
     1658                      cFramesPeriod, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cFramesPeriod),
     1659                      cfWritable, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfWritable),
     1660                      cfToPlay, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfToPlay),
     1661                      cfPlayedTotal, PDMAudioPropsFramesToMilli(&pStream->Host.Cfg.Props, cfPlayedTotal)));
    16621662        }
    16631663
     
    25042504        {
    25052505            Log3Func(("[%s] Filling in silence (%RU64ms / %RU64ms)\n", pStream->szName,
    2506                       DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf - cfReadTotal),
    2507                       DrvAudioHlpFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf)));
    2508 
    2509             DrvAudioHlpClearBuf(&pStream->Guest.Cfg.Props,
    2510                                 (uint8_t *)pvBuf + AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfReadTotal),
    2511                                 AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfBuf - cfReadTotal),
    2512                                 cfBuf - cfReadTotal);
     2506                      PDMAudioPropsFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf - cfReadTotal),
     2507                      PDMAudioPropsFramesToMilli(&pStream->Guest.Cfg.Props, cfBuf)));
     2508
     2509            PDMAudioPropsClearBuffer(&pStream->Guest.Cfg.Props,
     2510                                     (uint8_t *)pvBuf + AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfReadTotal),
     2511                                     AUDIOMIXBUF_F2B(&pStream->Guest.MixBuf, cfBuf - cfReadTotal),
     2512                                     cfBuf - cfReadTotal);
    25132513
    25142514            cfReadTotal = cfBuf;
     
    29662966                || fDisabled)
    29672967            {
    2968                 cbReadable = DrvAudioHlpNanoToBytes(&pStream->Host.Cfg.Props, RTTimeNanoTS() - pStream->tsLastReadWrittenNs);
     2968                cbReadable = PDMAudioPropsNanoToBytes(&pStream->Host.Cfg.Props, RTTimeNanoTS() - pStream->tsLastReadWrittenNs);
    29692969                if (!(pStream->fWarningsShown & PDMAUDIOSTREAM_WARN_FLAGS_DISABLED))
    29702970                {
     
    29842984        /* Make sure to align the readable size to the guest's frame size. */
    29852985        if (cbReadable)
    2986             cbReadable = DrvAudioHlpFloorBytesToFrame(&pStream->Guest.Cfg.Props, cbReadable);
     2986            cbReadable = PDMAudioPropsFloorBytesToFrame(&pStream->Guest.Cfg.Props, cbReadable);
    29872987    }
    29882988
    29892989    Log3Func(("[%s] cbReadable=%RU32 (%RU64ms)\n",
    2990               pStream->szName, cbReadable, DrvAudioHlpBytesToMilli(&pStream->Host.Cfg.Props, cbReadable)));
     2990              pStream->szName, cbReadable, PDMAudioPropsBytesToMilli(&pStream->Host.Cfg.Props, cbReadable)));
    29912991
    29922992    rc2 = RTCritSectLeave(&pThis->CritSect);
     
    30213021
    30223022        /* Make sure to align the writable size to the host's frame size. */
    3023         cbWritable = DrvAudioHlpFloorBytesToFrame(&pStream->Host.Cfg.Props, cbWritable);
     3023        cbWritable = PDMAudioPropsFloorBytesToFrame(&pStream->Host.Cfg.Props, cbWritable);
    30243024    }
    30253025
    30263026    Log3Func(("[%s] cbWritable=%RU32 (%RU64ms)\n",
    3027               pStream->szName, cbWritable, DrvAudioHlpBytesToMilli(&pStream->Host.Cfg.Props, cbWritable)));
     3027              pStream->szName, cbWritable, PDMAudioPropsBytesToMilli(&pStream->Host.Cfg.Props, cbWritable)));
    30283028
    30293029    rc2 = RTCritSectLeave(&pThis->CritSect);
     
    32173217    if (pDrvCfg->uPeriodSizeMs)
    32183218    {
    3219         pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uPeriodSizeMs);
     3219        pCfgReq->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uPeriodSizeMs);
    32203220        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32213221    }
     
    32233223    if (!pCfgReq->Backend.cFramesPeriod) /* Set default period size if nothing explicitly is set. */
    32243224    {
    3225         pCfgReq->Backend.cFramesPeriod = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 150 /*ms*/);
     3225        pCfgReq->Backend.cFramesPeriod = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 150 /*ms*/);
    32263226        RTStrPrintf(szWhat, sizeof(szWhat), "default");
    32273227    }
    32283228
    32293229    LogRel2(("Audio: Using %s period size %RU64 ms / %RU32 frames for stream '%s'\n",
    3230              szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod),
     3230             szWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod),
    32313231             pCfgReq->Backend.cFramesPeriod, pStream->szName));
    32323232
     
    32363236    if (pDrvCfg->uBufferSizeMs)
    32373237    {
    3238         pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uBufferSizeMs);
     3238        pCfgReq->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uBufferSizeMs);
    32393239        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32403240    }
     
    32423242    if (!pCfgReq->Backend.cFramesBufferSize) /* Set default buffer size if nothing explicitly is set. */
    32433243    {
    3244         pCfgReq->Backend.cFramesBufferSize = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 300 /*ms*/);
     3244        pCfgReq->Backend.cFramesBufferSize = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 300 /*ms*/);
    32453245        RTStrPrintf(szWhat, sizeof(szWhat), "default");
    32463246    }
    32473247
    32483248    LogRel2(("Audio: Using %s buffer size %RU64 ms / %RU32 frames for stream '%s'\n",
    3249              szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
     3249             szWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
    32503250             pCfgReq->Backend.cFramesBufferSize, pStream->szName));
    32513251
     
    32553255    if (pDrvCfg->uPreBufSizeMs != UINT32_MAX) /* Anything set via global / per-VM extra-data? */
    32563256    {
    3257         pCfgReq->Backend.cFramesPreBuffering = DrvAudioHlpMilliToFrames(&pCfgReq->Props, pDrvCfg->uPreBufSizeMs);
     3257        pCfgReq->Backend.cFramesPreBuffering = PDMAudioPropsMilliToFrames(&pCfgReq->Props, pDrvCfg->uPreBufSizeMs);
    32583258        RTStrPrintf(szWhat, sizeof(szWhat), "custom");
    32593259    }
     
    32693269
    32703270    LogRel2(("Audio: Using %s pre-buffering size %RU64 ms / %RU32 frames for stream '%s'\n",
    3271              szWhat, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
     3271             szWhat, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
    32723272             pCfgReq->Backend.cFramesPreBuffering, pStream->szName));
    32733273
     
    32783278    {
    32793279        LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the period size (%RU64ms)\n",
    3280                 pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
    3281                 DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod)));
     3280                pStream->szName, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize),
     3281                PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod)));
    32823282        return VERR_INVALID_PARAMETER;
    32833283    }
     
    32893289        {
    32903290            LogRel(("Audio: Error for stream '%s': Buffering size (%RU64ms) must not be smaller than the pre-buffering size (%RU64ms)\n",
    3291                     pStream->szName, DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
    3292                     DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize)));
     3291                    pStream->szName, PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesPreBuffering),
     3292                    PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize)));
    32933293            return VERR_INVALID_PARAMETER;
    32943294        }
     
    33283328    if (pCfgAcq->Backend.cFramesBufferSize != pCfgReq->Backend.cFramesBufferSize)
    33293329        LogRel2(("Audio: Buffer size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3330                  pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
     3330                 pStream->szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesBufferSize), pCfgAcq->Backend.cFramesBufferSize));
    33313331
    33323332    if (pCfgAcq->Backend.cFramesPeriod != pCfgReq->Backend.cFramesPeriod)
    33333333        LogRel2(("Audio: Period size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3334                  pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod));
     3334                 pStream->szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPeriod), pCfgAcq->Backend.cFramesPeriod));
    33353335
    33363336    /* Was pre-buffering requested, but the acquired configuration from the backend told us something else? */
     
    33393339        if (pCfgAcq->Backend.cFramesPreBuffering != pCfgReq->Backend.cFramesPreBuffering)
    33403340            LogRel2(("Audio: Pre-buffering size overwritten by backend for stream '%s' (now %RU64ms, %RU32 frames)\n",
    3341                      pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
     3341                     pStream->szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    33423342
    33433343        if (pCfgAcq->Backend.cFramesPreBuffering > pCfgAcq->Backend.cFramesBufferSize)
     
    33453345            pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesBufferSize;
    33463346            LogRel2(("Audio: Pre-buffering size bigger than buffer size for stream '%s', adjusting to %RU64ms (%RU32 frames)\n",
    3347                      pStream->szName, DrvAudioHlpFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
     3347                     pStream->szName, PDMAudioPropsFramesToMilli(&pCfgAcq->Props, pCfgAcq->Backend.cFramesPreBuffering), pCfgAcq->Backend.cFramesPreBuffering));
    33483348        }
    33493349    }
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r88016 r88022  
    200200/** @name Audio PCM properties helper methods.
    201201 * @{ */
    202 void     DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);
    203 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps);
    204 uint32_t DrvAudioHlpFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    205 bool     DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    206 uint32_t DrvAudioHlpBytesPerFrame(PCPDMAUDIOPCMPROPS pProps);
    207 uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    208 uint64_t DrvAudioHlpBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    209 uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    210 uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
    211 uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    212 uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    213 uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
    214 uint32_t DrvAudioHlpMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
    215 uint32_t DrvAudioHlpNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
    216 uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
    217 uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
    218 
    219 bool     DrvAudioHlpPcmPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2);
     202void     PDMAudioPropsClearBuffer(PCPDMAUDIOPCMPROPS pProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);
     203uint32_t PDMAudioPropsGetBitrate(PCPDMAUDIOPCMPROPS pProps);
     204uint32_t PDMAudioPropsFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     205bool     PDMAudioPropsIsSizeAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     206uint32_t PDMAudioPropsBytesPerFrame(PCPDMAUDIOPCMPROPS pProps);
     207uint32_t PDMAudioPropsBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     208uint64_t PDMAudioPropsBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     209uint64_t PDMAudioPropsBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     210uint64_t PDMAudioPropsBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb);
     211uint32_t PDMAudioPropsFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
     212uint64_t PDMAudioPropsFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
     213uint64_t PDMAudioPropsFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames);
     214uint32_t PDMAudioPropsMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
     215uint32_t PDMAudioPropsNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
     216uint32_t PDMAudioPropsMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs);
     217uint32_t PDMAudioPropsNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs);
     218
     219bool     PDMAudioPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2);
     220void     PDMAudioPropsLog(PCPDMAUDIOPCMPROPS pProps);
     221
    220222bool     DrvAudioHlpPcmPropsAreValid(PCPDMAUDIOPCMPROPS pProps);
    221 void     DrvAudioHlpPcmPropsLog(PCPDMAUDIOPCMPROPS pProps);
    222223/** @}  */
    223224
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r88017 r88022  
    801801{
    802802    AssertPtrReturn(pCfg, false);
    803     return DrvAudioHlpPcmPropsAreEqual(pProps, &pCfg->Props);
     803    return PDMAudioPropsAreEqual(pProps, &pCfg->Props);
    804804}
    805805
     
    997997 * @param   pProps              PCM properties to calculate bitrate for.
    998998 */
    999 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps)
     999uint32_t PDMAudioPropsGetBitrate(PCPDMAUDIOPCMPROPS pProps)
    10001000{
    10011001    return DrvAudioHlpCalcBitrate(pProps->cbSample * 8, pProps->uHz, pProps->cChannels);
     
    10091009 * @param   cb          The size (in bytes) to round.
    10101010 */
    1011 uint32_t DrvAudioHlpFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1011uint32_t PDMAudioPropsFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    10121012{
    10131013    AssertPtrReturn(pProps, 0);
     
    10221022 * @param   cb          The size (in bytes) to check.
    10231023 */
    1024 bool DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1024bool PDMAudioPropsIsSizeAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    10251025{
    10261026    AssertPtrReturn(pProps, false);
     
    10371037 * @param   cb          The number of bytes to convert.
    10381038 */
    1039 uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1039uint32_t PDMAudioPropsBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    10401040{
    10411041    AssertPtrReturn(pProps, 0);
     
    10521052 * @note    Rounds up the result.
    10531053 */
    1054 uint64_t DrvAudioHlpBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1054uint64_t PDMAudioPropsBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    10551055{
    10561056    AssertPtrReturn(pProps, 0);
     
    10821082 * @note    Rounds up the result.
    10831083 */
    1084 uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1084uint64_t PDMAudioPropsBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    10851085{
    10861086    AssertPtrReturn(pProps, 0);
     
    11121112 * @note    Rounds up the result.
    11131113 */
    1114 uint64_t DrvAudioHlpBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
     1114uint64_t PDMAudioPropsBytesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cb)
    11151115{
    11161116    AssertPtrReturn(pProps, 0);
     
    11411141 * @sa      PDMAUDIOPCMPROPS_F2B
    11421142 */
    1143 uint32_t DrvAudioHlpFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
     1143uint32_t PDMAudioPropsFramesToBytes(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
    11441144{
    11451145    AssertPtrReturn(pProps, 0);
     
    11551155 * @note    No rounding here, result is floored.
    11561156 */
    1157 uint64_t DrvAudioHlpFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
     1157uint64_t PDMAudioPropsFramesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
    11581158{
    11591159    AssertPtrReturn(pProps, 0);
     
    11741174 * @note    No rounding here, result is floored.
    11751175 */
    1176 uint64_t DrvAudioHlpFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
     1176uint64_t PDMAudioPropsFramesToNano(PCPDMAUDIOPCMPROPS pProps, uint32_t cFrames)
    11771177{
    11781178    AssertPtrReturn(pProps, 0);
     
    11941194 * @note    The result is rounded rather than floored (hysterical raisins).
    11951195 */
    1196 uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
     1196uint32_t PDMAudioPropsMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
    11971197{
    11981198    AssertPtrReturn(pProps, 0);
     
    12201220 * @note    The result is rounded rather than floored (hysterical raisins).
    12211221 */
    1222 uint32_t DrvAudioHlpMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
    1223 {
    1224     return PDMAUDIOPCMPROPS_F2B(pProps, DrvAudioHlpMilliToFrames(pProps, cMs));
     1222uint32_t PDMAudioPropsMilliToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs)
     1223{
     1224    return PDMAUDIOPCMPROPS_F2B(pProps, PDMAudioPropsMilliToFrames(pProps, cMs));
    12251225}
    12261226
     
    12341234 * @note    The result is rounded rather than floored (hysterical raisins).
    12351235 */
    1236 uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
     1236uint32_t PDMAudioPropsNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
    12371237{
    12381238    AssertPtrReturn(pProps, 0);
     
    12601260 * @note    The result is rounded rather than floored (hysterical raisins).
    12611261 */
    1262 uint32_t DrvAudioHlpNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
    1263 {
    1264     return PDMAUDIOPCMPROPS_F2B(pProps, DrvAudioHlpNanoToFrames(pProps, cNs));
     1262uint32_t PDMAudioPropsNanoToBytes(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs)
     1263{
     1264    return PDMAUDIOPCMPROPS_F2B(pProps, PDMAudioPropsNanoToFrames(pProps, cNs));
    12651265}
    12661266
     
    12691269 * given by the PCM properties).
    12701270 *
    1271  * @param   pPCMProps               PCM properties to use for the buffer to clear.
    1272  * @param   pvBuf                   Buffer to clear.
    1273  * @param   cbBuf                   Size (in bytes) of the buffer.
    1274  * @param   cFrames                 Number of audio frames to clear in the buffer.
    1275  */
    1276 void DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames)
     1271 * @param   pProps      The PCM properties to apply.
     1272 * @param   pvBuf       The buffer to clear.
     1273 * @param   cbBuf       The buffer size in bytes.
     1274 * @param   cFrames     The number of audio frames to clear.  Capped at @a cbBuf
     1275 *                      if exceeding the buffer.  If the size is an unaligned
     1276 *                      number of frames, the extra bytes may be left
     1277 *                      uninitialized in some configurations.
     1278 */
     1279void PDMAudioPropsClearBuffer(PCPDMAUDIOPCMPROPS pProps, void *pvBuf, size_t cbBuf, uint32_t cFrames)
    12771280{
    12781281    /*
    12791282     * Validate input
    12801283     */
    1281     AssertPtrReturnVoid(pPCMProps);
    1282     Assert(pPCMProps->cbSample);
     1284    AssertPtrReturnVoid(pProps);
     1285    Assert(pProps->cbSample);
    12831286    if (!cbBuf || !cFrames)
    12841287        return;
    12851288    AssertPtrReturnVoid(pvBuf);
    12861289
    1287     Assert(pPCMProps->fSwapEndian == false); /** @todo Swapping Endianness is not supported yet. */
     1290    Assert(pProps->fSwapEndian == false); /** @todo Swapping Endianness is not supported yet. */
    12881291
    12891292    /*
    12901293     * Decide how much needs clearing.
    12911294     */
    1292     size_t cbToClear = DrvAudioHlpFramesToBytes(pPCMProps, cFrames);
     1295    size_t cbToClear = PDMAudioPropsFramesToBytes(pProps, cFrames);
    12931296    AssertStmt(cbToClear <= cbBuf, cbToClear = cbBuf);
    12941297
    1295     Log2Func(("pPCMProps=%p, pvBuf=%p, cFrames=%RU32, fSigned=%RTbool, cBytes=%RU8\n",
    1296               pPCMProps, pvBuf, cFrames, pPCMProps->fSigned, pPCMProps->cbSample));
     1298    Log2Func(("pProps=%p, pvBuf=%p, cFrames=%RU32, fSigned=%RTbool, cBytes=%RU8\n",
     1299              pProps, pvBuf, cFrames, pProps->fSigned, pProps->cbSample));
    12971300
    12981301    /*
    12991302     * Do the job.
    13001303     */
    1301     if (pPCMProps->fSigned)
     1304    if (pProps->fSigned)
    13021305        RT_BZERO(pvBuf, cbToClear);
    13031306    else /* Unsigned formats. */
    13041307    {
    1305         switch (pPCMProps->cbSample)
     1308        switch (pProps->cbSample)
    13061309        {
    13071310            case 1: /* 8 bit */
     
    13251328
    13261329            default:
    1327                 AssertMsgFailed(("Invalid bytes per sample: %RU8\n", pPCMProps->cbSample));
     1330                AssertMsgFailed(("Invalid bytes per sample: %RU8\n", pProps->cbSample));
    13281331        }
    13291332    }
     
    13371340 * @param   pProps2     The second set of properties to compare.
    13381341 */
    1339 bool DrvAudioHlpPcmPropsAreEqual(PCPDMAUDIOPCMPROPS pProps1, PCPDMAUDIOPCMPROPS pProps2)
     1342bool PDMAudioPropsAreEqual(PCPDMAUDIOPCMPROPS pProps1, PCPDMAUDIOPCMPROPS pProps2)
    13401343{
    13411344    AssertPtrReturn(pProps1, false);
     
    14161419 * @sa      PDMAUDIOPCMPROPS_F2B
    14171420 */
    1418 uint32_t DrvAudioHlpBytesPerFrame(PCPDMAUDIOPCMPROPS pProps)
     1421uint32_t PDMAudioPropsBytesPerFrame(PCPDMAUDIOPCMPROPS pProps)
    14191422{
    14201423    return PDMAUDIOPCMPROPS_F2B(pProps, 1 /*cFrames*/);
     
    14261429 * @param   pProps              Stream configuration to log.
    14271430 */
    1428 void DrvAudioHlpPcmPropsLog(PCPDMAUDIOPCMPROPS pProps)
     1431void PDMAudioPropsLog(PCPDMAUDIOPCMPROPS pProps)
    14291432{
    14301433    AssertPtrReturnVoid(pProps);
     
    17141717            pData->Hdr.u16NumChannels   = pProps->cChannels;
    17151718            pData->Hdr.u32SampleRate    = pProps->uHz;
    1716             pData->Hdr.u32ByteRate      = DrvAudioHlpGetBitrate(pProps) / 8;
     1719            pData->Hdr.u32ByteRate      = PDMAudioPropsGetBitrate(pProps) / 8;
    17171720            pData->Hdr.u16BlockAlign    = pProps->cChannels * pProps->cbSample;
    17181721            pData->Hdr.u16BitsPerSample = pProps->cbSample * 8;
  • trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp

    r88009 r88022  
    999999        pCfgAcq->Backend.cFramesPreBuffering     = obt.threshold;
    10001000
    1001         pStreamALSA->cbBuf = pCfgAcq->Backend.cFramesBufferSize * DrvAudioHlpBytesPerFrame(&pCfgAcq->Props);
     1001        pStreamALSA->cbBuf = pCfgAcq->Backend.cFramesBufferSize * PDMAudioPropsBytesPerFrame(&pCfgAcq->Props);
    10021002        pStreamALSA->pvBuf = RTMemAllocZ(pStreamALSA->cbBuf);
    10031003        if (!pStreamALSA->pvBuf)
     
    10391039        req.freq        = pCfgReq->Props.uHz;
    10401040        req.nchannels   = pCfgReq->Props.cChannels;
    1041         req.period_size = DrvAudioHlpMilliToFrames(&pCfgReq->Props, 50 /*ms*/); /** @todo Make this configurable. */
     1041        req.period_size = PDMAudioPropsMilliToFrames(&pCfgReq->Props, 50 /*ms*/); /** @todo Make this configurable. */
    10421042        req.buffer_size = req.period_size * 2; /** @todo Make this configurable. */
    10431043        req.threshold   = req.period_size;
     
    10591059        /* No pre-buffering. */
    10601060
    1061         pStreamALSA->cbBuf = pCfgAcq->Backend.cFramesBufferSize * DrvAudioHlpBytesPerFrame(&pCfgAcq->Props);
     1061        pStreamALSA->cbBuf = pCfgAcq->Backend.cFramesBufferSize * PDMAudioPropsBytesPerFrame(&pCfgAcq->Props);
    10621062        pStreamALSA->pvBuf = RTMemAlloc(pStreamALSA->cbBuf);
    10631063        if (!pStreamALSA->pvBuf)
     
    15011501    Log2Func(("cFramesDelay=%RI32, enmState=%d, rc=%d\n", cFramesDelay, enmState, rc));
    15021502
    1503     return DrvAudioHlpFramesToBytes(&pStreamALSA->pCfg->Props, cFramesDelay);
     1503    return PDMAudioPropsFramesToBytes(&pStreamALSA->pCfg->Props, cFramesDelay);
    15041504}
    15051505
  • trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp

    r87994 r88022  
    13051305        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
    13061306
    1307     const size_t cbBufSize = DrvAudioHlpFramesToBytes(&pCAStream->pCfg->Props, pCAStream->pCfg->Backend.cFramesPeriod);
     1307    const size_t cbBufSize = PDMAudioPropsFramesToBytes(&pCAStream->pCfg->Props, pCAStream->pCfg->Backend.cFramesPeriod);
    13081308
    13091309    /*
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r87994 r88022  
    666666         */
    667667        bd.dwFlags       = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_LOCSOFTWARE;
    668         bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
     668        bd.dwBufferBytes = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    669669
    670670        DSLOG(("DSound: Requested playback buffer is %RU64ms (%ld bytes)\n",
    671                DrvAudioHlpBytesToMilli(&pCfgReq->Props, bd.dwBufferBytes), bd.dwBufferBytes));
     671               PDMAudioPropsBytesToMilli(&pCfgReq->Props, bd.dwBufferBytes), bd.dwBufferBytes));
    672672
    673673        hr = IDirectSound8_CreateSoundBuffer(pThis->pDS, &bd, &pDSB, NULL);
     
    711711
    712712        DSLOG(("DSound: Acquired playback buffer is %RU64ms (%ld bytes)\n",
    713                DrvAudioHlpBytesToMilli(&pCfgReq->Props, bc.dwBufferBytes), bc.dwBufferBytes));
     713               PDMAudioPropsBytesToMilli(&pCfgReq->Props, bc.dwBufferBytes), bc.dwBufferBytes));
    714714
    715715        DSLOG(("DSound: Acquired playback format:\n"
     
    779779    if (SUCCEEDED(hr))
    780780    {
    781         DrvAudioHlpClearBuf(pProps, pv1, pStreamDS->cbBufSize, PDMAUDIOPCMPROPS_B2F(pProps, pStreamDS->cbBufSize));
     781        PDMAudioPropsClearBuffer(pProps, pv1, pStreamDS->cbBufSize, PDMAUDIOPCMPROPS_B2F(pProps, pStreamDS->cbBufSize));
    782782
    783783        directSoundPlayUnlock(pThis, pStreamDS->Out.pDSB, pv1, NULL, 0, 0);
     
    895895
    896896    if (   pStreamDS->Out.fFirstTransfer
    897         && pStreamDS->Out.cbTransferred >= DrvAudioHlpFramesToBytes(&pStreamDS->Cfg.Props, pStreamDS->Cfg.Backend.cFramesPreBuffering))
     897        && pStreamDS->Out.cbTransferred >= PDMAudioPropsFramesToBytes(&pStreamDS->Cfg.Props, pStreamDS->Cfg.Backend.cFramesPreBuffering))
    898898    {
    899899        hr = directSoundPlayStart(pThis, pStreamDS);
     
    10411041            if (SUCCEEDED(hr))
    10421042            {
    1043                 DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1));
     1043                PDMAudioPropsClearBuffer(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1));
    10441044                if (pv2 && cb2)
    1045                     DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2));
     1045                    PDMAudioPropsClearBuffer(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2));
    10461046                directSoundCaptureUnlock(pStreamDS->In.pDSCB, pv1, pv2, cb1, cb2);
    10471047            }
     
    10761076                if (SUCCEEDED(hr))
    10771077                {
    1078                     DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1));
     1078                    PDMAudioPropsClearBuffer(&pStreamDS->Cfg.Props, pv1, cb1, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb1));
    10791079                    if (pv2 && cb2)
    1080                         DrvAudioHlpClearBuf(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2));
     1080                        PDMAudioPropsClearBuffer(&pStreamDS->Cfg.Props, pv2, cb2, PDMAUDIOPCMPROPS_B2F(&pStreamDS->Cfg.Props, cb2));
    10811081                    directSoundPlayUnlock(pThis, pStreamDS->Out.pDSB, pv1, pv2, cb1, cb2);
    10821082                }
     
    14011401        bd.dwSize        = sizeof(bd);
    14021402        bd.lpwfxFormat   = &wfx;
    1403         bd.dwBufferBytes = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
     1403        bd.dwBufferBytes = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    14041404
    14051405        DSLOG(("DSound: Requested capture buffer is %RU64ms (%ld bytes)\n",
    1406                DrvAudioHlpBytesToMilli(&pCfgReq->Props, bd.dwBufferBytes), bd.dwBufferBytes));
     1406               PDMAudioPropsBytesToMilli(&pCfgReq->Props, bd.dwBufferBytes), bd.dwBufferBytes));
    14071407
    14081408        LPDIRECTSOUNDCAPTUREBUFFER pDSCB;
     
    14571457
    14581458        DSLOG(("DSound: Acquired capture buffer is %RU64ms (%ld bytes)\n",
    1459                DrvAudioHlpBytesToMilli(&pCfgReq->Props, bc.dwBufferBytes), bc.dwBufferBytes));
     1459               PDMAudioPropsBytesToMilli(&pCfgReq->Props, bc.dwBufferBytes), bc.dwBufferBytes));
    14601460
    14611461        DSLOG(("DSound: Capture format:\n"
     
    25002500        {
    25012501            const uint64_t diffLastTransferredMs  = RTTimeMilliTS() - pStreamDS->Out.tsLastTransferredMs;
    2502             const uint64_t uLastTranserredChunkMs = DrvAudioHlpBytesToMilli(&pStreamDS->Cfg.Props, pStreamDS->Out.cbLastTransferred);
     2502            const uint64_t uLastTranserredChunkMs = PDMAudioPropsBytesToMilli(&pStreamDS->Cfg.Props, pStreamDS->Out.cbLastTransferred);
    25032503            if (   uLastTranserredChunkMs
    25042504                && diffLastTransferredMs < uLastTranserredChunkMs)
  • trunk/src/VBox/Devices/Audio/DrvHostDebugAudio.cpp

    r88002 r88022  
    349349    AssertPtr(pStreamDbg->pCfg);
    350350
    351     return DrvAudioHlpMilliToBytes(&pStreamDbg->pCfg->Props, 10 /*ms*/);
     351    return PDMAudioPropsMilliToBytes(&pStreamDbg->pCfg->Props, 10 /*ms*/);
    352352}
    353353
  • trunk/src/VBox/Devices/Audio/DrvHostNullAudio.cpp

    r82968 r88022  
    168168    /* Return silence. */
    169169    Assert(pStreamNull->pCfg);
    170     DrvAudioHlpClearBuf(&pStreamNull->pCfg->Props, pvBuf, uBufSize, PDMAUDIOPCMPROPS_B2F(&pStreamNull->pCfg->Props, uBufSize));
     170    PDMAudioPropsClearBuffer(&pStreamNull->pCfg->Props, pvBuf, uBufSize, PDMAUDIOPCMPROPS_B2F(&pStreamNull->pCfg->Props, uBufSize));
    171171
    172172    if (puRead)
  • trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp

    r82968 r88022  
    356356        case PDMAUDIOSTREAMCMD_RESUME:
    357357        {
    358             DrvAudioHlpClearBuf(&pStreamOSS->pCfg->Props, pStreamOSS->pvBuf, pStreamOSS->cbBuf,
    359                                 PDMAUDIOPCMPROPS_B2F(&pStreamOSS->pCfg->Props, pStreamOSS->cbBuf));
     358            PDMAudioPropsClearBuffer(&pStreamOSS->pCfg->Props, pStreamOSS->pvBuf, pStreamOSS->cbBuf,
     359                                     PDMAUDIOPCMPROPS_B2F(&pStreamOSS->pCfg->Props, pStreamOSS->cbBuf));
    360360
    361361            int mask = PCM_ENABLE_OUTPUT;
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r87994 r88022  
    794794    pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels;
    795795
    796     pStreamPA->curLatencyUs        = DrvAudioHlpFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize) * RT_US_1MS;
     796    pStreamPA->curLatencyUs        = PDMAudioPropsFramesToMilli(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize) * RT_US_1MS;
    797797
    798798    const uint32_t cbLatency = pa_usec_to_bytes(pStreamPA->curLatencyUs, &pStreamPA->SampleSpec);
     
    803803    pStreamPA->BufAttr.maxlength   = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
    804804    pStreamPA->BufAttr.prebuf      = cbLatency;
    805     pStreamPA->BufAttr.minreq      = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
     805    pStreamPA->BufAttr.minreq      = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
    806806
    807807    LogFunc(("Requested: BufAttr tlength=%RU32, maxLength=%RU32, minReq=%RU32\n",
     
    849849    pStreamPA->SampleSpec.channels = pCfgReq->Props.cChannels;
    850850
    851     pStreamPA->BufAttr.fragsize    = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
     851    pStreamPA->BufAttr.fragsize    = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesPeriod);
    852852    pStreamPA->BufAttr.maxlength   = -1; /* Let the PulseAudio server choose the biggest size it can handle. */
    853853
  • trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp

    r87994 r88022  
    145145    pStreamDbg->uSamplesSinceStarted = 0;
    146146    pStreamDbg->Out.tsLastPlayed  = 0;
    147     pStreamDbg->Out.cbPlayBuffer  = DrvAudioHlpFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
     147    pStreamDbg->Out.cbPlayBuffer  = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize);
    148148    pStreamDbg->Out.pu8PlayBuffer = (uint8_t *)RTMemAlloc(pStreamDbg->Out.cbPlayBuffer);
    149149    AssertReturn(pStreamDbg->Out.pu8PlayBuffer, VERR_NO_MEMORY);
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r88016 r88022  
    354354    LogRel2(("HDA: Stream #%RU8 DMA @ 0x%x (%RU32 bytes = %RU64ms total)\n",
    355355             uSD, pStreamShared->u64BDLBase, pStreamShared->u32CBL,
    356              DrvAudioHlpBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->u32CBL)));
     356             PDMAudioPropsBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->u32CBL)));
    357357
    358358    /* Figure out how many transfer fragments we're going to use for this stream. */
     
    456456
    457457    /* Audio data per second the stream needs. */
    458     const uint32_t cbDataPerSec = DrvAudioHlpMilliToBytes(&pStreamR3->State.Mapping.PCMProps, RT_MS_1SEC);
     458    const uint32_t cbDataPerSec = PDMAudioPropsMilliToBytes(&pStreamR3->State.Mapping.PCMProps, RT_MS_1SEC);
    459459
    460460    /* This is used to indicate whether we're done or should the uTimerIoHz as fallback. */
     
    532532        if (cbTransferHeuristics >= 8)
    533533        {
    534             ASSERT_GUEST_LOGREL_MSG(DrvAudioHlpIsBytesAligned(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics),
     534            ASSERT_GUEST_LOGREL_MSG(PDMAudioPropsIsSizeAligned(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics),
    535535                                    ("We arrived at a misaligned transfer size for stream #%RU8: %#x (%u)\n",
    536536                                     uSD, cbTransferHeuristics, cbTransferHeuristics));
     
    544544               halve the buffer till we get there. */
    545545            while (cbTransferHeuristics > 1024 && cbTransferHeuristics > cbTransferPerSec / 4)
    546                 cbTransferHeuristics = DrvAudioHlpFloorBytesToFrame(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics / 2);
     546                cbTransferHeuristics = PDMAudioPropsFloorBytesToFrame(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics / 2);
    547547
    548548            /* Set the transfer size per timer callout. (No chunking, so same.) */
    549549            pStreamShared->State.cbTransferSize  = cbTransferHeuristics;
    550550            pStreamShared->State.cbTransferChunk = cbTransferHeuristics;
    551             ASSERT_GUEST_LOGREL_MSG(DrvAudioHlpIsBytesAligned(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics),
     551            ASSERT_GUEST_LOGREL_MSG(PDMAudioPropsIsSizeAligned(&pStreamR3->State.Mapping.PCMProps, cbTransferHeuristics),
    552552                                    ("We arrived at a misaligned transfer size for stream #%RU8: %#x (%u)\n",
    553553                                     uSD, cbTransferHeuristics, cbTransferHeuristics));
     
    642642                         uSD, pStreamShared->State.uTimerIoHz, (uint64_t)cTicksPerHz, pStreamR3->State.Mapping.PCMProps.uHz,
    643643                         pStreamShared->State.cTicksPerByte, pStreamShared->State.cTransferTicks,
    644                          pStreamShared->State.cbTransferChunk, DrvAudioHlpBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->State.cbTransferChunk),
    645                          pStreamShared->State.cbTransferSize,  DrvAudioHlpBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->State.cbTransferSize)));
     644                         pStreamShared->State.cbTransferChunk, PDMAudioPropsBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->State.cbTransferChunk),
     645                         pStreamShared->State.cbTransferSize,  PDMAudioPropsBytesToMilli(&pStreamR3->State.Mapping.PCMProps, pStreamShared->State.cbTransferSize)));
    646646            }
    647647        }
     
    698698         *       channels we don't support / need to save space.
    699699         */
    700         uint32_t cbCircBuf = DrvAudioHlpMilliToBytes(&pCfg->Props,
     700        uint32_t cbCircBuf = PDMAudioPropsMilliToBytes(&pCfg->Props,
    701701                                                     RT_MS_1SEC * 6 / RT_MIN(uTransferHz, pStreamShared->State.uTimerIoHz));
    702702        LogRel2(("HDA: Stream #%RU8 default ring buffer size is %RU32 bytes / %RU64 ms\n",
    703                  uSD, cbCircBuf, DrvAudioHlpBytesToMilli(&pCfg->Props, cbCircBuf)));
     703                 uSD, cbCircBuf, PDMAudioPropsBytesToMilli(&pCfg->Props, cbCircBuf)));
    704704
    705705        uint32_t msCircBufCfg = hdaGetDirFromSD(uSD) == PDMAUDIODIR_IN ? pThis->cbCircBufInMs : pThis->cbCircBufOutMs;
    706706        if (msCircBufCfg) /* Anything set via CFGM? */
    707707        {
    708             cbCircBuf = DrvAudioHlpMilliToBytes(&pCfg->Props, msCircBufCfg);
     708            cbCircBuf = PDMAudioPropsMilliToBytes(&pCfg->Props, msCircBufCfg);
    709709            LogRel2(("HDA: Stream #%RU8 is using a custom ring buffer size of %RU32 bytes / %RU64 ms\n",
    710                      uSD, cbCircBuf, DrvAudioHlpBytesToMilli(&pCfg->Props, cbCircBuf)));
     710                     uSD, cbCircBuf, PDMAudioPropsBytesToMilli(&pCfg->Props, cbCircBuf)));
    711711        }
    712712
     
    18741874            uint32_t       cbToReadFromStream = RT_MIN(cbStreamReadable, cbSinkWritable);
    18751875            /* Make sure that we always align the number of bytes when reading to the stream's PCM properties. */
    1876             cbToReadFromStream = DrvAudioHlpFloorBytesToFrame(&pStreamR3->State.Mapping.PCMProps, cbToReadFromStream);
     1876            cbToReadFromStream = PDMAudioPropsFloorBytesToFrame(&pStreamR3->State.Mapping.PCMProps, cbToReadFromStream);
    18771877
    18781878            Assert(tsNowNs >= pStreamShared->State.tsLastReadNs);
  • trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp

    r88016 r88022  
    6262    );
    6363
    64     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
    65     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU16) == 44100*4*8);
    66     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
     64    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
     65    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoU16) == 44100*4*8);
     66    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
    6767
    6868    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoS16));
     
    7878                      ("got %x, expected 4\n", PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoU32, 1)));
    7979
    80     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoS16) == 4,
    81                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoS16)));
    82     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU16) == 4,
    83                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU16)));
    84     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU32) == 8,
    85                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU32)));
     80    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoS16) == 4,
     81                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoS16)));
     82    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU16) == 4,
     83                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU16)));
     84    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU32) == 8,
     85                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU32)));
    8686
    8787    uint32_t u32;
    8888    for (uint32_t i = 0; i < 256; i += 8)
    8989    {
    90         RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i) == true);
     90        RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoU32, i) == true);
    9191        for (uint32_t j = 1; j < 8; j++)
    92             RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i + j) == false);
     92            RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoU32, i + j) == false);
    9393        for (uint32_t j = 0; j < 8; j++)
    94             RTTESTI_CHECK(DrvAudioHlpFloorBytesToFrame(&s_Cfg441StereoU32, i + j) == i);
     94            RTTESTI_CHECK(PDMAudioPropsFloorBytesToFrame(&s_Cfg441StereoU32, i + j) == i);
    9595    }
    9696    for (uint32_t i = 0; i < 4096; i += 4)
    9797    {
    98         RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i) == true);
     98        RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoS16, i) == true);
    9999        for (uint32_t j = 1; j < 4; j++)
    100             RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i + j) == false);
     100            RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoS16, i + j) == false);
    101101        for (uint32_t j = 0; j < 4; j++)
    102             RTTESTI_CHECK(DrvAudioHlpFloorBytesToFrame(&s_Cfg441StereoS16, i + j) == i);
    103     }
    104 
    105     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2,
     102            RTTESTI_CHECK(PDMAudioPropsFloorBytesToFrame(&s_Cfg441StereoS16, i + j) == i);
     103    }
     104
     105    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2,
    106106                      ("cb=%RU32\n", u32));
    107     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2,
     107    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2,
    108108                      ("cb=%RU32\n", u32));
    109     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 1)) == 4,
     109    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 1)) == 4,
    110110                      ("cb=%RU32\n", u32));
    111     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU16, 1)) == 4,
     111    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU16, 1)) == 4,
    112112                      ("cb=%RU32\n", u32));
    113     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU32, 1)) == 8,
     113    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU32, 1)) == 8,
    114114                      ("cb=%RU32\n", u32));
    115115
    116     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32));
    117     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32));
    118     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32));
     116    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32));
     117    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32));
     118    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32));
    119119
    120120    uint64_t u64;
    121     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToNano(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_NS_1SEC,
     121    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToNano(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_NS_1SEC,
    122122                      ("ns=%RU64\n", u64));
    123     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToMicro(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_US_1SEC,
     123    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToMicro(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_US_1SEC,
    124124                      ("us=%RU64\n", u64));
    125     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToMilli(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_MS_1SEC,
     125    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToMilli(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_MS_1SEC,
    126126                      ("ms=%RU64\n", u64));
    127127
    128     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC, ("ns=%RU64\n", u64));
    129     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,     1)) == 22675,      ("ns=%RU64\n", u64));
    130     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,    31)) == 702947,     ("ns=%RU64\n", u64));
    131     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,   255)) == 5782312,    ("ns=%RU64\n", u64));
     128    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC, ("ns=%RU64\n", u64));
     129    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,     1)) == 22675,      ("ns=%RU64\n", u64));
     130    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,    31)) == 702947,     ("ns=%RU64\n", u64));
     131    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,   255)) == 5782312,    ("ns=%RU64\n", u64));
    132132    //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(&s_Cfg441StereoS16, 44100)) == RT_US_1SEC,
    133133    //                  ("us=%RU64\n", u64));
    134     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, ("ms=%RU64\n", u64));
    135     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16,   255)) == 5,          ("ms=%RU64\n", u64));
    136 
    137     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100, ("cb=%RU32\n", u32));
    138     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,      215876)) == 10,    ("cb=%RU32\n", u32));
    139     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100, ("cb=%RU32\n", u32));
    140     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoU32,          6)) == 265,   ("cb=%RU32\n", u32));
    141 
    142     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
    143     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,      702947)) == 31*2*2,    ("cb=%RU32\n", u32));
    144     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
    145     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16,          5)) == 884,       ("cb=%RU32\n", u32));
     134    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, ("ms=%RU64\n", u64));
     135    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToMilli(&s_Cfg441StereoS16,   255)) == 5,          ("ms=%RU64\n", u64));
     136
     137    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToFrames(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     138    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToFrames(&s_Cfg441StereoS16,      215876)) == 10,    ("cb=%RU32\n", u32));
     139    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToFrames(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     140    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToFrames(&s_Cfg441StereoU32,          6)) == 265,   ("cb=%RU32\n", u32));
     141
     142    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToBytes(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     143    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToBytes(&s_Cfg441StereoS16,      702947)) == 31*2*2,    ("cb=%RU32\n", u32));
     144    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToBytes(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     145    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToBytes(&s_Cfg441StereoS16,          5)) == 884,       ("cb=%RU32\n", u32));
    146146
    147147    /* DrvAudioHlpClearBuf: */
     
    151151
    152152    memset(pbPage, 0x42, PAGE_SIZE);
    153     DrvAudioHlpClearBuf(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
     153    PDMAudioPropsClearBuffer(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
    154154    RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE));
    155155
    156156    memset(pbPage, 0x42, PAGE_SIZE);
    157     DrvAudioHlpClearBuf(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
     157    PDMAudioPropsClearBuffer(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
    158158    for (uint32_t off = 0; off < PAGE_SIZE; off += 2)
    159159        RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1]));
    160160
    161161    memset(pbPage, 0x42, PAGE_SIZE);
    162     DrvAudioHlpClearBuf(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE / 8);
     162    PDMAudioPropsClearBuffer(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE / 8);
    163163    for (uint32_t off = 0; off < PAGE_SIZE; off += 4)
    164164        RTTESTI_CHECK(pbPage[off] == 0x80 && pbPage[off + 1] == 0 && pbPage[off + 2] == 0 && pbPage[off + 3] == 0);
     
    167167    RTTestDisableAssertions(hTest);
    168168    memset(pbPage, 0x42, PAGE_SIZE);
    169     DrvAudioHlpClearBuf(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     169    PDMAudioPropsClearBuffer(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    170170    RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE));
    171171
    172172    memset(pbPage, 0x42, PAGE_SIZE);
    173     DrvAudioHlpClearBuf(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     173    PDMAudioPropsClearBuffer(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    174174    for (uint32_t off = 0; off < PAGE_SIZE; off += 2)
    175175        RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1]));
    176176
    177177    memset(pbPage, 0x42, PAGE_SIZE);
    178     DrvAudioHlpClearBuf(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     178    PDMAudioPropsClearBuffer(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    179179    for (uint32_t off = 0; off < PAGE_SIZE; off += 4)
    180180        RTTESTI_CHECK(pbPage[off] == 0x80 && pbPage[off + 1] == 0 && pbPage[off + 2] == 0 && pbPage[off + 3] == 0);
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r88016 r88022  
    437437            pCodec->Opus.msFrame = AVREC_OPUS_FRAME_MS_DEFAULT; /* 20ms by default; to prevent division by zero. */
    438438        pCodec->Opus.csFrame = pSink->Codec.Parms.PCMProps.uHz / (1000 /* s in ms */ / pSink->Codec.Opus.msFrame);
    439         pCodec->Opus.cbFrame = DrvAudioHlpFramesToBytes(&pSink->Codec.Parms.PCMProps, pCodec->Opus.csFrame);
     439        pCodec->Opus.cbFrame = PDMAudioPropsFramesToBytes(&pSink->Codec.Parms.PCMProps, pCodec->Opus.csFrame);
    440440
    441441#ifdef VBOX_WITH_STATISTICS
     
    553553
    554554                    /* Every Opus frame marks a period for now. Optimize this later. */
    555                     pCfgAcq->Backend.cFramesPeriod       = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, pSink->Codec.Opus.msFrame);
    556                     pCfgAcq->Backend.cFramesBufferSize   = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 100 /*ms*/); /** @todo Make this configurable. */
     555                    pCfgAcq->Backend.cFramesPeriod       = PDMAudioPropsMilliToFrames(&pCfgAcq->Props, pSink->Codec.Opus.msFrame);
     556                    pCfgAcq->Backend.cFramesBufferSize   = PDMAudioPropsMilliToFrames(&pCfgAcq->Props, 100 /*ms*/); /** @todo Make this configurable. */
    557557                    pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesPeriod * 2;
    558558                }
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r88002 r88022  
    9393
    9494    /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
    95     const uint32_t cFramesVrdpServer = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 200 /*ms*/);
    96 
    97     int rc = RTCircBufCreate(&pStreamVRDE->In.pCircBuf, DrvAudioHlpFramesToBytes(&pCfgAcq->Props, cFramesVrdpServer));
     95    const uint32_t cFramesVrdpServer = PDMAudioPropsMilliToFrames(&pCfgAcq->Props, 200 /*ms*/);
     96
     97    int rc = RTCircBufCreate(&pStreamVRDE->In.pCircBuf, PDMAudioPropsFramesToBytes(&pCfgAcq->Props, cFramesVrdpServer));
    9898    if (RT_SUCCESS(rc))
    9999    {
     
    137137
    138138        /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */
    139         pCfgAcq->Backend.cFramesPeriod       = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 20  /*ms*/);
    140         pCfgAcq->Backend.cFramesBufferSize   = DrvAudioHlpMilliToFrames(&pCfgAcq->Props, 100 /*ms*/);
     139        pCfgAcq->Backend.cFramesPeriod       = PDMAudioPropsMilliToFrames(&pCfgAcq->Props, 20  /*ms*/);
     140        pCfgAcq->Backend.cFramesBufferSize   = PDMAudioPropsMilliToFrames(&pCfgAcq->Props, 100 /*ms*/);
    141141        pCfgAcq->Backend.cFramesPreBuffering = pCfgAcq->Backend.cFramesPeriod * 2;
    142142    }
     
    174174        {
    175175            rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pStreamVRDE,
    176                                                                DrvAudioHlpMilliToFrames(&pStreamVRDE->pCfg->Props, 200 /*ms*/),
     176                                                               PDMAudioPropsMilliToFrames(&pStreamVRDE->pCfg->Props, 200 /*ms*/),
    177177                                                               pStreamVRDE->pCfg->Props.uHz, pStreamVRDE->pCfg->Props.cChannels,
    178178                                                               pStreamVRDE->pCfg->Props.cbSample * 8 /* Bit */);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette