Changeset 73529 in vbox
- Timestamp:
- Aug 6, 2018 4:26:43 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124158
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r73467 r73529 511 511 typedef struct PDMAUDIOPCMPROPS 512 512 { 513 /** Sample width . Bits per sample. */514 uint8_t cB its;513 /** Sample width (in bytes). */ 514 uint8_t cBytes; 515 515 /** Number of audio channels. */ 516 516 uint8_t cChannels; … … 535 535 536 536 /** Initializor for PDMAUDIOPCMPROPS. */ 537 #define PDMAUDIOPCMPROPS_INITIALIZOR(a_cB its, a_fSigned, a_cCannels, a_uHz, a_cShift, a_fSwapEndian) \538 { a_cB its, a_cCannels, a_cShift, a_fSigned, a_fSwapEndian, a_uHz }537 #define PDMAUDIOPCMPROPS_INITIALIZOR(a_cBytes, a_fSigned, a_cCannels, a_uHz, a_cShift, a_fSwapEndian) \ 538 { a_cBytes, a_cCannels, a_cShift, a_fSigned, a_fSwapEndian, a_uHz } 539 539 /** Calculates the cShift value of given sample bits and audio channels. 540 540 * Note: Does only support mono/stereo channels for now. */ 541 #define PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(cB its, cChannels) ((cChannels == 2) + (cBits / 16))541 #define PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(cBytes, cChannels) ((cChannels == 2) + (cBytes / 2)) 542 542 /** Calculates the cShift value of a PDMAUDIOPCMPROPS structure. */ 543 #define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps) PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cB its, (pProps)->cChannels)543 #define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps) PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cBytes, (pProps)->cChannels) 544 544 /** Converts (audio) frames to bytes. 545 545 * Needs the cShift value set correctly, using PDMAUDIOPCMPROPS_MAKE_SHIFT. */ -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r70878 r73529 844 844 pMixBuf->AudioFmt = AUDMIXBUF_AUDIO_FMT_MAKE(pProps->uHz, 845 845 pProps->cChannels, 846 pProps->cB its,846 pProps->cBytes * 8 /* Bit */, 847 847 pProps->fSigned); 848 848 -
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r73525 r73529 553 553 554 554 LogFlowFunc(("[%s] fFlags=0x%x (enmDir=%ld, %RU8 bits, %RU8 channels, %RU32Hz)\n", 555 pSink->pszName, fFlags, pCfg->enmDir, pCfg->Props.cB its, pCfg->Props.cChannels, pCfg->Props.uHz));555 pSink->pszName, fFlags, pCfg->enmDir, pCfg->Props.cBytes * 8, pCfg->Props.cChannels, pCfg->Props.uHz)); 556 556 557 557 /* … … 1322 1322 if (pSink->PCMProps.uHz) 1323 1323 LogFlowFunc(("[%s] Old format: %RU8 bit, %RU8 channels, %RU32Hz\n", 1324 pSink->pszName, pSink->PCMProps.cB its, pSink->PCMProps.cChannels, pSink->PCMProps.uHz));1324 pSink->pszName, pSink->PCMProps.cBytes * 8, pSink->PCMProps.cChannels, pSink->PCMProps.uHz)); 1325 1325 1326 1326 memcpy(&pSink->PCMProps, pPCMProps, sizeof(PDMAUDIOPCMPROPS)); 1327 1327 1328 1328 LogFlowFunc(("[%s] New format %RU8 bit, %RU8 channels, %RU32Hz\n", 1329 pSink->pszName, pSink->PCMProps.cB its, pSink->PCMProps.cChannels, pSink->PCMProps.uHz));1329 pSink->pszName, pSink->PCMProps.cBytes * 8, pSink->PCMProps.cChannels, pSink->PCMProps.uHz)); 1330 1330 1331 1331 #ifdef VBOX_AUDIO_MIXER_WITH_MIXBUF -
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r73466 r73529 1841 1841 1842 1842 pCfg->Props.cChannels = 2; 1843 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cB its, pCfg->Props.cChannels);1843 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBytes, pCfg->Props.cChannels); 1844 1844 1845 1845 rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_FRONT, pCfg); -
trunk/src/VBox/Devices/Audio/DevHDACommon.cpp
r71767 r73529 528 528 } 529 529 530 uint8_t cB its = 0;530 uint8_t cBytes = 0; 531 531 switch (EXTRACT_VALUE(u32SDFMT, HDA_SDFMT_BITS_MASK, HDA_SDFMT_BITS_SHIFT)) 532 532 { 533 533 case 0: 534 cB its = 8;534 cBytes = 1; 535 535 break; 536 536 case 1: 537 cB its = 16;537 cBytes = 2; 538 538 break; 539 539 case 4: 540 cB its = 32;540 cBytes = 4; 541 541 break; 542 542 default: … … 551 551 RT_BZERO(pProps, sizeof(PDMAUDIOPCMPROPS)); 552 552 553 pProps->cB its = cBits;553 pProps->cBytes = cBytes; 554 554 pProps->fSigned = true; 555 555 pProps->cChannels = (u32SDFMT & 0xf) + 1; 556 556 pProps->uHz = u32Hz * u32HzMult / u32HzDiv; 557 pProps->cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cB its, pProps->cChannels);557 pProps->cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBytes, pProps->cChannels); 558 558 } 559 559 -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r73452 r73529 1766 1766 1767 1767 pCfg->Props.cChannels = 2; 1768 pCfg->Props.cB its = 16;1768 pCfg->Props.cBytes = 2 /* 16-bit */; 1769 1769 pCfg->Props.fSigned = true; 1770 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cB its, pCfg->Props.cChannels);1770 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBytes, pCfg->Props.cChannels); 1771 1771 1772 1772 rc = ichac97R3MixerAddDrvStreams(pThis, pMixSink, pCfg); -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r73453 r73529 1036 1036 pCfg->Props.uHz = pThis->freq; 1037 1037 pCfg->Props.cChannels = 1; /* Mono */ 1038 pCfg->Props.cB its = 8;1038 pCfg->Props.cBytes = 1 /* 8-bit */; 1039 1039 pCfg->Props.fSigned = false; 1040 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cB its, pCfg->Props.cChannels);1040 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBytes, pCfg->Props.cChannels); 1041 1041 1042 1042 AssertCompile(sizeof(pCfg->szName) > sizeof("Output")); … … 2042 2042 Cfg.Props.uHz = pThis->freq; 2043 2043 Cfg.Props.cChannels = 1 << pThis->fmt_stereo; 2044 Cfg.Props.cB its = pThis->fmt_bits;2044 Cfg.Props.cBytes = pThis->fmt_bits / 8; 2045 2045 Cfg.Props.fSigned = RT_BOOL(pThis->fmt_signed); 2046 Cfg.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(Cfg.Props.cB its, Cfg.Props.cChannels);2046 Cfg.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(Cfg.Props.cBytes, Cfg.Props.cChannels); 2047 2047 2048 2048 if (!DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pThis->Out.Cfg.Props)) -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r73524 r73529 543 543 LogRel2(("Audio: Guest %s format for '%s': %RU32Hz, %RU8%s, %RU8 %s\n", 544 544 pCfgGuest->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName, 545 pCfgGuest->Props.uHz, pCfgGuest->Props.cB its, pCfgGuest->Props.fSigned ? "S" : "U",545 pCfgGuest->Props.uHz, pCfgGuest->Props.cBytes * 8, pCfgGuest->Props.fSigned ? "S" : "U", 546 546 pCfgGuest->Props.cChannels, pCfgGuest->Props.cChannels == 1 ? "Channel" : "Channels")); 547 547 LogRel2(("Audio: Requested host %s format for '%s': %RU32Hz, %RU8%s, %RU8 %s\n", 548 548 pCfgHost->enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName, 549 pCfgHost->Props.uHz, pCfgHost->Props.cB its, pCfgHost->Props.fSigned ? "S" : "U",549 pCfgHost->Props.uHz, pCfgHost->Props.cBytes * 8, pCfgHost->Props.fSigned ? "S" : "U", 550 550 pCfgHost->Props.cChannels, pCfgHost->Props.cChannels == 1 ? "Channel" : "Channels")); 551 551 … … 562 562 LogRel2(("Audio: Acquired host %s format for '%s': %RU32Hz, %RU8%s, %RU8 %s\n", 563 563 CfgHostAcq.enmDir == PDMAUDIODIR_IN ? "recording" : "playback", pStream->szName, 564 CfgHostAcq.Props.uHz, CfgHostAcq.Props.cB its, CfgHostAcq.Props.fSigned ? "S" : "U",564 CfgHostAcq.Props.uHz, CfgHostAcq.Props.cBytes * 8, CfgHostAcq.Props.fSigned ? "S" : "U", 565 565 CfgHostAcq.Props.cChannels, CfgHostAcq.Props.cChannels == 1 ? "Channel" : "Channels")); 566 566 … … 624 624 625 625 /* Make sure to (re-)set the host buffer's shift size. */ 626 CfgHostAcq.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(CfgHostAcq.Props.cB its, CfgHostAcq.Props.cChannels);626 CfgHostAcq.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(CfgHostAcq.Props.cBytes, CfgHostAcq.Props.cChannels); 627 627 628 628 rc = AudioMixBufInit(&pStream->Host.MixBuf, pStream->szName, &CfgHostAcq.Props, … … 648 648 649 649 /* Make sure to (re-)set the guest buffer's shift size. */ 650 pCfgGuest->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgGuest->Props.cB its, pCfgGuest->Props.cChannels);650 pCfgGuest->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgGuest->Props.cBytes, pCfgGuest->Props.cChannels); 651 651 652 652 /* Set set guest buffer size multiplicator. */ -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r73463 r73529 136 136 return; 137 137 138 Assert(pPCMProps->cB its);138 Assert(pPCMProps->cBytes); 139 139 size_t cbToClear = DrvAudioHlpFramesToBytes(cFrames, pPCMProps); 140 140 Assert(cbBuf >= cbToClear); … … 143 143 cbToClear = cbBuf; 144 144 145 Log2Func(("pPCMProps=%p, pvBuf=%p, cFrames=%RU32, fSigned=%RTbool, cB its=%RU8\n",146 pPCMProps, pvBuf, cFrames, pPCMProps->fSigned, pPCMProps->cB its));145 Log2Func(("pPCMProps=%p, pvBuf=%p, cFrames=%RU32, fSigned=%RTbool, cBytes=%RU8\n", 146 pPCMProps, pvBuf, cFrames, pPCMProps->fSigned, pPCMProps->cBytes)); 147 147 148 148 Assert(pPCMProps->fSwapEndian == false); /** @todo Swapping Endianness is not supported yet. */ … … 154 154 else 155 155 { 156 switch (pPCMProps->cB its)156 switch (pPCMProps->cBytes) 157 157 { 158 case 8:158 case 1: /* 8 bit */ 159 159 { 160 160 memset(pvBuf, 0x80, cbToClear); … … 162 162 } 163 163 164 case 16:164 case 2: /* 16 bit */ 165 165 { 166 166 uint16_t *p = (uint16_t *)pvBuf; … … 175 175 /** @todo Add 24 bit? */ 176 176 177 case 32:177 case 4: /* 32 bit */ 178 178 { 179 179 uint32_t *p = (uint32_t *)pvBuf; … … 188 188 default: 189 189 { 190 AssertMsgFailed(("Invalid b its: %RU8\n", pPCMProps->cBits));190 AssertMsgFailed(("Invalid bytes per sample: %RU8\n", pPCMProps->cBytes)); 191 191 break; 192 192 } … … 806 806 return pProps1->uHz == pProps2->uHz 807 807 && pProps1->cChannels == pProps2->cChannels 808 && pProps1->cB its == pProps2->cBits808 && pProps1->cBytes == pProps2->cBytes 809 809 && pProps1->fSigned == pProps2->fSigned 810 810 && pProps1->fSwapEndian == pProps2->fSwapEndian; … … 827 827 if (fValid) 828 828 { 829 switch (pProps->cB its)829 switch (pProps->cBytes) 830 830 { 831 case 8:832 case 16:831 case 1: 832 case 2: 833 833 /** @todo Do we need support for 24-bit samples? */ 834 case 32:834 case 4: 835 835 break; 836 836 default: … … 844 844 845 845 fValid &= pProps->uHz > 0; 846 fValid &= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cB its, pProps->cChannels);846 fValid &= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBytes, pProps->cChannels); 847 847 fValid &= pProps->fSwapEndian == false; /** @todo Handling Big Endian audio data is not supported yet. */ 848 848 … … 874 874 uint32_t DrvAudioHlpPCMPropsBytesPerFrame(const PPDMAUDIOPCMPROPS pProps) 875 875 { 876 return (pProps->cBits / 8)* pProps->cChannels;876 return pProps->cBytes * pProps->cChannels; 877 877 } 878 878 … … 887 887 888 888 Log(("uHz=%RU32, cChannels=%RU8, cBits=%RU8%s", 889 pProps->uHz, pProps->cChannels, pProps->cB its, pProps->fSigned ? "S" : "U"));889 pProps->uHz, pProps->cChannels, pProps->cBytes * 8, pProps->fSigned ? "S" : "U")); 890 890 } 891 891 … … 1013 1013 LogFunc(("szName=%s, enmDir=%RU32 (uHz=%RU32, cBits=%RU8%s, cChannels=%RU8)\n", 1014 1014 pCfg->szName, pCfg->enmDir, 1015 pCfg->Props.uHz, pCfg->Props.cB its, pCfg->Props.fSigned ? "S" : "U", pCfg->Props.cChannels));1015 pCfg->Props.uHz, pCfg->Props.cBytes * 8, pCfg->Props.fSigned ? "S" : "U", pCfg->Props.cChannels)); 1016 1016 } 1017 1017 … … 1119 1119 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps) 1120 1120 { 1121 return DrvAudioHlpCalcBitrate(pProps->cB its, pProps->uHz, pProps->cChannels);1121 return DrvAudioHlpCalcBitrate(pProps->cBytes * 8, pProps->uHz, pProps->cChannels); 1122 1122 } 1123 1123 … … 1169 1169 AssertPtrReturn(pProps, 0); 1170 1170 1171 return cbBytes / ( (pProps->cBits / 8)* pProps->cChannels);1171 return cbBytes / (pProps->cBytes * pProps->cChannels); 1172 1172 } 1173 1173 … … 1186 1186 return 0; 1187 1187 1188 const uint64_t cbBytesPerSec = (pProps->cBits / 8)* pProps->cChannels * pProps->uHz;1188 const uint64_t cbBytesPerSec = pProps->cBytes * pProps->cChannels * pProps->uHz; 1189 1189 const double dbBytesPerMs = (double)cbBytesPerSec / (double)RT_MS_1SEC; 1190 1190 Assert(dbBytesPerMs >= 0.0f); … … 1209 1209 return 0; 1210 1210 1211 const double dbBytesPerMs = ( (pProps->cBits / 8)* pProps->cChannels * pProps->uHz) / RT_NS_1SEC;1211 const double dbBytesPerMs = (pProps->cBytes * pProps->cChannels * pProps->uHz) / RT_NS_1SEC; 1212 1212 Assert(dbBytesPerMs >= 0.0f); 1213 1213 if (!dbBytesPerMs) /* Prevent division by zero. */ … … 1231 1231 return 0; 1232 1232 1233 const uint32_t cbFrame = (pProps->cBits / 8) * pProps->cChannels; 1234 return cFrames * cbFrame; 1233 return cFrames * pProps->cBytes * pProps->cChannels; 1235 1234 } 1236 1235 … … 1289 1288 return 0; 1290 1289 1291 const uint64_t cbBytesPerSec = (pProps->cBits / 8)* pProps->cChannels * pProps->uHz;1290 const uint64_t cbBytesPerSec = pProps->cBytes * pProps->cChannels * pProps->uHz; 1292 1291 return ((double)cbBytesPerSec / (double)RT_MS_1SEC) * uMs; 1293 1292 } … … 1307 1306 return 0; 1308 1307 1309 const uint64_t cbBytesPerSec = (pProps->cBits / 8)* pProps->cChannels * pProps->uHz;1308 const uint64_t cbBytesPerSec = pProps->cBytes * pProps->cChannels * pProps->uHz; 1310 1309 return ((double)cbBytesPerSec / (double)RT_NS_1SEC) * uNs; 1311 1310 } … … 1322 1321 AssertPtrReturn(pProps, 0); 1323 1322 1324 const uint32_t cbFrame = (pProps->cBits / 8)* pProps->cChannels;1323 const uint32_t cbFrame = pProps->cBytes * pProps->cChannels; 1325 1324 if (!cbFrame) /* Prevent division by zero. */ 1326 1325 return 0; … … 1340 1339 AssertPtrReturn(pProps, 0); 1341 1340 1342 const uint32_t cbFrame = (pProps->cBits / 8)* pProps->cChannels;1341 const uint32_t cbFrame = pProps->cBytes * pProps->cChannels; 1343 1342 if (!cbFrame) /* Prevent division by zero. */ 1344 1343 return 0; … … 1579 1578 Assert(pProps->cChannels); 1580 1579 Assert(pProps->uHz); 1581 Assert(pProps->cB its);1580 Assert(pProps->cBytes); 1582 1581 1583 1582 pFile->pvData = (PAUDIOWAVFILEDATA)RTMemAllocZ(sizeof(AUDIOWAVFILEDATA)); … … 1599 1598 pData->Hdr.u16NumChannels = pProps->cChannels; 1600 1599 pData->Hdr.u32SampleRate = pProps->uHz; 1601 pData->Hdr.u32ByteRate = DrvAudioHlpCalcBitrate(pProps ->cBits, pProps->uHz, pProps->cChannels) / 8;1602 pData->Hdr.u16BlockAlign = pProps->cChannels * pProps->cB its / 8;1603 pData->Hdr.u16BitsPerSample = pProps->cB its;1600 pData->Hdr.u32ByteRate = DrvAudioHlpCalcBitrate(pProps) / 8; 1601 pData->Hdr.u16BlockAlign = pProps->cChannels * pProps->cBytes; 1602 pData->Hdr.u16BitsPerSample = pProps->cBytes * 8; 1604 1603 1605 1604 /* Data chunk. */ -
trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
r73489 r73529 142 142 static snd_pcm_format_t alsaAudioPropsToALSA(PPDMAUDIOPCMPROPS pProps) 143 143 { 144 switch (pProps->cB its)145 { 146 case 8:144 switch (pProps->cBytes) 145 { 146 case 1: 147 147 return pProps->fSigned ? SND_PCM_FORMAT_S8 : SND_PCM_FORMAT_U8; 148 148 149 case 16:149 case 2: 150 150 return pProps->fSigned ? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_U16_LE; 151 151 152 case 32:152 case 4: 153 153 return pProps->fSigned ? SND_PCM_FORMAT_S32_LE : SND_PCM_FORMAT_U32_LE; 154 154 … … 157 157 } 158 158 159 AssertMsgFailed(("%RU8 b its not supported\n", pProps->cBits));159 AssertMsgFailed(("%RU8 bytes not supported\n", pProps->cBytes)); 160 160 return SND_PCM_FORMAT_U8; 161 161 } … … 167 167 { 168 168 case SND_PCM_FORMAT_S8: 169 pProps->cB its = 8;169 pProps->cBytes = 1; 170 170 pProps->fSigned = true; 171 171 break; 172 172 173 173 case SND_PCM_FORMAT_U8: 174 pProps->cB its = 8;174 pProps->cBytes = 1; 175 175 pProps->fSigned = false; 176 176 break; 177 177 178 178 case SND_PCM_FORMAT_S16_LE: 179 pProps->cB its = 16;179 pProps->cBytes = 2; 180 180 pProps->fSigned = true; 181 181 break; 182 182 183 183 case SND_PCM_FORMAT_U16_LE: 184 pProps->cB its = 16;184 pProps->cBytes = 2; 185 185 pProps->fSigned = false; 186 186 break; 187 187 188 188 case SND_PCM_FORMAT_S16_BE: 189 pProps->cB its = 16;190 pProps->fSigned 189 pProps->cBytes = 2; 190 pProps->fSigned = true; 191 191 #ifdef RT_LITTLE_ENDIAN 192 192 pProps->fSwapEndian = true; … … 195 195 196 196 case SND_PCM_FORMAT_U16_BE: 197 pProps->cB its = 16;198 pProps->fSigned 197 pProps->cBytes = 2; 198 pProps->fSigned = false; 199 199 #ifdef RT_LITTLE_ENDIAN 200 200 pProps->fSwapEndian = true; … … 203 203 204 204 case SND_PCM_FORMAT_S32_LE: 205 pProps->cB its = 32;205 pProps->cBytes = 4; 206 206 pProps->fSigned = true; 207 207 break; 208 208 209 209 case SND_PCM_FORMAT_U32_LE: 210 pProps->cB its = 32;210 pProps->cBytes = 4; 211 211 pProps->fSigned = false; 212 212 break; 213 213 214 214 case SND_PCM_FORMAT_S32_BE: 215 pProps->cB its = 32;216 pProps->fSigned 215 pProps->cBytes = 4; 216 pProps->fSigned = true; 217 217 #ifdef RT_LITTLE_ENDIAN 218 218 pProps->fSwapEndian = true; … … 221 221 222 222 case SND_PCM_FORMAT_U32_BE: 223 pProps->cB its = 32;224 pProps->fSigned 223 pProps->cBytes = 4; 224 pProps->fSigned = false; 225 225 #ifdef RT_LITTLE_ENDIAN 226 226 pProps->fSwapEndian = true; … … 233 233 } 234 234 235 Assert(pProps->cB its);235 Assert(pProps->cBytes); 236 236 Assert(pProps->cChannels); 237 pProps->cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cB its, pProps->cChannels);237 pProps->cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBytes, pProps->cChannels); 238 238 239 239 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r73380 r73529 183 183 pASBD->mSampleRate = (Float64)pPCMProps->uHz; 184 184 pASBD->mChannelsPerFrame = pPCMProps->cChannels; 185 pASBD->mBitsPerChannel = pPCMProps->cB its;185 pASBD->mBitsPerChannel = pPCMProps->cBytes * 8; 186 186 if (pPCMProps->fSigned) 187 187 pASBD->mFormatFlags |= kAudioFormatFlagIsSignedInteger; … … 198 198 pCfg->Props.cChannels = pASBD->mChannelsPerFrame; 199 199 pCfg->Props.uHz = (uint32_t)pASBD->mSampleRate; 200 pCfg->Props.cB its = pASBD->mBitsPerChannel;200 pCfg->Props.cBytes = pASBD->mBitsPerChannel / 8; 201 201 pCfg->Props.fSigned = RT_BOOL(pASBD->mFormatFlags & kAudioFormatFlagIsSignedInteger); 202 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cB its, pCfg->Props.cChannels);202 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBytes, pCfg->Props.cChannels); 203 203 204 204 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r73408 r73529 266 266 pFmt->wFormatTag = WAVE_FORMAT_PCM; 267 267 pFmt->nChannels = pCfg->Props.cChannels; 268 pFmt->wBitsPerSample = pCfg->Props.cB its;268 pFmt->wBitsPerSample = pCfg->Props.cBytes * 8; 269 269 pFmt->nSamplesPerSec = pCfg->Props.uHz; 270 270 pFmt->nBlockAlign = pFmt->nChannels * pFmt->wBitsPerSample / 8; … … 621 621 pCfgReq->Props.uHz, 622 622 pCfgReq->Props.cChannels, 623 pCfgReq->Props.cB its,623 pCfgReq->Props.cBytes * 8, 624 624 pCfgReq->Props.fSigned)); 625 625 … … 1337 1337 pCfgReq->Props.uHz, 1338 1338 pCfgReq->Props.cChannels, 1339 pCfgReq->Props.cB its,1339 pCfgReq->Props.cBytes * 8, 1340 1340 pCfgReq->Props.fSigned)); 1341 1341 -
trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp
r73370 r73529 158 158 { 159 159 case AFMT_S8: 160 pProps->cB its = 8;160 pProps->cBytes = 1; 161 161 pProps->fSigned = true; 162 162 break; 163 163 164 164 case AFMT_U8: 165 pProps->cB its = 8;165 pProps->cBytes = 1; 166 166 pProps->fSigned = false; 167 167 break; 168 168 169 169 case AFMT_S16_LE: 170 pProps->cB its = 16;170 pProps->cBytes = 2; 171 171 pProps->fSigned = true; 172 172 break; 173 173 174 174 case AFMT_U16_LE: 175 pProps->cB its = 16;175 pProps->cBytes = 2; 176 176 pProps->fSigned = false; 177 177 break; 178 178 179 179 case AFMT_S16_BE: 180 pProps->cBits = 16;180 pProps->cBytes = 2; 181 181 pProps->fSigned = true; 182 182 #ifdef RT_LITTLE_ENDIAN … … 186 186 187 187 case AFMT_U16_BE: 188 pProps->cB its = 16;188 pProps->cBytes = 2; 189 189 pProps->fSigned = false; 190 190 #ifdef RT_LITTLE_ENDIAN … … 239 239 240 240 int iFormat; 241 switch (pOSSReq->Props.cB its)242 { 243 case 8:241 switch (pOSSReq->Props.cBytes) 242 { 243 case 1: 244 244 iFormat = pOSSReq->Props.fSigned ? AFMT_S8 : AFMT_U8; 245 245 break; 246 246 247 case 16:247 case 2: 248 248 iFormat = pOSSReq->Props.fSigned ? AFMT_S16_LE : AFMT_U16_LE; 249 249 break; … … 319 319 pOSSAcq->Props.cChannels = cChannels; 320 320 pOSSAcq->Props.uHz = freq; 321 pOSSAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pOSSAcq->Props.cB its, pOSSAcq->Props.cChannels);321 pOSSAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pOSSAcq->Props.cBytes, pOSSAcq->Props.cChannels); 322 322 323 323 pOSSAcq->cFragments = abinfo.fragstotal; -
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r73526 r73529 200 200 static pa_sample_format_t paAudioPropsToPulse(PPDMAUDIOPCMPROPS pProps) 201 201 { 202 switch (pProps->cB its)203 { 204 case 8:202 switch (pProps->cBytes) 203 { 204 case 1: 205 205 if (!pProps->fSigned) 206 206 return PA_SAMPLE_U8; 207 207 break; 208 208 209 case 16:209 case 2: 210 210 if (pProps->fSigned) 211 211 return PA_SAMPLE_S16LE; … … 213 213 214 214 #ifdef PA_SAMPLE_S32LE 215 case 32:215 case 4: 216 216 if (pProps->fSigned) 217 217 return PA_SAMPLE_S32LE; … … 223 223 } 224 224 225 AssertMsgFailed(("%RU8%s not supported\n", pProps->cB its, pProps->fSigned ? "S" : "U"));225 AssertMsgFailed(("%RU8%s not supported\n", pProps->cBytes, pProps->fSigned ? "S" : "U")); 226 226 return PA_SAMPLE_INVALID; 227 227 } … … 233 233 { 234 234 case PA_SAMPLE_U8: 235 pProps->cB its = 8;235 pProps->cBytes = 1; 236 236 pProps->fSigned = false; 237 237 break; 238 238 239 239 case PA_SAMPLE_S16LE: 240 pProps->cB its = 16;240 pProps->cBytes = 2; 241 241 pProps->fSigned = true; 242 242 break; 243 243 244 244 case PA_SAMPLE_S16BE: 245 pProps->cB its = 16;245 pProps->cBytes = 2; 246 246 pProps->fSigned = true; 247 247 /** @todo Handle Endianess. */ … … 250 250 #ifdef PA_SAMPLE_S32LE 251 251 case PA_SAMPLE_S32LE: 252 pProps->cB its = 32;252 pProps->cBytes = 4; 253 253 pProps->fSigned = true; 254 254 break; … … 257 257 #ifdef PA_SAMPLE_S32BE 258 258 case PA_SAMPLE_S32BE: 259 pProps->cB its = 32;259 pProps->cBytes = 4; 260 260 pProps->fSigned = true; 261 261 /** @todo Handle Endianess. */ … … 769 769 pCfgAcq->Props.uHz = pStreamPA->SampleSpec.rate; 770 770 pCfgAcq->Props.cChannels = pStreamPA->SampleSpec.channels; 771 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cB its, pCfgAcq->Props.cChannels);771 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels); 772 772 773 773 uint32_t cbBuf = RT_MIN(pStreamPA->BufAttr.tlength * 2, -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r73523 r73529 245 245 246 246 /* Set the stream's frame size. */ 247 pStream->State.cbFrameSize = pCfg->Props.cChannels * (pCfg->Props.cBits / 8 /* To bytes */);248 LogFunc(("[SD%RU8] cChannels=%RU8, cB its=%RU8 -> cbFrameSize=%RU32\n",249 pStream->u8SD, pCfg->Props.cChannels, pCfg->Props.cB its, pStream->State.cbFrameSize));247 pStream->State.cbFrameSize = pCfg->Props.cChannels * pCfg->Props.cBytes; 248 LogFunc(("[SD%RU8] cChannels=%RU8, cBytes=%RU8 -> cbFrameSize=%RU32\n", 249 pStream->u8SD, pCfg->Props.cChannels, pCfg->Props.cBytes, pStream->State.cbFrameSize)); 250 250 Assert(pStream->State.cbFrameSize); /* Frame size must not be 0. */ 251 251 -
trunk/src/VBox/Devices/Audio/HDAStreamMap.cpp
r71736 r73529 58 58 int rc = VINF_SUCCESS; 59 59 60 Assert(RT_IS_POWER_OF_TWO(pProps->cB its));60 Assert(RT_IS_POWER_OF_TWO(pProps->cBytes * 8)); 61 61 62 62 /** @todo We assume all channels in a stream have the same format. */ … … 65 65 { 66 66 pChan->uChannel = i; 67 pChan->cbStep = (pProps->cBits / 8);67 pChan->cbStep = pProps->cBytes; 68 68 pChan->cbFrame = pChan->cbStep * pProps->cChannels; 69 69 pChan->cbFirst = i * pChan->cbStep; -
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r73464 r73529 87 87 pCfgAcq->Props.uHz = 22050; /* The VRDP server's internal frequency. */ 88 88 pCfgAcq->Props.cChannels = 2; 89 pCfgAcq->Props.cB its = 16;89 pCfgAcq->Props.cBytes = 2; /* 16 bit. */ 90 90 pCfgAcq->Props.fSigned = true; 91 91 pCfgAcq->Props.fSwapEndian = false; 92 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cB its, pCfgAcq->Props.cChannels);92 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels); 93 93 94 94 /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */ … … 133 133 pCfgAcq->Props.uHz = 22050; /* The VRDP server's internal frequency. */ 134 134 pCfgAcq->Props.cChannels = 2; 135 pCfgAcq->Props.cB its = 16;135 pCfgAcq->Props.cBytes = 2; /* 16 bit. */ 136 136 pCfgAcq->Props.fSigned = true; 137 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cB its, pCfgAcq->Props.cChannels);137 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels); 138 138 139 139 /* According to the VRDP docs, the VRDP server stores audio in 200ms chunks. */ … … 174 174 DrvAudioHlpMilliToFrames(200 /* ms */, &pStreamVRDE->pCfg->Props), 175 175 pStreamVRDE->pCfg->Props.uHz, pStreamVRDE->pCfg->Props.cChannels, 176 pStreamVRDE->pCfg->Props.cB its);176 pStreamVRDE->pCfg->Props.cBytes * 8 /* Bit */); 177 177 if (rc == VERR_NOT_SUPPORTED) 178 178 { … … 291 291 VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pProps->uHz, 292 292 pProps->cChannels, 293 pProps->cB its,293 pProps->cBytes * 8 /* Bit */, 294 294 pProps->fSigned); 295 295 -
trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
r73505 r73529 521 521 * a specific sampling rate Opus is optimized for. */ 522 522 pCfgAcq->Props.uHz = pSink->Codec.Parms.uHz; 523 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cB its, pCfgAcq->Props.cChannels);523 pCfgAcq->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfgAcq->Props.cBytes, pCfgAcq->Props.cChannels); 524 524 525 525 /* Every Opus frame marks a period for now. Optimize this later. */
Note:
See TracChangeset
for help on using the changeset viewer.