VirtualBox

Changeset 55065 in vbox


Ignore:
Timestamp:
Apr 1, 2015 9:29:05 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99354
Message:

PDM/Audio: Volume handling fixes.

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

Legend:

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

    r55005 r55065  
    4848#include "AudioMixBuffer.h"
    4949
    50 #if 1
     50#if 0
    5151# define AUDMIXBUF_LOG(x) LogFlowFunc(x)
    5252#else
     
    301301        _aType *pSrc = (_aType *)pvSrc; \
    302302        uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \
    303         AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu)\n", pOpts->cSamples, sizeof(_aType))); \
     303        AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu), lVol=%RU32, rVol=%RU32\n", \
     304                             pOpts->cSamples, sizeof(_aType), pOpts->Volume.uLeft, pOpts->Volume.uRight)); \
    304305        for (uint32_t i = 0; i < cSamples; i++) \
    305306        { \
     
    363364    }
    364365
    365 /* audioMixBufConvToS8: 8 bit, signed. */
     366/* audioMixBufConvXXXS8: 8 bit, signed. */
    366367AUDMIXBUF_CONVERT(S8 /* Name */,  int8_t,   INT8_MIN  /* Min */, INT8_MAX   /* Max */, true  /* fSigned */, 8  /* cShift */)
    367 /* audioMixBufConvToU8: 8 bit, unsigned. */
     368/* audioMixBufConvXXXU8: 8 bit, unsigned. */
    368369AUDMIXBUF_CONVERT(U8 /* Name */,  uint8_t,  0         /* Min */, UINT8_MAX  /* Max */, false /* fSigned */, 8  /* cShift */)
    369 /* audioMixBufConvToS16: 16 bit, signed. */
     370/* audioMixBufConvXXXS16: 16 bit, signed. */
    370371AUDMIXBUF_CONVERT(S16 /* Name */, int16_t,  INT16_MIN /* Min */, INT16_MAX  /* Max */, true  /* fSigned */, 16 /* cShift */)
    371 /* audioMixBufConvToU16: 16 bit, unsigned. */
     372/* audioMixBufConvXXXU16: 16 bit, unsigned. */
    372373AUDMIXBUF_CONVERT(U16 /* Name */, uint16_t, 0         /* Min */, UINT16_MAX /* Max */, false /* fSigned */, 16 /* cShift */)
    373 /* audioMixBufConvToS32: 32 bit, signed. */
     374/* audioMixBufConvXXXS32: 32 bit, signed. */
    374375AUDMIXBUF_CONVERT(S32 /* Name */, int32_t,  INT32_MIN /* Min */, INT32_MAX  /* Max */, true  /* fSigned */, 32 /* cShift */)
    375 /* audioMixBufConvToU32: 32 bit, unsigned. */
     376/* audioMixBufConvXXXU32: 32 bit, unsigned. */
    376377AUDMIXBUF_CONVERT(U32 /* Name */, uint32_t, 0         /* Min */, UINT32_MAX /* Max */, false /* fSigned */, 32 /* cShift */)
    377378
     
    636637    /* Set initial volume to max. */
    637638    pMixBuf->Volume.fMuted = false;
    638     pMixBuf->Volume.uLeft  = UINT32_MAX;
    639     pMixBuf->Volume.uRight = UINT32_MAX;
     639    pMixBuf->Volume.uLeft  = 0x7F;
     640    pMixBuf->Volume.uRight = 0x7F;
    640641
    641642    /* Prevent division by zero.
     
    11201121    AssertPtrReturnVoid(pVol);
    11211122
    1122     AUDMIXBUF_LOG(("%s: lVol=%RU32, rVol=%RU32\n", pMixBuf->pszName, pVol->uLeft, pVol->uRight));
    1123 
    1124     pMixBuf->Volume = *pVol;
     1123    LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32\n", pMixBuf->pszName, pVol->uLeft, pVol->uRight));
     1124
     1125    pMixBuf->Volume.fMuted = pVol->fMuted;
     1126    pMixBuf->Volume.uLeft  = uint64_t(0x100000000 * pVol->uLeft ) / 255;
     1127    pMixBuf->Volume.uRight = uint64_t(0x100000000 * pVol->uRight) / 255;
     1128
     1129    LogFlowFunc(("\t-> lVol=%RU32, rVol=%RU32\n", pMixBuf->Volume.uLeft, pMixBuf->Volume.uRight));
    11251130}
    11261131
     
    13461351    uint32_t cWrittenTotal = 0;
    13471352
     1353    AUDMIXBUF_CONVOPTS convOpts;
     1354    convOpts.Volume = pMixBuf->Volume;
     1355
    13481356    /* Anything to do at all? */
    13491357    if (cLenDst1)
    13501358    {
    1351         AUDMIXBUF_CONVOPTS convOpts = { cLenDst1, pMixBuf->Volume };
     1359        convOpts.cSamples = cLenDst1;
    13521360        cWrittenTotal = pConv(pSamplesDst1, pvBuf, cbBuf, &convOpts);
    13531361    }
     
    13591367        AssertPtr(pSamplesDst2);
    13601368
    1361         AUDMIXBUF_CONVOPTS convOpts = { cLenDst2, pMixBuf->Volume };
     1369        convOpts.cSamples = cLenDst2;
    13621370        cWrittenTotal += pConv(pSamplesDst2, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, &convOpts);
    13631371    }
  • trunk/src/VBox/Devices/Audio/AudioMixer.cpp

    r55005 r55065  
    3737#include <VBox/log.h>
    3838
     39
     40int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster, const PPDMAUDIOVOLUME pVolSink);
     41
     42
    3943int audioMixerAddSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink)
    4044{
     
    6165            /* Set initial volume to max. */
    6266            pSink->Volume.fMuted = false;
    63             pSink->Volume.uLeft  = UINT32_MAX;
    64             pSink->Volume.uRight = UINT32_MAX;
     67            pSink->Volume.uLeft  = 0x7F;
     68            pSink->Volume.uRight = 0x7F;
    6569
    6670            RTListAppend(&pMixer->lstSinks, &pSink->Node);
     
    106110        pSink->cStreams++;
    107111
    108         LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n",
    109                      pSink, pMixStream, pSink->cStreams));
     112        LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n",
     113                     pSink->pszName, pMixStream, pSink->cStreams));
    110114
    111115        if (ppStream)
     
    144148        pSink->cStreams++;
    145149
    146         LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n",
    147                      pSink, pMixStream, pSink->cStreams));
     150        LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n",
     151                     pSink->pszName, pMixStream, pSink->cStreams));
    148152
    149153        if (ppStream)
     
    205209    if (pMixer)
    206210    {
    207         LogFlowFunc(("Destroying %p ...\n", pMixer));
     211        LogFlowFunc(("Destroying %s ...\n", pMixer->pszName));
    208212
    209213        PAUDMIXSINK pSink = RTListGetFirst(&pMixer->lstSinks, AUDMIXSINK, Node);
     
    260264
    261265    return cStreams;
     266}
     267
     268void audioMixerInvalidate(PAUDIOMIXER pMixer)
     269{
     270    AssertPtrReturnVoid(pMixer);
     271
     272    LogFlowFunc(("%s: Invalidating ...\n", pMixer->pszName));
     273
     274    /* Propagate new master volume to all connected sinks. */
     275    PAUDMIXSINK pSink;
     276    RTListForEach(&pMixer->lstSinks, pSink, AUDMIXSINK, Node)
     277    {
     278        int rc2 = audioMixerUpdateSinkVolume(pSink, &pMixer->VolMaster, &pSink->Volume);
     279        AssertRC(rc2);
     280    }
    262281}
    263282
     
    356375    pMixer->cSinks--;
    357376
    358     LogFlowFunc(("pMixer=%p, pSink=%p, cSinks=%RU8\n",
    359                  pMixer, pSink, pMixer->cSinks));
     377    LogFlowFunc(("%s: pSink=%s, cSinks=%RU8\n",
     378                 pMixer->pszName, pSink->pszName, pMixer->cSinks));
    360379
    361380    audioMixerDestroySink(pSink);
     
    372391    pSink->cStreams--;
    373392
    374     LogFlowFunc(("pSink=%p, pStream=%p, cStreams=%RU8\n",
    375                  pSink, pStream, pSink->cStreams));
     393    const char *pszStream = pSink->enmDir == AUDMIXSINKDIR_INPUT
     394                          ? pStream->pIn->MixBuf.pszName : pStream->pOut->MixBuf.pszName;
     395
     396    LogFlowFunc(("%s: pStream=%s, cStreams=%RU8\n",
     397                 pSink->pszName, pszStream, pSink->cStreams));
    376398
    377399    audioMixerDestroyStream(pStream);
     
    389411}
    390412
    391 static PDMAUDIOVOLUME audioMixerTranslateVolume(const PPDMAUDIOVOLUME pVolMaster, PPDMAUDIOVOLUME pVol)
    392 {
    393     PDMAUDIOVOLUME volMaster = *pVolMaster;
    394 
    395     uint32_t u32VolumeLeft  = (uint32_t)pVol->uLeft;
    396     uint32_t u32VolumeRight = (uint32_t)pVol->uRight;
     413static inline PDMAUDIOVOLUME audioMixerVolCalc(PPDMAUDIOVOLUME pVol)
     414{
     415    uint32_t u32VolumeLeft  = pVol->uLeft;
     416    uint32_t u32VolumeRight = pVol->uRight;
    397417    /* 0x00..0xff => 0x01..0x100 */
    398418    if (u32VolumeLeft)
     
    401421        u32VolumeRight++;
    402422
    403     volMaster.uLeft  = u32VolumeLeft  * 0x800000; /* Maximum is 0x80000000 */
    404     volMaster.uRight = u32VolumeRight * 0x800000; /* Maximum is 0x80000000 */
    405 
    406423    PDMAUDIOVOLUME volOut;
    407     volOut.fMuted = volMaster.fMuted || pVol->fMuted;
    408     volOut.uLeft  = ASMMultU64ByU32DivByU32(volMaster.uLeft,  pVol->uLeft,  0x80000000U); /* Maximum is 0x80000000U */
    409     volOut.uRight = ASMMultU64ByU32DivByU32(volMaster.uRight, pVol->uRight, 0x80000000U); /* Maximum is 0x80000000U */
    410 
    411     LogFlowFunc(("pMaster=%p, lVol=%RU32, rVol=%RU32\n",
    412                  pVolMaster, pVolMaster->uLeft, pVolMaster->uRight));
    413     LogFlowFunc(("pVol=%p, lVol=%RU32, rVol=%RU32 => lVol=%RU32, rVol=%RU32\n",
    414                  pVol, pVol->uLeft, pVol->uRight, volOut.uLeft, volOut.uRight));
     424    volOut.fMuted = pVol->fMuted;
     425    volOut.uLeft  = u32VolumeLeft  * 0x80000000; /* Maximum is 0x80000000 */
     426    volOut.uRight = u32VolumeRight * 0x80000000; /* Maximum is 0x80000000 */
    415427
    416428    return volOut;
    417429}
    418430
    419 int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol)
    420 {
    421     AssertPtrReturn(pMixer, VERR_INVALID_POINTER);
    422     AssertPtrReturn(pVol, VERR_INVALID_POINTER);
    423 
    424     pMixer->VolMaster = audioMixerTranslateVolume(&pMixer->VolMaster,  pVol);
    425 #if 0
    426         .uLeft  = pVol->uLeft  * 0x800000; /* maximum is 0x80000000 */
    427     pMixer->VolMaster.uRight = pVol->uRight * 0x800000; /* maximum is 0x80000000 */
    428 #endif
    429     LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32 => lVol=%RU32, rVol=%RU32\n",
    430                   pVol->uLeft, pVol->uRight, pMixer->VolMaster.uLeft, pMixer->VolMaster.uRight));
    431 
    432     return VINF_SUCCESS;
    433 }
    434 
    435 int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol)
    436 {
    437     AssertPtrReturn(pSink, VERR_INVALID_POINTER);
    438     AssertPtrReturn(pVol, VERR_INVALID_POINTER);
    439 
    440     LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32\n", pSink->pszName, pVol->uLeft, pVol->uRight));
    441 
    442     pSink->Volume.uLeft  = pVol->uLeft  * 0x808080; /* Maximum is INT_MAX = 0x7fffffff */
    443     pSink->Volume.uRight = pVol->uRight * 0x808080; /* Maximum is INT_MAX = 0x7fffffff */
    444 
    445     /** @todo Apply the mixer's master volume to it. */
     431static inline PDMAUDIOVOLUME audioMixerVolMix(const PPDMAUDIOVOLUME pVolMaster, PPDMAUDIOVOLUME pVol)
     432{
     433    PDMAUDIOVOLUME volOut;
     434    volOut.fMuted = pVolMaster->fMuted || pVol->fMuted;
     435    volOut.uLeft  = ASMMultU64ByU32DivByU32(pVolMaster->uLeft,  pVol->uLeft,  0x80000000U); /* Maximum is 0x80000000U */
     436    volOut.uRight = ASMMultU64ByU32DivByU32(pVolMaster->uRight, pVol->uRight, 0x80000000U); /* Maximum is 0x80000000U */
     437
     438    LogFlowFunc(("pMaster=%p, fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     439                 pVolMaster, pVolMaster->fMuted, pVolMaster->uLeft, pVolMaster->uRight));
     440    LogFlowFunc(("pVol=%p, fMuted=%RTbool, lVol=%RU32, rVol=%RU32 => fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     441                 pVol, pVol->fMuted, pVol->uLeft, pVol->uRight, volOut.fMuted, volOut.uLeft, volOut.uRight));
     442
     443    return volOut;
     444}
     445
     446int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster, const PPDMAUDIOVOLUME pVolSink)
     447{
     448    AssertPtrReturn(pSink,      VERR_INVALID_POINTER);
     449    AssertPtrReturn(pVolMaster, VERR_INVALID_POINTER);
     450    AssertPtrReturn(pVolSink,   VERR_INVALID_POINTER);
     451
     452    LogFlowFunc(("Master fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     453                  pVolMaster->fMuted, pVolMaster->uLeft, pVolMaster->uRight));
     454    LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     455                  pSink->pszName, pSink->Volume.fMuted, pSink->Volume.uLeft, pSink->Volume.uRight));
    446456
    447457    /** @todo Very crude implementation for now -- needs more work! */
     458
     459    PDMAUDIOVOLUME volSink;
     460    volSink.fMuted  = pVolMaster->fMuted || pVolSink->fMuted;
     461    volSink.uLeft   = (pVolSink->uLeft  * pVolMaster->uLeft)  / UINT8_MAX;
     462    volSink.uRight  = (pVolSink->uRight * pVolMaster->uRight) / UINT8_MAX;
     463
     464    LogFlowFunc(("\t-> fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     465                  volSink.fMuted, volSink.uLeft, volSink.uRight));
    448466
    449467    bool fOut = pSink->enmDir == AUDMIXSINKDIR_OUTPUT;
     
    454472    {
    455473        if (fOut)
    456             audioMixBufSetVolume(&pStream->pOut->MixBuf, &pSink->Volume);
     474            audioMixBufSetVolume(&pStream->pOut->MixBuf, &volSink);
    457475        else
    458             audioMixBufSetVolume(&pStream->pIn->MixBuf,  &pSink->Volume);
     476            audioMixBufSetVolume(&pStream->pIn->MixBuf,  &volSink);
    459477    }
    460478
     
    462480}
    463481
     482int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol)
     483{
     484    AssertPtrReturn(pMixer, VERR_INVALID_POINTER);
     485    AssertPtrReturn(pVol,   VERR_INVALID_POINTER);
     486
     487    pMixer->VolMaster = *pVol; //= audioMixerVolCalc(pVol);
     488
     489    LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32 => fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
     490                 pMixer->pszName, pVol->uLeft, pVol->uRight,
     491                 pMixer->VolMaster.fMuted, pMixer->VolMaster.uLeft, pMixer->VolMaster.uRight));
     492
     493    audioMixerInvalidate(pMixer);
     494    return VINF_SUCCESS;
     495}
     496
     497int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol)
     498{
     499    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
     500    AssertPtrReturn(pVol,  VERR_INVALID_POINTER);
     501
     502    LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", pSink->pszName, pVol->fMuted, pVol->uLeft, pVol->uRight));
     503
     504    AssertPtr(pSink->pParent);
     505    return audioMixerUpdateSinkVolume(pSink, &pSink->pParent->VolMaster, pVol);
     506}
     507
  • trunk/src/VBox/Devices/Audio/AudioMixer.h

    r55005 r55065  
    9999void audioMixerDestroy(PAUDIOMIXER pMixer);
    100100uint32_t audioMixerGetStreamCount(PAUDIOMIXER pMixer);
     101void audioMixerInvalidate(PAUDIOMIXER pMixer);
    101102int audioMixerProcessSinkIn(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, size_t cbBuf, uint32_t *pcbProcessed);
    102103int audioMixerProcessSinkOut(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, size_t cbBuf, uint32_t *pcbProcessed);
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r55005 r55065  
    717717        rc = VINF_SUCCESS;
    718718    }
     719
     720    audioMixerInvalidate(pThis->pMixer);
    719721#else
    720722    if (freq)
     
    847849    lvol = 255 * lvol / VOL_MASK;
    848850
    849     LogFunc(("mt=%ld, val=%RU32\n", mt, val));
     851    LogFunc(("mt=%ld, val=%RU32, mute=%RTbool\n", mt, val, RT_BOOL(mute)));
    850852
    851853#ifdef SOFT_VOLUME
     
    981983        audioMixerDestroy(pThis->pMixer);
    982984        pThis->pMixer = NULL;
     985    }
     986
     987    int rc2 = audioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer);
     988    if (RT_SUCCESS(rc2))
     989    {
     990        /* Set a default audio format for our mixer. */
     991        PDMAUDIOSTREAMCFG streamCfg;
     992        streamCfg.uHz           = 41000;
     993        streamCfg.cChannels     = 2;
     994        streamCfg.enmFormat     = AUD_FMT_S16;
     995        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANESS;
     996
     997        rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);
     998        AssertRC(rc2);
     999
     1000        /* Add all required audio sinks. */
     1001        rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",
     1002                               AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);
     1003        AssertRC(rc2);
     1004
     1005        rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Line In",
     1006                                AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn);
     1007        AssertRC(rc2);
     1008
     1009        rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In",
     1010                                AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn);
     1011        AssertRC(rc2);
    9831012    }
    9841013#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     
    10291058#endif
    10301059
    1031 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1032     int rc2 = audioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer);
    1033     if (RT_SUCCESS(rc2))
    1034     {
    1035         /* Set a default audio format for our mixer. */
    1036         PDMAUDIOSTREAMCFG streamCfg;
    1037         streamCfg.uHz           = 41000;
    1038         streamCfg.cChannels     = 2;
    1039         streamCfg.enmFormat     = AUD_FMT_S16;
    1040         streamCfg.enmEndianness = PDMAUDIOHOSTENDIANESS;
    1041 
    1042         rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);
    1043         AssertRC(rc2);
    1044 
    1045         /* Add all required audio sinks. */
    1046         rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",
    1047                                AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);
    1048         AssertRC(rc2);
    1049 
    1050         rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Line In",
    1051                                 AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn);
    1052         AssertRC(rc2);
    1053 
    1054         rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In",
    1055                                 AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn);
    1056         AssertRC(rc2);
    1057     }
    1058 #endif
    1059 
    10601060    /* Reset all streams. */
    10611061    uint8_t active[LAST_INDEX] = { 0 };
     
    13281328        if (RT_SUCCESS(rc))
    13291329        {
     1330#ifdef DEBUG_TIMER
    13301331            LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
    1331 
     1332#endif
    13321333            if (cSamplesLive)
    13331334            {
    13341335                uint32_t cSamplesPlayed;
    13351336                int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed);
     1337#ifdef DEBUG_TIMER
    13361338                if (RT_SUCCESS(rc2))
    13371339                    LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n",
    13381340                                 pDrv->uLUN, cSamplesLive, cSamplesPlayed));
    1339 
     1341#endif
    13401342                if (cSamplesPlayed)
    13411343                {
    13421344                    rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
    13431345                                                          &cbIn, &cbOut, &cSamplesLive);
     1346#ifdef DEBUG_TIMER
    13441347                    if (RT_SUCCESS(rc))
    13451348                        LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
     1349#endif
    13461350                }
    13471351            }
     
    13521356    }
    13531357
     1358#ifdef DEBUG_TIMER
    13541359    LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin));
     1360#endif
    13551361
    13561362    if (cbOutMin == UINT32_MAX)
  • trunk/src/VBox/Devices/Audio/DevIchHda.cpp

    r55005 r55065  
    564564    /** PCM output stream. */
    565565    R3PTRTYPE(PPDMAUDIOGSTSTRMOUT)     pStrmOut;
     566    /** Mixer handle for line output stream. */
     567    R3PTRTYPE(PAUDMIXSTREAM)           phStrmOut;
    566568} HDAOUTPUTSTREAM, *PHDAOUTPUTSTREAM;
    567569
     
    24572459    }
    24582460
    2459     int rc;
     2461    int rc = VINF_SUCCESS;
    24602462    char *pszDesc;
    24612463
     
    24902492{
    24912493    int rc = VINF_SUCCESS;
     2494    char *pszDesc;
    24922495
    24932496    PHDADRIVER pDrv;
    24942497    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
    24952498    {
    2496         int rc2 = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszName, pCfg, &pDrv->Out.pStrmOut);
    2497         if (RT_FAILURE(rc2))
    2498         {
    2499             LogFunc(("LUN#%RU8: Opening stream \"%s\" failed, rc=%Rrc\n", pDrv->uLUN, pszName, rc2));
    2500             if (RT_SUCCESS(rc))
    2501                 rc = rc2;
    2502             /* Keep going. */
     2499        if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] %s", pDrv->uLUN, pszName) <= 0)
     2500        {
     2501            rc = VERR_NO_MEMORY;
     2502            break;
    25032503        }
     2504
     2505        rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut);
     2506        LogFlowFunc(("LUN#%RU8: Opened output \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc));
     2507        if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
     2508        {
     2509            audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut);
     2510            rc = audioMixerAddStreamOut(pThis->pSinkOutput,
     2511                                        pDrv->pConnector, pDrv->Out.pStrmOut,
     2512                                        0 /* uFlags */, &pDrv->Out.phStrmOut);
     2513        }
     2514
     2515        RTStrFree(pszDesc);
    25042516    }
    25052517
     
    25352547
    25362548    PHDADRIVER pDrv;
    2537 
    2538     LogFlowFuncEnter();
    25392549
    25402550    uint32_t cbIn, cbOut, cSamplesLive;
     
    25452555        if (RT_SUCCESS(rc))
    25462556        {
     2557#ifdef DEBUG_TIMER
    25472558            LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
    2548 
     2559#endif
    25492560            if (cSamplesLive)
    25502561            {
     
    25572568                rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
    25582569                                                      &cbIn, &cbOut, &cSamplesLive);
     2570#ifdef DEBUG_TIMER
    25592571                if (RT_SUCCESS(rc))
    25602572                    LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
     2573#endif
    25612574            }
    25622575
     
    25662579    }
    25672580
     2581#ifdef DEBUG_TIMER
    25682582    LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin));
     2583#endif
    25692584
    25702585    if (cbOutMin == UINT32_MAX)
     
    25872602
    25882603    TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks);
    2589 
    2590     LogFlowFuncLeave();
    25912604
    25922605    STAM_PROFILE_STOP(&pThis->StatTimer, a);
  • trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp

    r53567 r55065  
    13481348        if (fIsRight)
    13491349            hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), cmd, 0);
     1350
     1351        /** @todo Fix ID of u8AdcVolsLineIn! */
     1352#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
     1353        hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
     1354#else
     1355        hdaCodecToAudVolume(pAmplifier, AUD_MIXER_LINE_IN);
     1356#endif
    13501357    }
    13511358    if (fIsOut)
     
    13551362        if (fIsRight)
    13561363            hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_OUT, AMPLIFIER_RIGHT, u8Index), cmd, 0);
    1357     }
    1358     if (CODEC_NID(cmd) == pThis->u8DacLineOut)
     1364
     1365        /** @todo Fix ID of u8DacLineOut! */
    13591366#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    13601367        hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_VOLUME);
     
    13621369        hdaCodecToAudVolume(pAmplifier, AUD_MIXER_VOLUME);
    13631370#endif
    1364 
    1365     if (CODEC_NID(cmd) == pThis->u8AdcVolsLineIn) /* Microphone */
    1366 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1367         hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
    1368 #else
    1369         hdaCodecToAudVolume(pAmplifier, AUD_MIXER_LINE_IN);
    1370 #endif
     1371    }
    13711372
    13721373    return VINF_SUCCESS;
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