VirtualBox

Changeset 104529 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
May 7, 2024 9:43:37 AM (7 months ago)
Author:
vboxsync
Message:

Audio/HDA: Fixed recording on newer Windows versions (Windows 10): Those control the recording volume and muted state using a different codec node ID (see comments in patch) for the STAC9220 codec. When rebooting the guest, Windows mutes recording and re-enables it on a not-

yet-handled ADC (analog to digital converter). bugref:10682

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

Legend:

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

    r98103 r104529  
    806806    AssertCompile(STAC9221_NUM_NODES <= RT_ELEMENTS(pThis->aNodes));
    807807    pCfg->cTotalNodes       = STAC9221_NUM_NODES;
    808     pCfg->idxAdcVolsLineIn  = STAC9220_NID_AMP_ADC0;
     808    pCfg->idxAdcVolsLineIn  = STAC9220_NID_AMP_ADC0; /* We treat ADC0 as Line-In. */
     809    pCfg->idxAdcVolsMicIn   = STAC9220_NID_AMP_ADC1; /* We treat ADC1 as Mic-In. */
    809810    pCfg->idxDacLineOut     = STAC9220_NID_DAC1;
    810811
     
    21062107            hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), uCmd, 0);
    21072108
    2108         /*
    2109          * Check if the node ID is the one we use for controlling the line-in volume;
    2110          * with STAC9220 this is connected to STAC9220_NID_AMP_ADC0 (ID 0x17).
    2111          *
    2112          * If we don't do this check here, some guests like newer Ubuntus mute mic-in
    2113          * afterwards (connected to STAC9220_NID_AMP_ADC1 (ID 0x18)). This then would
    2114          * also mute line-in, which breaks audio recording.
    2115          *
    2116          * See STAC9220 V1.0 01/08, p. 30 + oem2ticketref:53.
    2117          */
    2118         if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsLineIn)
    2119             hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
    2120 
    2121 #ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    2122 # error "Implement mic-in volume / mute setting."
    2123         else if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsMicIn)
    2124             hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_MIC_IN);
     2109        switch (pThis->Cfg.enmType)
     2110        {
     2111            case CODECTYPE_STAC9220:
     2112            {
     2113                /*
     2114                 * Check if the node ID is the one we use for controlling the recording (capturing) volume + mute status.
     2115                 *
     2116                 * The STAC9220 codec is connected to STAC9220_NID_AMP_ADC0 (ID 0x17) and
     2117                 * STAC9220_NID_AMP_ADC0 (ID 0x18).
     2118                 *
     2119                 * If we don't do this check here, some guests like newer Ubuntus mute mic-in
     2120                 * afterwards (connected to STAC9220_NID_AMP_ADC1 (ID 0x18)). This then would
     2121                 * also mute line-in, which breaks audio recording.
     2122                 *
     2123                 * See STAC9220 V1.0 01/08, p. 30 + @oem2ticketref{53}.
     2124                 */
     2125                if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsLineIn)
     2126                    hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
     2127
     2128#ifdef VBOX_AUDIO_HDA_MIC_IN_AS_LINE_IN
     2129                /* Newer Windows 10 versions use STAC9220_NID_AMP_ADC1 (ID 0x18) for microphone
     2130                 * volume control by default. */
     2131# ifndef VBOX_WITH_AUDIO_HDA_MIC_IN
     2132                /* If we don't implement dedicated microphone-in support (we then only offer recording via line-in),
     2133                 * make sure to propagate volume control from mic-in to our line-in mixer control.  See @oem2ticketref{93}. */
     2134                else if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsMicIn)
     2135                    hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
     2136# endif
    21252137#endif
    2126 
     2138                break;
     2139            }
     2140
     2141            default:
     2142                /* Nothing to do here. */
     2143                break;
     2144        }
    21272145    }
    21282146    if (fIsOut)
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.h

    r98103 r104529  
    837837    uint8_t         cTotalNodes;
    838838    uint8_t         idxAdcVolsLineIn;
     839    uint8_t         idxAdcVolsMicIn;
    839840    uint8_t         idxDacLineOut;
    840841
    841842    /** Align the lists below so they don't cross cache lines (assumes
    842843     *  CODEC_NODES_MAX is 32). */
    843     uint8_t const   abPadding1[CODEC_NODES_MAX - 15];
     844    uint8_t const   abPadding1[CODEC_NODES_MAX - 16];
    844845
    845846    /** @name Node classifications.
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