Changeset 88918 in vbox
- Timestamp:
- May 6, 2021 10:17:08 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144253
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r88917 r88918 661 661 662 662 /** 663 * Controls a mixer sink.663 * Enables or disables a mixer sink. 664 664 * 665 665 * @returns VBox status code. … … 667 667 * Individual driver errors are suppressed and ignored. 668 668 * @param pSink Mixer sink to control. 669 * @param enmCmd The command to to perform on the sink and its streams.670 */ 671 int AudioMixerSink Ctl(PAUDMIXSINK pSink, PDMAUDIOSTREAMCMD enmCmd)669 * @param fEnable Whether to enable or disable the sink. 670 */ 671 int AudioMixerSinkEnable(PAUDMIXSINK pSink, bool fEnable) 672 672 { 673 673 AssertPtrReturn(pSink, VERR_INVALID_POINTER); 674 675 /* Only ENABLE/DISABLE is implemented. */ 676 AssertMsgReturn( enmCmd == PDMAUDIOSTREAMCMD_ENABLE 677 || enmCmd == PDMAUDIOSTREAMCMD_DISABLE, 678 ("enmSinkCmd=%d (%s)\n", enmCmd, PDMAudioStrmCmdGetName(enmCmd)), 679 VERR_INVALID_FUNCTION); 674 PDMAUDIOSTREAMCMD const enmCmd = fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE; 680 675 681 676 int rc = RTCritSectEnter(&pSink->CritSect); … … 719 714 } 720 715 } 716 else 717 AssertFailed(); 721 718 722 719 /* 723 720 * Update the sink status. 724 721 */ 725 switch (enmCmd) 726 { 727 case PDMAUDIOSTREAMCMD_ENABLE: 728 /* Make sure to clear any other former flags again by assigning AUDMIXSINK_STS_RUNNING directly. */ 729 pSink->fStatus = AUDMIXSINK_STS_RUNNING; 730 break; 731 732 case PDMAUDIOSTREAMCMD_DISABLE: 733 if (pSink->fStatus & AUDMIXSINK_STS_RUNNING) 734 { 735 /* Set the sink in a pending disable state first. 736 * The final status (disabled) will be set in the sink's iteration. */ 737 pSink->fStatus |= AUDMIXSINK_STS_PENDING_DISABLE; 738 } 739 break; 740 741 default: 742 AssertFailed(/*impossible!*/); 722 if (fEnable) 723 { 724 /* Make sure to clear any other former flags again by assigning AUDMIXSINK_STS_RUNNING directly. */ 725 pSink->fStatus = AUDMIXSINK_STS_RUNNING; 726 } 727 else 728 { 729 if (pSink->fStatus & AUDMIXSINK_STS_RUNNING) 730 { 731 /* Set the sink in a pending disable state first. 732 * The final status (disabled) will be set in the sink's iteration. */ 733 pSink->fStatus |= AUDMIXSINK_STS_PENDING_DISABLE; 734 } 743 735 } 744 736 } -
trunk/src/VBox/Devices/Audio/AudioMixer.h
r88917 r88918 231 231 int AudioMixerSinkCreateStream(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOSTREAMCFG pCfg, 232 232 PPDMDEVINS pDevIns, PAUDMIXSTREAM *ppStream); 233 int AudioMixerSink Ctl(PAUDMIXSINK pSink, PDMAUDIOSTREAMCMD enmCmd);233 int AudioMixerSinkEnable(PAUDMIXSINK pSink, bool fEnable); 234 234 void AudioMixerSinkDestroy(PAUDMIXSINK pSink, PPDMDEVINS pDevIns); 235 235 uint32_t AudioMixerSinkGetReadable(PAUDMIXSINK pSink); -
trunk/src/VBox/Devices/Audio/DevHdaStream.cpp
r88916 r88918 903 903 if ( pStreamR3->pMixSink 904 904 && pStreamR3->pMixSink->pMixSink) 905 rc = AudioMixerSink Ctl(pStreamR3->pMixSink->pMixSink, fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE);905 rc = AudioMixerSinkEnable(pStreamR3->pMixSink->pMixSink, fEnable); 906 906 else 907 907 rc = VINF_SUCCESS; -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r88917 r88918 1024 1024 { 1025 1025 /* First, enable or disable the stream and the stream's sink, if any. */ 1026 rc = AudioMixerSinkCtl(ichac97R3IndexToSink(pThisCC, pStream->u8SD), 1027 fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE); 1026 rc = AudioMixerSinkEnable(ichac97R3IndexToSink(pThisCC, pStream->u8SD), fEnable); 1028 1027 } 1029 1028 -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r88917 r88918 2225 2225 2226 2226 /* First, enable or disable the stream and the stream's sink. */ 2227 int rc = AudioMixerSinkCtl(sb16StreamIndexToSink(pThis, pStream->uIdx), 2228 fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE); 2227 int rc = AudioMixerSinkEnable(sb16StreamIndexToSink(pThis, pStream->uIdx), fEnable); 2229 2228 AssertRCReturn(rc, rc); 2230 2229
Note:
See TracChangeset
for help on using the changeset viewer.