Changeset 88007 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 8, 2021 12:12:40 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143130
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88006 r88007 195 195 /** @name Audio calculation helper methods. 196 196 * @{ */ 197 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 198 /** @} */ 199 200 /** @name Audio PCM properties helper methods. 201 * @{ */ 197 202 void DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames); 198 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);199 203 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps); 200 204 uint32_t DrvAudioHlpFloorBytesToFrame(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 201 205 bool DrvAudioHlpIsBytesAligned(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 202 uint32_t DrvAudioHlpBytesToFrames( uint32_t cbBytes, PCPDMAUDIOPCMPROPS pProps);206 uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 203 207 uint64_t DrvAudioHlpBytesToMilli(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); 204 208 uint64_t DrvAudioHlpBytesToMicro(PCPDMAUDIOPCMPROPS pProps, uint32_t cb); … … 211 215 uint32_t DrvAudioHlpMilliToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cMs); 212 216 uint32_t DrvAudioHlpNanoToFrames(PCPDMAUDIOPCMPROPS pProps, uint64_t cNs); 213 /** @} */ 214 215 /** @name Audio PCM properties helper methods. 216 * @{ */ 217 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2); 218 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps, PCPDMAUDIOSTREAMCFG pCfg); 219 bool DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps); 217 218 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps1, PCPDMAUDIOPCMPROPS pPCMProps2); 219 bool DrvAudioHlpPCMPropsAreEqual(PCPDMAUDIOPCMPROPS pPCMProps, PCPDMAUDIOSTREAMCFG pCfg); 220 bool DrvAudioHlpPCMPropsAreValid(PCPDMAUDIOPCMPROPS pProps); 220 221 uint32_t DrvAudioHlpPCMPropsBytesPerFrame(PCPDMAUDIOPCMPROPS pProps); 221 void DrvAudioHlpPCMPropsPrint(PCPDMAUDIOPCMPROPS pProps);222 int DrvAudioHlpPCMPropsToStreamCfg(PCPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);222 void DrvAudioHlpPCMPropsPrint(PCPDMAUDIOPCMPROPS pProps); 223 int DrvAudioHlpPCMPropsToStreamCfg(PCPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg); 223 224 /** @} */ 224 225 -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88006 r88007 1198 1198 1199 1199 /** 1200 * Returns the number of audio frames for a given amount of bytes.1201 * 1202 * @return Calculated audio frames for given bytes.1203 * @param cbBytes Bytes to convert to audio frames.1204 * @param pProps PCM properties to calulate frames for.1205 */ 1206 uint32_t DrvAudioHlpBytesToFrames( uint32_t cbBytes, PCPDMAUDIOPCMPROPS pProps)1200 * Converts bytes to frames (rounding down of course). 1201 * 1202 * @returns Number of frames. 1203 * @param pProps PCM properties to use. 1204 * @param cb The number of bytes to convert. 1205 */ 1206 uint32_t DrvAudioHlpBytesToFrames(PCPDMAUDIOPCMPROPS pProps, uint32_t cb) 1207 1207 { 1208 1208 AssertPtrReturn(pProps, 0); 1209 1210 return PDMAUDIOPCMPROPS_B2F(pProps, cbBytes); 1209 return PDMAUDIOPCMPROPS_B2F(pProps, cb); 1211 1210 } 1212 1211 -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r88006 r88007 101 101 ("cb=%RU32\n", u32)); 102 102 103 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(4, &s_Cfg441StereoS16)) == 1, 104 ("cb=%RU32\n", u32)); 105 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(4, &s_Cfg441StereoU16)) == 1, 106 ("cb=%RU32\n", u32)); 107 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(8, &s_Cfg441StereoU32)) == 1, 108 ("cb=%RU32\n", u32)); 103 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32)); 104 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32)); 105 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32)); 109 106 110 107 uint64_t u64;
Note:
See TracChangeset
for help on using the changeset viewer.