Changeset 73379 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jul 27, 2018 9:03:35 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.h
r73370 r73379 184 184 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 185 185 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps); 186 uint32_t DrvAudioHlpBytesAlign(uint32_t cbSize, const PPDMAUDIOPCMPROPS pProps); 187 bool DrvAudioHlpBytesIsAligned(uint32_t cbSize, const PPDMAUDIOPCMPROPS pProps); 186 188 uint32_t DrvAudioHlpBytesToFrames(const PPDMAUDIOPCMPROPS pProps, uint32_t cbBytes); 187 189 uint64_t DrvAudioHlpBytesToMs(const PPDMAUDIOPCMPROPS pProps, uint32_t cbBytes); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r73378 r73379 1061 1061 { 1062 1062 return DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels); 1063 } 1064 1065 /** 1066 * Aligns the given byte amount to the given PCM properties and returns the aligned 1067 * size. 1068 * 1069 * @return Aligned size (in bytes). 1070 * @param cbSize Size (in bytes) to align. 1071 * @param pProps PCM properties to align size to. 1072 */ 1073 uint32_t DrvAudioHlpBytesAlign(uint32_t cbSize, const PPDMAUDIOPCMPROPS pProps) 1074 { 1075 AssertPtrReturn(pProps, 0); 1076 1077 if (!cbSize) 1078 return 0; 1079 1080 const uint32_t cbFrameSize = DrvAudioHlpPCMPropsBytesPerFrame(pProps); 1081 return (cbSize / cbFrameSize) * cbFrameSize; 1082 } 1083 1084 /** 1085 * Returns if the the given size is properly aligned to the given PCM properties. 1086 * 1087 * @return @c true if properly aligned, @c false if not. 1088 * @param cbSize Size (in bytes) to check alignment for. 1089 * @param pProps PCM properties to use for checking the alignment. 1090 */ 1091 bool DrvAudioHlpBytesIsAligned(uint32_t cbSize, const PPDMAUDIOPCMPROPS pProps) 1092 { 1093 AssertPtrReturn(pProps, 0); 1094 1095 if (!cbSize) 1096 return true; 1097 1098 return (cbSize % DrvAudioHlpPCMPropsBytesPerFrame(pProps) == 0); 1063 1099 } 1064 1100
Note:
See TracChangeset
for help on using the changeset viewer.