VirtualBox

Changeset 88918 in vbox


Ignore:
Timestamp:
May 6, 2021 10:17:08 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144253
Message:

Audio: s/AudioMixerSinkCtl/AudioMixerSinkEnable/ bugref:9890

Location:
trunk/src/VBox/Devices/Audio
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioMixer.cpp

    r88917 r88918  
    661661
    662662/**
    663  * Controls a mixer sink.
     663 * Enables or disables a mixer sink.
    664664 *
    665665 * @returns VBox status code.
     
    667667 *          Individual driver errors are suppressed and ignored.
    668668 * @param   pSink       Mixer sink to control.
    669  * @param   enmCmd      The command to to perform on the sink and its streams.
    670  */
    671 int AudioMixerSinkCtl(PAUDMIXSINK pSink, PDMAUDIOSTREAMCMD enmCmd)
     669 * @param   fEnable     Whether to enable or disable the sink.
     670 */
     671int AudioMixerSinkEnable(PAUDMIXSINK pSink, bool fEnable)
    672672{
    673673    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;
    680675
    681676    int rc = RTCritSectEnter(&pSink->CritSect);
     
    719714            }
    720715        }
     716        else
     717            AssertFailed();
    721718
    722719        /*
    723720         * Update the sink status.
    724721         */
    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            }
    743735        }
    744736    }
  • trunk/src/VBox/Devices/Audio/AudioMixer.h

    r88917 r88918  
    231231int     AudioMixerSinkCreateStream(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOSTREAMCFG pCfg,
    232232                                   PPDMDEVINS pDevIns, PAUDMIXSTREAM *ppStream);
    233 int     AudioMixerSinkCtl(PAUDMIXSINK pSink, PDMAUDIOSTREAMCMD enmCmd);
     233int     AudioMixerSinkEnable(PAUDMIXSINK pSink, bool fEnable);
    234234void AudioMixerSinkDestroy(PAUDMIXSINK pSink, PPDMDEVINS pDevIns);
    235235uint32_t AudioMixerSinkGetReadable(PAUDMIXSINK pSink);
  • trunk/src/VBox/Devices/Audio/DevHdaStream.cpp

    r88916 r88918  
    903903    if (   pStreamR3->pMixSink
    904904        && pStreamR3->pMixSink->pMixSink)
    905         rc = AudioMixerSinkCtl(pStreamR3->pMixSink->pMixSink, fEnable ? PDMAUDIOSTREAMCMD_ENABLE : PDMAUDIOSTREAMCMD_DISABLE);
     905        rc = AudioMixerSinkEnable(pStreamR3->pMixSink->pMixSink, fEnable);
    906906    else
    907907        rc = VINF_SUCCESS;
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r88917 r88918  
    10241024    {
    10251025        /* 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);
    10281027    }
    10291028
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r88917 r88918  
    22252225
    22262226    /* 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);
    22292228    AssertRCReturn(rc, rc);
    22302229
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette