VirtualBox

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


Ignore:
Timestamp:
Mar 25, 2008 7:49:23 PM (17 years ago)
Author:
vboxsync
Message:

audio: multiply master and pcm_out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/audio.c

    r7558 r7561  
    155155
    156156#ifdef VBOX
     157volume_t sum_out_volume =
     158{
     159    0,
     160    INT_MAX,
     161    INT_MAX
     162};
     163volume_t master_out_volume =
     164{
     165    0,
     166    INT_MAX,
     167    INT_MAX
     168};
    157169volume_t pcm_out_volume =
    158170{
     
    10091021        sw->conv (sw->buf, buf, swlim, &sw->vol);
    10101022#else
    1011         sw->conv (sw->buf, buf, swlim, &pcm_out_volume);
     1023        sw->conv (sw->buf, buf, swlim, &sum_out_volume);
    10121024#endif
    10131025    }
     
    18661878        case AUD_MIXER_VOLUME:
    18671879            name = "MASTER";
    1868             vol  = &pcm_out_volume;
     1880            vol  = &master_out_volume;
    18691881            break;
    18701882        case AUD_MIXER_PCM:
    18711883            name = "PCM_OUT";
     1884            vol  = &pcm_out_volume;
    18721885            break;
    18731886        case AUD_MIXER_LINE_IN:
     
    18821895    if (vol)
    18831896    {
     1897        uint32_t u32VolumeLeft  = (uint32_t)*lvol;
     1898        uint32_t u32VolumeRight = (uint32_t)*rvol;
     1899        /* 0x00..0xff => 0x01..0x100 */
     1900        if (u32VolumeLeft)
     1901            u32VolumeLeft++;
     1902        if (u32VolumeRight)
     1903            u32VolumeRight++;
    18841904        vol->mute  = *mute;
    1885         vol->l     = ((uint32_t)*lvol) * 0x808080; /* maximum is INT_MAX = 0x7fffffff */
    1886         vol->r     = ((uint32_t)*rvol) * 0x808080; /* maximum is INT_MAX = 0x7fffffff */
    1887     }
    1888 #if 0
    1889     LogRel(("AUDIO: Set '%s' volume to %d%%/%d%%\n", name, (*lvol*100)/255, (*rvol*100)/255l));
    1890 #endif
     1905        vol->l     = u32VolumeLeft  * 0x800000; /* maximum is 0x80000000 */
     1906        vol->r     = u32VolumeRight * 0x800000; /* maximum is 0x80000000 */
     1907    }
     1908    sum_out_volume.mute = master_out_volume.mute || pcm_out_volume.mute;
     1909    sum_out_volume.l    = ASMMultU64ByU32DivByU32(master_out_volume.l, pcm_out_volume.l, 0x80000000U);
     1910    sum_out_volume.r    = ASMMultU64ByU32DivByU32(master_out_volume.r, pcm_out_volume.r, 0x80000000U);
    18911911}
    18921912
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