mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-04 14:30:19 +00:00
Switches to a logarithmic volume dial.
This commit is contained in:
parent
486bb911a9
commit
174c837767
@ -43,7 +43,7 @@
|
||||
</imageView>
|
||||
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bmN-Nb-BBh">
|
||||
<rect key="frame" x="46" y="2" width="248" height="28"/>
|
||||
<sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="1" tickMarkPosition="above" sliderType="linear" id="wtR-Vo-Q9e"/>
|
||||
<sliderCell key="cell" continuous="YES" state="on" alignment="left" minValue="1" maxValue="2" doubleValue="2" tickMarkPosition="above" sliderType="linear" id="wtR-Vo-Q9e"/>
|
||||
<connections>
|
||||
<action selector="setVolume:" target="-2" id="Ptv-pk-zbl"/>
|
||||
</connections>
|
||||
|
@ -127,7 +127,7 @@ class MachineDocument:
|
||||
override func windowControllerDidLoadNib(_ aController: NSWindowController) {
|
||||
super.windowControllerDidLoadNib(aController)
|
||||
aController.window?.contentAspectRatio = self.aspectRatio()
|
||||
volumeSlider.floatValue = userDefaultsVolume()
|
||||
volumeSlider.floatValue = pow(2.0, userDefaultsVolume())
|
||||
|
||||
volumeView.layer!.cornerRadius = 5.0
|
||||
}
|
||||
@ -705,8 +705,9 @@ class MachineDocument:
|
||||
// MARK: - Volume Control.
|
||||
@IBAction func setVolume(_ sender: NSSlider!) {
|
||||
if let machine = self.machine {
|
||||
machine.setVolume(sender.floatValue)
|
||||
setUserDefaultsVolume(sender.floatValue)
|
||||
let linearValue = log2(sender.floatValue)
|
||||
machine.setVolume(linearValue)
|
||||
setUserDefaultsVolume(linearValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user