-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-standard volume/brightness scales not working properly (#245)
- Loading branch information
1 parent
9ff4a93
commit 5cacd25
Showing
6 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// OSDUtils.swift | ||
// MonitorControl | ||
// | ||
// Created by Victor Chabbert on 19/06/2020. | ||
// Copyright 漏 2020 Guillaume Broder. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
class OSDUtils: NSObject { | ||
static let chicletCount: Float = 16 | ||
|
||
static func chiclet(fromValue value: Float, maxValue: Float) -> Float { | ||
return (value * self.chicletCount) / maxValue | ||
} | ||
|
||
static func value(fromChiclet chiclet: Float, maxValue: Float) -> Float { | ||
return (chiclet * maxValue) / self.chicletCount | ||
} | ||
|
||
static func getDistance(fromNearestChiclet chiclet: Float) -> Float { | ||
return abs(chiclet.rounded(.towardZero) - chiclet) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters