Skip to content
  • Nate Graham's avatar
    Round volume to avoid increasing or decreasing by more than stepSize · 52cb6b0e
    Nate Graham authored
    Sometimes when you increase or decrease the volume using the key on your
    keyboard or a global shortcut, it will change by more than the stepSize.
    For example when you're at 40% volume and go up when a stepSize of 5%,
    sometimes it will change to 46% volume, not 45%.
    
    The reason for this is that the Volume number we get from PulseAudio and
    then manipulate is a float. So we have to round it down to avoid
    accumulating errors over time. The percentage display function already
    rounds, so let's do the same thing in the functions to increase and
    decrease the volume.
    
    We should also use Math.floor() rather than Math.round() to ensure
    consistency in the values we're using.
    
    BUG: 434769
    FIXED-IN: 5.21.4
    52cb6b0e