VirtualBox

Changeset 55380 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 22, 2015 2:14:48 PM (10 years ago)
Author:
vboxsync
Message:

Audio: Implemented muting of streams.

File:
1 edited

Legend:

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

    r55351 r55380  
    489489#undef AUDMIXBUF_MACRO_LOG
    490490
     491/** Dummy conversion used when the source is muted. */
     492AUDMIXBUF_MACRO_FN uint32_t audioMixBufConvFromSilence(PPDMAUDIOSAMPLE paDst, const void *pvSrc,
     493                                                       uint32_t cbSrc, const PAUDMIXBUF_CONVOPTS pOpts)
     494{
     495    /* Internally zero always corresponds to silence. */
     496    memset(paDst, 0, pOpts->cSamples * sizeof(paDst[0]));
     497    return pOpts->cSamples;
     498}
     499
    491500/**
    492501 *
    493502 ** @todo Speed up the lookup by binding it to the actual stream state.
    494503 *
    495  * @return  IPRT status code.
    496504 * @return  PAUDMIXBUF_FN_CONVFROM
    497  * @param   enmFmt
     505 * @param   enmFmt      The source audio stream format
     506 * @param   fMuted      Flag determining whether the source is muted
    498507 */
    499 static inline PAUDMIXBUF_FN_CONVFROM audioMixBufConvFromLookup(PDMAUDIOMIXBUFFMT enmFmt)
    500 {
     508static inline PAUDMIXBUF_FN_CONVFROM audioMixBufConvFromLookup(PDMAUDIOMIXBUFFMT enmFmt, bool fMuted)
     509{
     510    if (fMuted)
     511        return audioMixBufConvFromSilence;
     512
    501513    if (AUDMIXBUF_FMT_SIGNED(enmFmt))
    502514    {
     
    12351247        return VERR_BUFFER_OVERFLOW;
    12361248
    1237     PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt);
     1249    PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt, pMixBuf->Volume.fMuted);
    12381250    if (!pConv)
    12391251        return VERR_NOT_SUPPORTED;
     
    13171329    }
    13181330
    1319     PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt);
     1331    PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt, pMixBuf->Volume.fMuted);
    13201332    if (!pConv)
    13211333        return VERR_NOT_SUPPORTED;
Note: See TracChangeset for help on using the changeset viewer.

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