Fixing an issue with rounding causing certain volume levels to not show the same on the steam deck as they did in the volume mixer

This commit is contained in:
2023-09-10 22:06:38 -06:00
parent 0d056215bc
commit b57ea24b11
5 changed files with 32 additions and 20 deletions

View File

@@ -65,18 +65,14 @@ public class ActiveAudioSessionWrapper : IAudioSession
{
//if you have more than one volume. they will all get set based on the first volume control
var level = Volume.FirstOrDefault()?.MasterVolume ?? 0;
level += (0.01f * step) * ticks;
level = Math.Max(level, 0);
level = Math.Min(level, 1);
level = VolumeHelpers.GetAdjustedVolume(level, step, ticks);
Volume.ForEach(x => x.MasterVolume = level);
}
public int GetVolumeLevel()
{
var level = Volume.FirstOrDefault()?.MasterVolume ?? 0;
return (int)(level * 100);
return VolumeHelpers.GetVolumePercentage(level);
}
}