From 050a3d3112e38e7059340d459ec3000d1dfd5251 Mon Sep 17 00:00:00 2001 From: Dzmitry Neviadomski Date: Sat, 29 Jan 2022 05:57:19 +0300 Subject: [PATCH] Scale VolumeSlider linearly if volume is limited. Fixes #198 --- Window/VolumeSlider.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Window/VolumeSlider.m b/Window/VolumeSlider.m index c23386cd5..b8f351ab5 100644 --- a/Window/VolumeSlider.m +++ b/Window/VolumeSlider.m @@ -59,7 +59,13 @@ - (void)updateToolTip { double value = [self doubleValue]; - double volume = linearToLogarithmic(value, MAX_VOLUME); + BOOL volumeLimit = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] boolForKey:@"volumeLimit"]; + double volume; + if (volumeLimit) { + volume = (value - self.minValue) * (MAX_VOLUME / (self.maxValue - self.minValue)); + } else { + volume = linearToLogarithmic(value, MAX_VOLUME); + } NSString *text = [NSString stringWithFormat:@"%0.lf%%", volume];