VirtualBox

Changeset 70972 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 12, 2018 12:47:16 PM (7 years ago)
Author:
vboxsync
Message:

Audio/DrvAudioCommon.cpp: Implemented DrvAudioHlpMsToBytes().

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r70821 r70972  
    154154uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);
    155155uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps);
     156uint32_t DrvAudioHlpMsToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t uMs);
    156157bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps1, const PPDMAUDIOPCMPROPS pPCMProps2);
    157158bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps, const PPDMAUDIOSTREAMCFG pCfg);
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r70822 r70972  
    10281028{
    10291029    return DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels);
     1030}
     1031
     1032/**
     1033 * Returns the amount of bytes for a given time (in ms) and PCM properties.
     1034 *
     1035 * @return  uint32_t            Calculated amount of bytes.
     1036 * @param   pProps              PCM properties to calculate amount of bytes for.
     1037 * @param   uMs                 Time (in ms) to calculate amount of bytes for.
     1038 */
     1039uint32_t DrvAudioHlpMsToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t uMs)
     1040{
     1041    AssertPtrReturn(pProps, 0);
     1042
     1043    if (!uMs)
     1044        return 0;
     1045
     1046    return float(((pProps->cBits / 8) * pProps->cChannels * pProps->uHz) / 1000) * uMs;
    10301047}
    10311048
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