Changeset 88003 in vbox
- Timestamp:
- Mar 8, 2021 11:46:08 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88002 r88003 195 195 /** @name Audio calculation helper methods. 196 196 * @{ */ 197 void DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames);197 void DrvAudioHlpClearBuf(PCPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cFrames); 198 198 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 199 uint32_t DrvAudioHlp CalcBitrate(PCPDMAUDIOPCMPROPS pProps);199 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps); 200 200 uint32_t DrvAudioHlpBytesAlign(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps); 201 201 bool DrvAudioHlpBytesIsAligned(uint32_t cbSize, PCPDMAUDIOPCMPROPS pProps); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88002 r88003 1135 1135 * Divide the result by 8 to get the byte rate. 1136 1136 * 1137 * @returns The calculated bitrate.1137 * @returns Bitrate. 1138 1138 * @param cBits Number of bits per sample. 1139 1139 * @param uHz Hz (Hertz) rate. … … 1142 1142 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels) 1143 1143 { 1144 return (cBits * uHz * cChannels);1145 } 1146 1147 /** 1148 * Calculates the audio bit rate out of a given audio stream configuration.1144 return cBits * uHz * cChannels; 1145 } 1146 1147 /** 1148 * Gets the bitrate. 1149 1149 * 1150 1150 * Divide the result by 8 to get the byte rate. 1151 1151 * 1152 * @returns The calculated bit rate.1152 * @returns Bit rate. 1153 1153 * @param pProps PCM properties to calculate bitrate for. 1154 * 1155 * @remark 1156 */ 1157 uint32_t DrvAudioHlpCalcBitrate(PCPDMAUDIOPCMPROPS pProps) 1154 */ 1155 uint32_t DrvAudioHlpGetBitrate(PCPDMAUDIOPCMPROPS pProps) 1158 1156 { 1159 1157 return DrvAudioHlpCalcBitrate(pProps->cbSample * 8, pProps->uHz, pProps->cChannels); … … 1716 1714 pData->Hdr.u16NumChannels = pProps->cChannels; 1717 1715 pData->Hdr.u32SampleRate = pProps->uHz; 1718 pData->Hdr.u32ByteRate = DrvAudioHlp CalcBitrate(pProps) / 8;1716 pData->Hdr.u32ByteRate = DrvAudioHlpGetBitrate(pProps) / 8; 1719 1717 pData->Hdr.u16BlockAlign = pProps->cChannels * pProps->cbSample; 1720 1718 pData->Hdr.u16BitsPerSample = pProps->cbSample * 8; -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r88002 r88003 61 61 /* a_fSwapEndian: */ false 62 62 ); 63 64 RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoS16) == 44100*4*8); 65 RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU32) == 44100*8*8); 63 66 64 67 RTTESTI_CHECK_MSG(PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoS16, 1) == 4,
Note:
See TracChangeset
for help on using the changeset viewer.