Changeset 80609 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Sep 5, 2019 3:50:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r80531 r80609 663 663 static int ichac97R3StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm); 664 664 static void ichac97R3StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream); 665 static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream );666 static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream );665 static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce); 666 static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce); 667 667 static int ichac97R3StreamClose(PAC97STATE pThis, PAC97STREAM pStream); 668 668 static void ichac97R3StreamReset(PAC97STATE pThis, PAC97STREAM pStream); … … 897 897 RTCircBufReset(pStream->State.pCircBuf); 898 898 899 rc = ichac97R3StreamOpen(pThis, pStream );899 rc = ichac97R3StreamOpen(pThis, pStream, false /* fForce */); 900 900 901 901 if (pStream->Dbg.Runtime.fEnabled) … … 1637 1637 AssertMsgReturnVoid(uMixerIdx + 2U <= sizeof(pThis->mixer_data), 1638 1638 ("Index %RU8 out of bounds (%zu)\n", uMixerIdx, sizeof(pThis->mixer_data))); 1639 1640 LogRel2(("AC97: Setting mixer index #%RU8 to %RU16 (%RU8 %RU8)\n", 1641 uMixerIdx, uVal, RT_HI_U8(uVal), RT_LO_U8(uVal))); 1642 1639 1643 pThis->mixer_data[uMixerIdx + 0] = RT_LO_U8(uVal); 1640 1644 pThis->mixer_data[uMixerIdx + 1] = RT_HI_U8(uVal); … … 2012 2016 * @param pThis AC'97 device state. 2013 2017 * @param pStream AC'97 stream to open. 2014 */ 2015 static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream) 2018 * @param fForce Whether to force re-opening the stream or not. 2019 * Otherwise re-opening only will happen if the PCM properties have changed. 2020 */ 2021 static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce) 2016 2022 { 2017 2023 int rc = VINF_SUCCESS; … … 2074 2080 /* Only (re-)create the stream (and driver chain) if we really have to. 2075 2081 * Otherwise avoid this and just reuse it, as this costs performance. */ 2076 if (!DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pStream->State.Cfg.Props)) 2082 if ( !DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pStream->State.Cfg.Props) 2083 || fForce) 2077 2084 { 2078 2085 LogRel2(("AC97: (Re-)Opening stream '%s' (%RU32Hz, %RU8 channels, %s%RU8)\n", … … 2150 2157 * @param pThis AC'97 device state. 2151 2158 * @param pStream AC'97 stream to re-open. 2152 */ 2153 static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream) 2159 * @param fForce Whether to force re-opening the stream or not. 2160 * Otherwise re-opening only will happen if the PCM properties have changed. 2161 */ 2162 static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream, bool fForce) 2154 2163 { 2155 2164 LogFlowFunc(("[SD%RU8]\n", pStream->u8SD)); … … 2157 2166 int rc = ichac97R3StreamClose(pThis, pStream); 2158 2167 if (RT_SUCCESS(rc)) 2159 rc = ichac97R3StreamOpen(pThis, pStream );2168 rc = ichac97R3StreamOpen(pThis, pStream, fForce); 2160 2169 2161 2170 return rc; … … 3495 3504 case AC97_Extended_Audio_Ctrl_Stat: 3496 3505 #ifdef IN_RING3 3497 if (!(u32Val & AC97_EACS_VRA)) 3506 /* 3507 * Handle VRA bits. 3508 */ 3509 # ifndef VBOX_WITH_AC97_VRA 3510 if (u32Val & AC97_EACS_VRA) 3498 3511 { 3499 ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 48000 /* Default = 0xBB80 */); 3500 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX]); 3501 3502 ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 48000 /* Default = 0xBB80 */); 3503 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX]); 3512 u32Val &= ~AC97_EACS_VRA; /* Only clear VRA bit and keep the rest. */ 3513 LogRel2(("AC97: Variable rate audio (VRA) is not supported, setting to 0x%x\n", u32Val)); 3504 3514 } 3505 else 3506 LogRel2(("AC97: Variable rate audio (VRA) is not supported\n")); 3507 3508 if (!(u32Val & AC97_EACS_VRM)) 3515 3516 ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3517 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); 3518 3519 ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3520 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); 3521 # else 3522 # error "Implement EACS VRA support!" 3523 # endif 3524 /* 3525 * Handle VRM bits. 3526 */ 3527 # ifndef VBOX_WITH_AC97_VRM 3528 if (u32Val & AC97_EACS_VRM) 3509 3529 { 3510 ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 48000 /* Default = 0xBB80 */);3511 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX]);3530 u32Val &= ~AC97_EACS_VRM; /* Only clear VRM bit and keep the rest. */ 3531 LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported, setting to 0x%x\n", u32Val)); 3512 3532 } 3513 else 3514 LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported\n")); 3515 3516 LogFunc(("Setting extended audio control to %#x\n", u32Val)); 3533 3534 ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3535 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); 3536 # else 3537 # error "Implement EACS VRM support!" 3538 # endif 3539 LogRel2(("AC97: Setting extended audio control to %#x\n", u32Val)); 3540 3517 3541 ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, u32Val); 3518 #else 3542 #else /* !IN_RING3 */ 3519 3543 rc = VINF_IOM_R3_IOPORT_WRITE; 3520 3544 #endif … … 3522 3546 case AC97_PCM_Front_DAC_Rate: /* Output slots 3, 4, 6. */ 3523 3547 #ifdef IN_RING3 3524 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA)3548 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) 3525 3549 { 3526 3550 ichac97MixerSet(pThis, uPortIdx, u32Val); … … 3533 3557 * set the VRA rate nevertheless. So re-open the output stream in any case to avoid 3534 3558 * breaking playback. */ 3535 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX] );3559 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); 3536 3560 #else 3537 3561 rc = VINF_IOM_R3_IOPORT_WRITE; … … 3552 3576 * set the VRM rate nevertheless. So re-open the mic-in stream in any case to avoid 3553 3577 * breaking recording.*/ 3554 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX] );3578 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); 3555 3579 #else 3556 3580 rc = VINF_IOM_R3_IOPORT_WRITE; … … 3570 3594 * set the VRA rate nevertheless. So re-open the line-in stream in any case to avoid 3571 3595 * breaking recording.*/ 3572 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX] );3596 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); 3573 3597 #else 3574 3598 rc = VINF_IOM_R3_IOPORT_WRITE;
Note:
See TracChangeset
for help on using the changeset viewer.