Changeset 61723 in vbox
- Timestamp:
- Jun 15, 2016 3:21:15 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108093
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r61668 r61723 385 385 pSink->pszName, fFlags, pCfg->enmDir, DrvAudioHlpAudFmtToStr(pCfg->enmFormat), pCfg->cChannels, pCfg->uHz)); 386 386 387 PDMAUDIOSTREAMCFG CfgSink; 388 int rc = DrvAudioHlpPCMPropsToStreamCfg(&pSink->PCMProps, &CfgSink); 387 /* 388 * Initialize the host-side configuration for the stream to be created. 389 * Always use the sink's PCM audio format as the host side when creating a stream for it. 390 */ 391 PDMAUDIOSTREAMCFG CfgHost; 392 int rc = DrvAudioHlpPCMPropsToStreamCfg(&pSink->PCMProps, &CfgHost); 389 393 AssertRCReturn(rc, rc); 390 394 … … 393 397 if (pSink->enmDir == AUDMIXSINKDIR_INPUT) 394 398 { 395 Cfg Sink.DestSource.Source = PDMAUDIORECSOURCE_UNKNOWN;396 Cfg Sink.enmDir = PDMAUDIODIR_IN;399 CfgHost.DestSource.Source = pCfg->DestSource.Source; 400 CfgHost.enmDir = PDMAUDIODIR_IN; 397 401 } 398 402 else 399 403 { 400 CfgSink.DestSource.Dest = PDMAUDIOPLAYBACKDEST_UNKNOWN; 401 CfgSink.enmDir = PDMAUDIODIR_OUT; 402 } 403 404 RTStrPrintf(CfgSink.szName, sizeof(CfgSink.szName), "%s", pCfg->szName); 405 406 /* Always use the sink's PCM audio format as the host side when creating a stream for it. */ 404 CfgHost.DestSource.Dest = pCfg->DestSource.Dest; 405 CfgHost.enmDir = PDMAUDIODIR_OUT; 406 } 407 408 RTStrPrintf(CfgHost.szName, sizeof(CfgHost.szName), "%s", pCfg->szName); 409 407 410 PPDMAUDIOSTREAM pStream; 408 rc = pConn->pfnStreamCreate(pConn, &Cfg Sink, pCfg, &pStream);411 rc = pConn->pfnStreamCreate(pConn, &CfgHost, pCfg, &pStream); 409 412 if (RT_SUCCESS(rc)) 410 413 { … … 1061 1064 LogFlowFunc(("%s: enmOp=%ld, cbBuf=%RU32\n", pSink->pszName, enmOp, cbBuf)); 1062 1065 1063 uint32_t cPlayed;1064 1066 uint32_t cbProcessed; 1065 1067 … … 1179 1181 1180 1182 bool fIsActive = 1181 (pMixStream->pConn->pfnStreamGetStatus(pMixStream->pConn, pMixStream->pStream) & PDMAUDIOSTRMSTS_FLAG_ENABLED);1183 RT_BOOL(pMixStream->pConn->pfnStreamGetStatus(pMixStream->pConn, pMixStream->pStream) & PDMAUDIOSTRMSTS_FLAG_ENABLED); 1182 1184 1183 1185 return fIsActive; -
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r61668 r61723 2687 2687 if (fUseFront) 2688 2688 { 2689 if (!RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Front")) 2690 { 2691 rc = VERR_BUFFER_OVERFLOW; 2692 break; 2693 } 2694 2689 RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Front"); 2695 2690 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 2696 2691 pCfg->cChannels = 2; 2692 2697 2693 rc = hdaCodecRemoveStream(pThis->pCodec, PDMAUDIOMIXERCTL_FRONT); 2698 2694 if (RT_SUCCESS(rc)) … … 2704 2700 && (fUseCenter || fUseLFE)) 2705 2701 { 2706 if (!RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Center/LFE")) 2707 { 2708 rc = VERR_BUFFER_OVERFLOW; 2709 break; 2710 } 2711 2702 RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Center/LFE"); 2712 2703 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_CENTER_LFE; 2713 2704 pCfg->cChannels = (fUseCenter && fUseLFE) ? 2 : 1; 2705 2714 2706 rc = hdaCodecRemoveStream(pThis->pCodec, PDMAUDIOMIXERCTL_CENTER_LFE); 2715 2707 if (RT_SUCCESS(rc)) … … 2720 2712 && fUseRear) 2721 2713 { 2722 if (!RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Rear")) 2723 { 2724 rc = VERR_BUFFER_OVERFLOW; 2725 break; 2726 } 2727 2714 RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Rear"); 2728 2715 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_REAR; 2729 2716 pCfg->cChannels = 2; 2717 2730 2718 rc = hdaCodecRemoveStream(pThis->pCodec, PDMAUDIOMIXERCTL_REAR); 2731 2719 if (RT_SUCCESS(rc)) … … 2812 2800 #else 2813 2801 strmCfg.DestSource.Source = PDMAUDIORECSOURCE_LINE; 2802 RTStrPrintf(strmCfg.szName, RT_ELEMENTS(strmCfg.szName), "Line In"); 2814 2803 #endif 2815 2804 break; … … 3787 3776 { 3788 3777 int rc2 = VINF_SUCCESS; 3789 PHDAMIXERSTREAM pStream ;3778 PHDAMIXERSTREAM pStream = NULL; 3790 3779 3791 3780 if (pCfg->enmDir == PDMAUDIODIR_IN) 3792 3781 { 3782 LogFunc(("enmRecSource=%ld\n", pCfg->DestSource.Source)); 3783 3793 3784 switch (pCfg->DestSource.Source) 3794 3785 { … … 3808 3799 else if (pCfg->enmDir == PDMAUDIODIR_OUT) 3809 3800 { 3801 LogFunc(("enmPlaybackDest=%ld\n", pCfg->DestSource.Dest)); 3802 3810 3803 switch (pCfg->DestSource.Dest) 3811 3804 { … … 3831 3824 if (RT_SUCCESS(rc2)) 3832 3825 { 3826 AssertPtr(pStream); 3827 3833 3828 AudioMixerSinkRemoveStream(pSink->pMixSink, pStream->pMixStrm); 3834 3829 -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r61609 r61723 894 894 AssertPtrReturn(pDSoundStream, NULL); 895 895 896 int rc = VINF_SUCCESS; 897 896 898 LPCGUID pGUID = pThis->cfg.pGuidCapture; 897 898 899 if (!pGUID) 899 900 { 900 PDSOUNDDEV 901 PDSOUNDDEV pDev = NULL; 901 902 902 903 switch (pDSoundStream->enmRecSource) 903 904 { 905 case PDMAUDIORECSOURCE_LINE: 906 /* 907 * At the moment we're only supporting line-in in the HDA emulation, 908 * and line-in + mic-in in the AC'97 emulation both are expected 909 * to use the host's mic-in as well. 910 * 911 * So the fall through here is intentional for now. 912 */ 904 913 case PDMAUDIORECSOURCE_MIC: 905 914 { … … 909 918 break; 910 919 } 920 911 921 if (RTListNodeIsDummy(&pThis->lstDevInput, pDev, DSOUNDDEV, Node)) 912 pDev = NULL; 922 pDev = NULL; /* Found nothing. */ 913 923 914 924 break; 915 925 } 916 926 917 case PDMAUDIORECSOURCE_LINE:918 927 default: 919 /* Try opening the default device (NULL). */928 AssertFailedStmt(rc = VERR_NOT_SUPPORTED); 920 929 break; 921 930 } 922 931 923 if (pDev) 924 { 925 DSLOG(("DSound: Guest \"%s\" is using host \"%s\"\n", 932 if ( RT_SUCCESS(rc) 933 && pDev) 934 { 935 DSLOG(("DSound: Guest source '%s' is using host recording device '%s'\n", 926 936 DrvAudioHlpRecSrcToStr(pDSoundStream->enmRecSource), pDev->pszName)); 927 937 … … 930 940 } 931 941 942 if (RT_FAILURE(rc)) 943 { 944 LogRel(("DSound: Selecting recording device failed with %Rrc\n", rc)); 945 return NULL; 946 } 947 932 948 char *pszGUID = dsoundGUIDToUtf8StrA(pGUID); 949 933 950 /* This always has to be in the release log. */ 934 LogRel(("DSound: Guest \"%s\" is using host device with GUID: %s\n",951 LogRel(("DSound: Guest source '%s' is using host recording device with GUID '%s'\n", 935 952 DrvAudioHlpRecSrcToStr(pDSoundStream->enmRecSource), pszGUID ? pszGUID: "{?}")); 936 RTStrFree(pszGUID); 953 954 if (pszGUID) 955 { 956 RTStrFree(pszGUID); 957 pszGUID = NULL; 958 } 937 959 938 960 return pGUID; … … 1423 1445 LogFlowFunc(("pStream=%p, pCfg=%p\n", pStream, pCfg)); 1424 1446 1425 PDRVHOSTDSOUND pThis= PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);1447 PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface); 1426 1448 PDSOUNDSTREAMOUT pDSoundStream = (PDSOUNDSTREAMOUT)pStream; 1427 1449 … … 1663 1685 static int dsoundDestroyStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 1664 1686 { 1665 PDRVHOSTDSOUND pThis= PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);1687 PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface); 1666 1688 PDSOUNDSTREAMOUT pDSoundStream = (PDSOUNDSTREAMOUT)pStream; 1667 1689 1668 1690 directSoundPlayClose(pThis, pDSoundStream); 1669 1691 1670 pDSoundStream->cbPlayWritePos = 0;1671 pDSoundStream->fRestartPlayback = true;1692 pDSoundStream->cbPlayWritePos = 0; 1693 pDSoundStream->fRestartPlayback = true; 1672 1694 pDSoundStream->csPlaybackBufferSize = 0; 1673 1695 … … 1680 1702 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg, uint32_t *pcSamples) 1681 1703 { 1682 PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface); 1704 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 1705 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 1706 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 1707 1708 PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface); 1683 1709 PDSOUNDSTREAMIN pDSoundStream = (PDSOUNDSTREAMIN)pStream; 1684 1710 1685 LogFlowFunc(("pStream=%p, pAudioSettings=%p, enmRecSource=%ld\n", 1686 pStream, pCfg, pCfg->DestSource.Source)); 1687 1688 pDSoundStream->streamCfg = *pCfg; 1689 pDSoundStream->streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS; 1711 LogFlowFunc(("pStream=%p, pCfg=%p, enmRecSource=%ld\n", pStream, pCfg, pCfg->DestSource.Source)); 1712 1713 memcpy(&pDSoundStream->streamCfg, pCfg, sizeof(PDMAUDIOSTREAMCFG)); 1690 1714 1691 1715 /** @todo caller should already init Props? */ … … 1720 1744 { 1721 1745 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 1722 AssertPtrReturn(pStream, VERR_INVALID_POINTER);1746 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 1723 1747 1724 1748 LogFlowFunc(("pStream=%p, enmStreamCmd=%ld\n", pStream, enmStreamCmd)); … … 1821 1845 break; 1822 1846 1823 /* Using as an intermediate not circular buffer. */1824 AudioMixBufReset(&pStream->MixBuf);1825 1826 1847 /* Get number of free samples in the mix buffer and check that is has free space */ 1827 1848 uint32_t csMixFree = AudioMixBufFree(&pStream->MixBuf); … … 1859 1880 if (pv1 && len1) 1860 1881 { 1861 rc = AudioMixBufWriteAt(&pStream->MixBuf, 0 /* offWrite */, 1862 pv1, cb1, &csWritten); 1882 rc = AudioMixBufWriteCirc(&pStream->MixBuf, pv1, cb1, &csWritten); 1863 1883 if (RT_SUCCESS(rc)) 1864 1884 csWrittenTotal += csWritten; … … 1869 1889 && pv2 && len2) 1870 1890 { 1871 rc = AudioMixBufWriteAt(&pStream->MixBuf, csWrittenTotal, 1872 pv2, cb2, &csWritten); 1891 rc = AudioMixBufWriteCirc(&pStream->MixBuf, pv2, cb2, &csWritten); 1873 1892 if (RT_SUCCESS(rc)) 1874 1893 csWrittenTotal += csWritten;
Note:
See TracChangeset
for help on using the changeset viewer.