Changeset 73207 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 18, 2018 2:56:36 PM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.h
r73097 r73207 154 154 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 155 155 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps); 156 uint32_t DrvAudioHlpBytesToFrames(const PPDMAUDIOPCMPROPS pProps, uint32_t cbBytes); 156 157 uint64_t DrvAudioHlpBytesToMs(const PPDMAUDIOPCMPROPS pProps, size_t cbBytes); 158 uint32_t DrvAudioHlpFramesToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t cFrames); 157 159 float DrvAudioHlpFramesToMs(const PPDMAUDIOPCMPROPS pProps, size_t cFrames); 158 160 uint32_t DrvAudioHlpMsToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t uMs); … … 161 163 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps, const PPDMAUDIOSTREAMCFG pCfg); 162 164 bool DrvAudioHlpPCMPropsAreValid(const PPDMAUDIOPCMPROPS pProps); 165 uint32_t DrvAudioHlpPCMPropsBytesPerFrame(const PPDMAUDIOPCMPROPS pProps); 163 166 void DrvAudioHlpPCMPropsPrint(const PPDMAUDIOPCMPROPS pProps); 164 167 int DrvAudioHlpPCMPropsToStreamCfg(const PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r73059 r73207 869 869 870 870 /** 871 * Returns the bytes per frame for given PCM properties. 872 * 873 * @return Bytes per (audio) frame. 874 * @param pProps PCM properties to retrieve bytes per frame for. 875 */ 876 uint32_t DrvAudioHlpPCMPropsBytesPerFrame(const PPDMAUDIOPCMPROPS pProps) 877 { 878 return (pProps->cBits / 8) * pProps->cChannels; 879 } 880 881 /** 871 882 * Prints PCM properties to the debug log. 872 883 * … … 1053 1064 1054 1065 /** 1066 * Returns the number of audio frames for a given amount of bytes. 1067 * 1068 * @return Calculated audio frames for given bytes. 1069 * @param pProps PCM properties to calulate frames for. 1070 * @param cbBytes Bytes to convert to audio frames. 1071 */ 1072 uint32_t DrvAudioHlpBytesToFrames(const PPDMAUDIOPCMPROPS pProps, uint32_t cbBytes) 1073 { 1074 AssertPtrReturn(pProps, 0); 1075 1076 return cbBytes / ((pProps->cBits / 8) * pProps->cChannels); 1077 } 1078 1079 /** 1055 1080 * Returns the time (in ms) for given byte amount and PCM properties. 1056 1081 * … … 1072 1097 1073 1098 return cbBytes / dbBytesPerMs; 1099 } 1100 1101 /** 1102 * Returns the bytes for a given audio frames amount and PCM properties. 1103 * 1104 * @return Calculated bytes for given audio frames. 1105 * @param pProps PCM properties to calculate bytes for. 1106 * @param cFrames Amount of audio frames to calculate bytes for. 1107 */ 1108 uint32_t DrvAudioHlpFramesToBytes(const PPDMAUDIOPCMPROPS pProps, uint32_t cFrames) 1109 { 1110 AssertPtrReturn(pProps, 0); 1111 1112 if (!cFrames) 1113 return 0; 1114 1115 return cFrames * ((pProps->cBits / 2) * pProps->cChannels); 1074 1116 } 1075 1117
Note:
See TracChangeset
for help on using the changeset viewer.