Changeset 80688 in vbox for trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
- Timestamp:
- Sep 10, 2019 9:01:42 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r80609 r80688 2536 2536 2537 2537 /* Configure Extended Audio ID (EAID) + Control & Status (EACS) registers. */ 2538 uint16_t fEAID = AC97_EAID_REV1; /* Our hardware is AC'97 rev2.3 compliant. */ 2539 uint16_t fEACS = 0; 2540 #ifdef VBOX_WITH_AC97_VRA 2541 fEAID |= AC97_EAID_VRA; /* Variable Rate PCM Audio capable. */ 2542 fEACS |= AC97_EACS_VRA; /* Ditto. */ 2543 #endif 2544 #ifdef VBOX_WITH_AC97_VRM 2545 fEAID |= AC97_EAID_VRM; /* Variable Rate Mic-In Audio capable. */ 2546 fEACS |= AC97_EACS_VRM; /* Ditto. */ 2547 #endif 2538 const uint16_t fEAID = AC97_EAID_REV1; /* Our hardware is AC'97 rev2.3 compliant. */ 2539 const uint16_t fEACS = AC97_EAID_VRA | AC97_EAID_VRM; /* Variable Rate PCM Audio (VRA) + Mic-In (VRM) capable. */ 2548 2540 2549 2541 ichac97MixerSet(pThis, AC97_Extended_Audio_ID, fEAID); 2550 2542 ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, fEACS); 2551 ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate , 0xbb80 );2552 ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate , 0xbb80 );2553 ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate , 0xbb80 );2554 ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate , 0xbb80 );2555 ichac97MixerSet(pThis, AC97_MIC_ADC_Rate , 0xbb80 );2543 ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate , 0xbb80 /* 48000 Hz by default */); 2544 ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate , 0xbb80 /* 48000 Hz by default */); 2545 ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate , 0xbb80 /* 48000 Hz by default */); 2546 ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate , 0xbb80 /* 48000 Hz by default */); 2547 ichac97MixerSet(pThis, AC97_MIC_ADC_Rate , 0xbb80 /* 48000 Hz by default */); 2556 2548 2557 2549 if (pThis->uCodecModel == AC97_CODEC_AD1980) … … 3507 3499 * Handle VRA bits. 3508 3500 */ 3509 # ifndef VBOX_WITH_AC97_VRA 3510 if (u32Val & AC97_EACS_VRA) 3501 if (!(u32Val & AC97_EACS_VRA)) /* Check if VRA bit is not set. */ 3511 3502 { 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)); 3503 ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3504 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); 3505 3506 ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3507 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); 3514 3508 } 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 3509 else 3510 LogRel2(("AC97: Variable rate audio (VRA) is not supported\n")); 3511 3524 3512 /* 3525 3513 * Handle VRM bits. 3526 3514 */ 3527 # ifndef VBOX_WITH_AC97_VRM 3528 if (u32Val & AC97_EACS_VRM) 3515 if (!(u32Val & AC97_EACS_VRM)) /* Check if VRM bit is not set. */ 3529 3516 { 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));3517 ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */ 3518 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); 3532 3519 } 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 3520 else 3521 LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported\n")); 3522 3539 3523 LogRel2(("AC97: Setting extended audio control to %#x\n", u32Val)); 3540 3541 3524 ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, u32Val); 3542 3525 #else /* !IN_RING3 */ … … 3548 3531 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) 3549 3532 { 3533 LogRel2(("AC97: Setting front DAC rate to 0x%x\n", u32Val)); 3550 3534 ichac97MixerSet(pThis, uPortIdx, u32Val); 3551 LogRel2(("AC97: Setting front DAC rate to 0x%x\n", u32Val));3535 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */); 3552 3536 } 3553 3537 else 3554 3538 LogRel2(("AC97: Setting front DAC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val)); 3555 3556 /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRA) and try to3557 * set the VRA rate nevertheless. So re-open the output stream in any case to avoid3558 * breaking playback. */3559 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */);3560 3539 #else 3561 3540 rc = VINF_IOM_R3_IOPORT_WRITE; … … 3566 3545 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRM) 3567 3546 { 3547 LogRel2(("AC97: Setting microphone ADC rate to 0x%x\n", u32Val)); 3568 3548 ichac97MixerSet(pThis, uPortIdx, u32Val); 3569 LogRel2(("AC97: Setting microphone ADC rate to 0x%x\n", u32Val));3549 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */); 3570 3550 } 3571 3551 else 3572 3552 LogRel2(("AC97: Setting microphone ADC rate (0x%x) when VRM is not set is forbidden, ignoring\n", 3573 3553 u32Val)); 3574 3575 /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRM) and try to3576 * set the VRM rate nevertheless. So re-open the mic-in stream in any case to avoid3577 * breaking recording.*/3578 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */);3579 3554 #else 3580 3555 rc = VINF_IOM_R3_IOPORT_WRITE; … … 3585 3560 if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA) 3586 3561 { 3562 LogRel2(("AC97: Setting line-in ADC rate to 0x%x\n", u32Val)); 3587 3563 ichac97MixerSet(pThis, uPortIdx, u32Val); 3588 LogRel2(("AC97: Setting line-in ADC rate to 0x%x\n", u32Val));3564 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */); 3589 3565 } 3590 3566 else 3591 3567 LogRel2(("AC97: Setting line-in ADC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val)); 3592 3593 /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRA) and try to3594 * set the VRA rate nevertheless. So re-open the line-in stream in any case to avoid3595 * breaking recording.*/3596 ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */);3597 3568 #else 3598 3569 rc = VINF_IOM_R3_IOPORT_WRITE;
Note:
See TracChangeset
for help on using the changeset viewer.