summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/Audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/Audio')
-rw-r--r--src/VBox/Devices/Audio/AudioMixer.cpp14
-rw-r--r--src/VBox/Devices/Audio/DevHdaCodec.cpp54
-rw-r--r--src/VBox/Devices/Audio/DevHdaCodec.h3
3 files changed, 48 insertions, 23 deletions
diff --git a/src/VBox/Devices/Audio/AudioMixer.cpp b/src/VBox/Devices/Audio/AudioMixer.cpp
index 899154eb..071e997f 100644
--- a/src/VBox/Devices/Audio/AudioMixer.cpp
+++ b/src/VBox/Devices/Audio/AudioMixer.cpp
@@ -311,9 +311,13 @@ int AudioMixerSetMasterVolume(PAUDIOMIXER pMixer, PCPDMAUDIOVOLUME pVol)
*/
LogFlowFunc(("[%s] fMuted=%RTbool auChannels=%.*Rhxs => fMuted=%RTbool auChannels=%.*Rhxs\n", pMixer->pszName,
pMixer->VolMaster.fMuted, sizeof(pMixer->VolMaster.auChannels), pMixer->VolMaster.auChannels,
- pVol->fMuted, sizeof(pVol->auChannels), pVol->auChannels ));
+ pVol->fMuted, sizeof(pVol->auChannels), pVol->auChannels));
memcpy(&pMixer->VolMaster, pVol, sizeof(PDMAUDIOVOLUME));
+ LogRelMax(256, ("Audio Mixer: %s master volume of '%s' -- channel volumes: %.*Rhxs\n",
+ pMixer->VolMaster.fMuted ? "MUTING" : "Setting",
+ pMixer->pszName, sizeof(pMixer->VolMaster.auChannels), pMixer->VolMaster.auChannels));
+
/*
* Propagate new master volume to all sinks.
*/
@@ -1108,6 +1112,11 @@ static int audioMixerSinkUpdateVolume(PAUDMIXSINK pSink, PCPDMAUDIOVOLUME pVolMa
pSink->Volume.fMuted, sizeof(pSink->Volume.auChannels), pSink->Volume.auChannels,
pSink->VolumeCombined.fMuted, sizeof(pSink->VolumeCombined.auChannels), pSink->VolumeCombined.auChannels ));
+ LogRelMax(256, ("Audio Mixer: %s sink '%s/%s' -- channel volumes: %.*Rhxs\n",
+ pSink->VolumeCombined.fMuted ? "MUTING" : "Setting",
+ pSink->pParent->pszName, pSink->pszName,
+ sizeof(pSink->VolumeCombined.auChannels), pSink->VolumeCombined.auChannels));
+
AudioMixBufSetVolume(&pSink->MixBuf, &pSink->VolumeCombined);
return VINF_SUCCESS;
}
@@ -1131,9 +1140,6 @@ int AudioMixerSinkSetVolume(PAUDMIXSINK pSink, PCPDMAUDIOVOLUME pVol)
memcpy(&pSink->Volume, pVol, sizeof(PDMAUDIOVOLUME));
- LogRel2(("Audio Mixer: Setting volume of sink '%s' to fMuted=%RTbool auChannels=%.*Rhxs\n",
- pSink->pszName, pVol->fMuted, sizeof(pVol->auChannels), pVol->auChannels));
-
Assert(pSink->pParent);
if (pSink->pParent)
rc = audioMixerSinkUpdateVolume(pSink, &pSink->pParent->VolMaster);
diff --git a/src/VBox/Devices/Audio/DevHdaCodec.cpp b/src/VBox/Devices/Audio/DevHdaCodec.cpp
index 9782ac7f..4ea275fd 100644
--- a/src/VBox/Devices/Audio/DevHdaCodec.cpp
+++ b/src/VBox/Devices/Audio/DevHdaCodec.cpp
@@ -805,7 +805,8 @@ static int stac9220Construct(PHDACODECR3 pThis, HDACODECCFG *pCfg)
AssertCompile(STAC9221_NUM_NODES <= RT_ELEMENTS(pThis->aNodes));
pCfg->cTotalNodes = STAC9221_NUM_NODES;
- pCfg->idxAdcVolsLineIn = STAC9220_NID_AMP_ADC0;
+ pCfg->idxAdcVolsLineIn = STAC9220_NID_AMP_ADC0; /* We treat ADC0 as Line-In. */
+ pCfg->idxAdcVolsMicIn = STAC9220_NID_AMP_ADC1; /* We treat ADC1 as Mic-In. */
pCfg->idxDacLineOut = STAC9220_NID_DAC1;
/* Copy over the node class lists and popuplate afNodeClassifications. */
@@ -2105,25 +2106,42 @@ static DECLCALLBACK(int) vrbProcR3SetAmplifier(PHDACODECR3 pThis, uint32_t uCmd,
if (fIsRight)
hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), uCmd, 0);
- /*
- * Check if the node ID is the one we use for controlling the line-in volume;
- * with STAC9220 this is connected to STAC9220_NID_AMP_ADC0 (ID 0x17).
- *
- * If we don't do this check here, some guests like newer Ubuntus mute mic-in
- * afterwards (connected to STAC9220_NID_AMP_ADC1 (ID 0x18)). This then would
- * also mute line-in, which breaks audio recording.
- *
- * See STAC9220 V1.0 01/08, p. 30 + oem2ticketref:53.
- */
- if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsLineIn)
- hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
-
-#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
-# error "Implement mic-in volume / mute setting."
- else if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsMicIn)
- hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_MIC_IN);
+ switch (pThis->Cfg.enmType)
+ {
+ case CODECTYPE_STAC9220:
+ {
+ /*
+ * Check if the node ID is the one we use for controlling the recording (capturing) volume + mute status.
+ *
+ * The STAC9220 codec is connected to STAC9220_NID_AMP_ADC0 (ID 0x17) and
+ * STAC9220_NID_AMP_ADC0 (ID 0x18).
+ *
+ * If we don't do this check here, some guests like newer Ubuntus mute mic-in
+ * afterwards (connected to STAC9220_NID_AMP_ADC1 (ID 0x18)). This then would
+ * also mute line-in, which breaks audio recording.
+ *
+ * See STAC9220 V1.0 01/08, p. 30 + @oem2ticketref{53}.
+ */
+ if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsLineIn)
+ hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
+
+#ifdef VBOX_AUDIO_HDA_MIC_IN_AS_LINE_IN
+ /* Newer Windows 10 versions use STAC9220_NID_AMP_ADC1 (ID 0x18) for microphone
+ * volume control by default. */
+# ifndef VBOX_WITH_AUDIO_HDA_MIC_IN
+ /* If we don't implement dedicated microphone-in support (we then only offer recording via line-in),
+ * make sure to propagate volume control from mic-in to our line-in mixer control. See @oem2ticketref{93}. */
+ else if (CODEC_NID(uCmd) == pThis->Cfg.idxAdcVolsMicIn)
+ hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
+# endif
#endif
+ break;
+ }
+ default:
+ /* Nothing to do here. */
+ break;
+ }
}
if (fIsOut)
{
diff --git a/src/VBox/Devices/Audio/DevHdaCodec.h b/src/VBox/Devices/Audio/DevHdaCodec.h
index 00890922..52e52bf7 100644
--- a/src/VBox/Devices/Audio/DevHdaCodec.h
+++ b/src/VBox/Devices/Audio/DevHdaCodec.h
@@ -836,11 +836,12 @@ typedef struct HDACODECCFG
uint8_t cTotalNodes;
uint8_t idxAdcVolsLineIn;
+ uint8_t idxAdcVolsMicIn;
uint8_t idxDacLineOut;
/** Align the lists below so they don't cross cache lines (assumes
* CODEC_NODES_MAX is 32). */
- uint8_t const abPadding1[CODEC_NODES_MAX - 15];
+ uint8_t const abPadding1[CODEC_NODES_MAX - 16];
/** @name Node classifications.
* @note These are copies of the g_abStac9220Xxxx arrays in DevHdaCodec.cpp.