VirtualBox

Ignore:
Timestamp:
Jun 17, 2021 11:03:19 PM (3 years ago)
Author:
vboxsync
Message:

Audio: Made PDMAUDIOVOLUME multichannel. bugref:9890

File:
1 edited

Legend:

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

    r89379 r89768  
    11831183 * @param   pVol                Where to store the master volume information.
    11841184 */
    1185 static void sb16GetMasterVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)
     1185DECLINLINE(void) sb16GetMasterVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)
    11861186{
    11871187    /* There's no mute switch, only volume controls. */
    1188     uint8_t lvol = sb16MixRegToVol(pThis, 0x30);
    1189     uint8_t rvol = sb16MixRegToVol(pThis, 0x31);
    1190 
    1191     pVol->fMuted = false;
    1192     pVol->uLeft  = lvol;
    1193     pVol->uRight = rvol;
     1188    PDMAudioVolumeInitFromStereo(pVol, false /*fMuted*/, sb16MixRegToVol(pThis, 0x30), sb16MixRegToVol(pThis, 0x31));
    11941189}
    11951190
     
    12001195 * @param   pVol                Where to store the output stream volume information.
    12011196 */
    1202 static void sb16GetPcmOutVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)
     1197DECLINLINE(void) sb16GetPcmOutVolume(PSB16STATE pThis, PPDMAUDIOVOLUME pVol)
    12031198{
    12041199    /* There's no mute switch, only volume controls. */
    1205     uint8_t lvol = sb16MixRegToVol(pThis, 0x32);
    1206     uint8_t rvol = sb16MixRegToVol(pThis, 0x33);
    1207 
    1208     pVol->fMuted = false;
    1209     pVol->uLeft  = lvol;
    1210     pVol->uRight = rvol;
     1200    PDMAudioVolumeInitFromStereo(pVol, false /*fMuted*/, sb16MixRegToVol(pThis, 0x32), sb16MixRegToVol(pThis, 0x33));
    12111201}
    12121202
     
    12211211    /* Combine the master + output stream volume. */
    12221212    PDMAUDIOVOLUME VolCombined;
    1223     RT_ZERO(VolCombined);
    1224 
    1225     VolCombined.fMuted = VolMaster.fMuted || VolOut.fMuted;
    1226     if (!VolCombined.fMuted)
    1227     {
    1228         VolCombined.uLeft  = (   (VolOut.uLeft    ? VolOut.uLeft     : 1)
    1229                                * (VolMaster.uLeft ? VolMaster.uLeft  : 1)) / PDMAUDIO_VOLUME_MAX;
    1230 
    1231         VolCombined.uRight = (  (VolOut.uRight    ? VolOut.uRight    : 1)
    1232                               * (VolMaster.uRight ? VolMaster.uRight : 1)) / PDMAUDIO_VOLUME_MAX;
    1233     }
     1213    PDMAudioVolumeCombine(&VolCombined, &VolMaster, &VolOut);
    12341214
    12351215    int rc2 = AudioMixerSinkSetVolume(pThis->pSinkOut, &VolCombined);
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