Changeset 65674 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Feb 8, 2017 11:51:37 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r65673 r65674 2674 2674 pStrmCfg->Props.cBits = cBits; 2675 2675 pStrmCfg->Props.fSigned = true; 2676 pStrmCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pStrmCfg->Props.cBits, pStrmCfg->Props.cChannels);2677 2676 } 2678 2677 -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r65673 r65674 1641 1641 streamCfg.Props.cBits = 16; 1642 1642 streamCfg.Props.fSigned = true; 1643 streamCfg.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(streamCfg.Props.cBits, streamCfg.Props.cChannels);1644 1643 1645 1644 rc = ichac97MixerAddDrvStreams(pThis, pMixSink, &streamCfg); -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r65673 r65674 153 153 uint8_t DrvAudioHlpAudFmtToBits(PDMAUDIOFMT enmFmt); 154 154 const char *DrvAudioHlpAudFmtToStr(PDMAUDIOFMT enmFmt); 155 void DrvAudioHlpClearBuf( constPPDMAUDIOPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf, uint32_t cSamples);155 void DrvAudioHlpClearBuf(PPDMAUDIOPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf, uint32_t cSamples); 156 156 uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels); 157 uint32_t DrvAudioHlpCalcBitrate( constPPDMAUDIOPCMPROPS pProps);158 bool DrvAudioHlpPCMPropsAreEqual( const PPDMAUDIOPCMPROPS pPCMProps1, constPPDMAUDIOPCMPROPS pPCMProps2);159 bool DrvAudioHlpPCMPropsAreEqual( const PPDMAUDIOPCMPROPS pPCMProps, constPPDMAUDIOSTREAMCFG pCfg);157 uint32_t DrvAudioHlpCalcBitrate(PPDMAUDIOPCMPROPS pProps); 158 bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pPCMProps1, PPDMAUDIOPCMPROPS pPCMProps2); 159 bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg); 160 160 bool DrvAudioHlpPCMPropsAreValid(const PPDMAUDIOPCMPROPS pProps); 161 int DrvAudioHlpPCMPropsToStreamCfg( constPPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);162 const char *DrvAudioHlpRecSrcToStr( constPDMAUDIORECSOURCE enmRecSource);163 void DrvAudioHlpStreamCfgPrint( constPPDMAUDIOSTREAMCFG pCfg);161 int DrvAudioHlpPCMPropsToStreamCfg(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg); 162 const char *DrvAudioHlpRecSrcToStr(PDMAUDIORECSOURCE enmRecSource); 163 void DrvAudioHlpStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg); 164 164 bool DrvAudioHlpStreamCfgIsValid(const PPDMAUDIOSTREAMCFG pCfg); 165 165 int DrvAudioHlpStreamCfgCopy(PPDMAUDIOSTREAMCFG pDstCfg, const PPDMAUDIOSTREAMCFG pSrcCfg); … … 174 174 PPDMAUDIODEVICE DrvAudioHlpDeviceAlloc(size_t cbData); 175 175 void DrvAudioHlpDeviceFree(PPDMAUDIODEVICE pDev); 176 PPDMAUDIODEVICE DrvAudioHlpDeviceDup( constPPDMAUDIODEVICE pDev, bool fCopyUserData);176 PPDMAUDIODEVICE DrvAudioHlpDeviceDup(PPDMAUDIODEVICE pDev, bool fCopyUserData); 177 177 178 178 int DrvAudioHlpDeviceEnumInit(PPDMAUDIODEVICEENUM pDevEnm); 179 179 void DrvAudioHlpDeviceEnumFree(PPDMAUDIODEVICEENUM pDevEnm); 180 180 int DrvAudioHlpDeviceEnumAdd(PPDMAUDIODEVICEENUM pDevEnm, PPDMAUDIODEVICE pDev); 181 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage);182 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm);183 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup( constPPDMAUDIODEVICEENUM pDevEnm);184 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm);185 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage, bool fCopyUserData);186 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice( constPPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmDir);187 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, constPPDMAUDIODEVICEENUM pDevEnm);181 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage); 182 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm); 183 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(PPDMAUDIODEVICEENUM pDevEnm); 184 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm); 185 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage, bool fCopyUserData); 186 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmDir); 187 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, PPDMAUDIODEVICEENUM pDevEnm); 188 188 189 189 const char *DrvAudioHlpAudDirToStr(PDMAUDIODIR enmDir); … … 191 191 char *DrvAudioHlpAudDevFlagsToStrA(PDMAUDIODEVFLAG fFlags); 192 192 193 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, constPPDMAUDIOPCMPROPS pProps, PDMAUDIOFILEFLAGS fFlags);193 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, PPDMAUDIOPCMPROPS pProps, PDMAUDIOFILEFLAGS fFlags); 194 194 int DrvAudioHlpWAVFileClose(PPDMAUDIOFILE pFile); 195 195 size_t DrvAudioHlpWAVFileGetDataSize(PPDMAUDIOFILE pFile); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r65673 r65674 141 141 * @param cSamples Number of audio samples to clear in the buffer. 142 142 */ 143 void DrvAudioHlpClearBuf( constPPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cSamples)143 void DrvAudioHlpClearBuf(PPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cSamples) 144 144 { 145 145 AssertPtrReturnVoid(pPCMProps); … … 273 273 * @param fCopyUserData Whether to also copy the user data portion or not. 274 274 */ 275 PPDMAUDIODEVICE DrvAudioHlpDeviceDup( constPPDMAUDIODEVICE pDev, bool fCopyUserData)275 PPDMAUDIODEVICE DrvAudioHlpDeviceDup(PPDMAUDIODEVICE pDev, bool fCopyUserData) 276 276 { 277 277 AssertPtrReturn(pDev, NULL); … … 363 363 * @param pDevEnm Device enumeration to duplicate. 364 364 */ 365 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup( constPPDMAUDIODEVICEENUM pDevEnm)365 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(PPDMAUDIODEVICEENUM pDevEnm) 366 366 { 367 367 AssertPtrReturn(pDevEnm, NULL); … … 410 410 * @param fCopyUserData Whether to also copy the user data portion or not. 411 411 */ 412 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm,412 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm, 413 413 PDMAUDIODIR enmUsage, bool fCopyUserData) 414 414 { … … 452 452 * @param pSrcDevEnm Source enumeration to use. 453 453 */ 454 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, constPPDMAUDIODEVICEENUM pSrcDevEnm)454 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm) 455 455 { 456 456 return DrvAudioHlpDeviceEnumCopyEx(pDstDevEnm, pSrcDevEnm, PDMAUDIODIR_ANY, false /* fCopyUserData */); … … 465 465 * @param enmUsage Usage to get default device for. 466 466 */ 467 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice( constPPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage)467 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage) 468 468 { 469 469 AssertPtrReturn(pDevEnm, NULL); … … 491 491 * @param pDevEnm Device enumeration to log. 492 492 */ 493 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, constPPDMAUDIODEVICEENUM pDevEnm)493 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, PPDMAUDIODEVICEENUM pDevEnm) 494 494 { 495 495 AssertPtrReturnVoid(pszDesc); … … 618 618 * @param enmRecSrc Recording source to convert. 619 619 */ 620 const char *DrvAudioHlpRecSrcToStr( constPDMAUDIORECSOURCE enmRecSrc)620 const char *DrvAudioHlpRecSrcToStr(PDMAUDIORECSOURCE enmRecSrc) 621 621 { 622 622 switch (enmRecSrc) … … 767 767 * @param pProps2 Second properties to compare. 768 768 */ 769 bool DrvAudioHlpPCMPropsAreEqual( const PPDMAUDIOPCMPROPS pProps1, constPPDMAUDIOPCMPROPS pProps2)769 bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pProps1, PPDMAUDIOPCMPROPS pProps2) 770 770 { 771 771 AssertPtrReturn(pProps1, false); … … 816 816 return false; 817 817 818 fValid &= pProps->uHz > 0;819 fValid &= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBits, pProps->cChannels);820 821 fValid &= pProps->fSwapEndian == false; /** @todo Handling Big Endian audio data is not supported yet. */818 fValid |= pProps->uHz > 0; 819 fValid |= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBits, pProps->cChannels); 820 821 fValid |= pProps->fSwapEndian == false; /** @todo Handling Big Endian audio data is not supported yet. */ 822 822 823 823 return fValid; … … 832 832 * @param pCfg Stream configuration to compare. 833 833 */ 834 bool DrvAudioHlpPCMPropsAreEqual( const PPDMAUDIOPCMPROPS pProps, constPPDMAUDIOSTREAMCFG pCfg)834 bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pProps, PPDMAUDIOSTREAMCFG pCfg) 835 835 { 836 836 AssertPtrReturn(pProps, false); … … 847 847 * @param pCfg Pointer to audio stream configuration to store result into. 848 848 */ 849 int DrvAudioHlpPCMPropsToStreamCfg( constPPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg)849 int DrvAudioHlpPCMPropsToStreamCfg(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg) 850 850 { 851 851 AssertPtrReturn(pPCMProps, VERR_INVALID_POINTER); … … 939 939 } 940 940 941 AssertPtr(pDst);942 941 return pDst; 943 942 } … … 948 947 * @param pCfg Stream configuration to log. 949 948 */ 950 void DrvAudioHlpStreamCfgPrint( constPPDMAUDIOSTREAMCFG pCfg)949 void DrvAudioHlpStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg) 951 950 { 952 951 AssertPtrReturnVoid(pCfg); … … 1004 1003 * @remark 1005 1004 */ 1006 uint32_t DrvAudioHlpCalcBitrate( constPPDMAUDIOPCMPROPS pProps)1005 uint32_t DrvAudioHlpCalcBitrate(PPDMAUDIOPCMPROPS pProps) 1007 1006 { 1008 1007 return DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels); … … 1138 1137 * @param fFlags Audio file flags. 1139 1138 */ 1140 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, constPPDMAUDIOPCMPROPS pProps,1139 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, PPDMAUDIOPCMPROPS pProps, 1141 1140 PDMAUDIOFILEFLAGS fFlags) 1142 1141 { -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r65673 r65674 469 469 static HRESULT directSoundPlayInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 470 470 { 471 AssertPtrReturn(pThis, E_POINTER);472 AssertPtrReturn(pStreamDS, E_POINTER);473 474 471 if (pStreamDS->Out.pDS != NULL) 475 472 { … … 512 509 static HRESULT directSoundPlayClose(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 513 510 { 514 AssertPtrReturn(pThis, 511 AssertPtrReturn(pThis, E_POINTER); 515 512 AssertPtrReturn(pStreamDS, E_POINTER); 516 513 … … 639 636 RT_ZERO(bc); 640 637 bc.dwSize = sizeof(bc); 641 642 638 hr = IDirectSoundBuffer8_GetCaps(pStreamDS->Out.pDSB, &bc); 643 639 if (FAILED(hr)) … … 774 770 static HRESULT directSoundPlayGetStatus(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB, DWORD *pdwStatus) 775 771 { 776 AssertPtr Return(pThis, E_POINTER);772 AssertPtr(pThis); 777 773 AssertPtrReturn(pDSB, E_POINTER); 778 779 774 AssertPtrNull(pdwStatus); 780 775 … … 848 843 static HRESULT directSoundPlayStart(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 849 844 { 850 AssertPtrReturn(pThis, E_POINTER);845 AssertPtrReturn(pThis, E_POINTER); 851 846 AssertPtrReturn(pStreamDS, E_POINTER); 852 847 … … 891 886 */ 892 887 893 static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PPDMAUDIOSTREAMCFG pCfg) 894 { 895 AssertPtrReturn(pThis, NULL); 896 AssertPtrReturn(pCfg, NULL); 888 static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 889 { 890 AssertPtrReturn(pThis, NULL); 891 AssertPtrReturn(pStreamDS, NULL); 892 AssertPtrReturn(pStreamDS->pCfg, NULL); 897 893 898 894 int rc = VINF_SUCCESS; … … 903 899 PDSOUNDDEV pDev = NULL; 904 900 905 switch (p Cfg->DestSource.Source)901 switch (pStreamDS->pCfg->DestSource.Source) 906 902 { 907 903 case PDMAUDIORECSOURCE_LINE: … … 936 932 { 937 933 DSLOG(("DSound: Guest source '%s' is using host recording device '%s'\n", 938 DrvAudioHlpRecSrcToStr(p Cfg->DestSource.Source), pDev->pszName));934 DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pDev->pszName)); 939 935 940 936 pGUID = &pDev->Guid; … … 952 948 /* This always has to be in the release log. */ 953 949 LogRel(("DSound: Guest source '%s' is using host recording device with GUID '%s'\n", 954 DrvAudioHlpRecSrcToStr(p Cfg->DestSource.Source), pszGUID ? pszGUID: "{?}"));950 DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pszGUID ? pszGUID: "{?}")); 955 951 956 952 if (pszGUID) … … 975 971 976 972 977 static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, PPDMAUDIOSTREAMCFG pCfg) 978 { 979 AssertPtrReturn(pThis, E_POINTER); 980 AssertPtrReturn(pStreamDS, E_POINTER); 981 AssertPtrReturn(pCfg, E_POINTER); 982 973 static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 974 { 983 975 if (pStreamDS->In.pDSC != NULL) 984 976 { … … 995 987 else 996 988 { 997 LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, p Cfg);989 LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pStreamDS); 998 990 hr = IDirectSoundCapture_Initialize(pStreamDS->In.pDSC, pGUID); 999 991 if (FAILED(hr)) … … 1069 1061 return E_INVALIDARG; 1070 1062 1071 HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS , pCfgReq);1063 HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS); 1072 1064 if (FAILED(hr)) 1073 1065 return hr; … … 1288 1280 1289 1281 RTMemFree(pDev); 1290 pDev = NULL;1291 1282 } 1292 1283 } … … 1628 1619 directSoundPlayUnlock(pThis, pDSB, pv1, pv2, cb1, cb2); 1629 1620 1630 pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + cbWrittenTotal) % cbBuffer; 1621 pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal)) 1622 % cbBuffer; 1631 1623 1632 1624 DSLOGF(("DSound: %RU32/%RU32, buffer write pos %ld, rc=%Rrc\n", 1633 cbWrittenTotal, cbLive, pStreamDS->Out.offPlayWritePos, rc));1625 PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal), cbLive, pStreamDS->Out.offPlayWritePos, rc)); 1634 1626 1635 1627 if (pStreamDS->Out.fRestartPlayback)
Note:
See TracChangeset
for help on using the changeset viewer.