mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-05-15 14:15:55 -06:00
Show audio muted OSD image when audio volume value is 0 (#276)
This commit is contained in:
parent
9e47ccfddb
commit
c83fde10b4
1 changed files with 26 additions and 22 deletions
|
|
@ -10,6 +10,12 @@ import DDC
|
|||
import Foundation
|
||||
import os.log
|
||||
|
||||
private enum OSDImage: Int64 {
|
||||
case brightness = 1
|
||||
case audioSpeaker = 3
|
||||
case audioSpeakerMuted = 4
|
||||
}
|
||||
|
||||
class Display {
|
||||
internal let identifier: CGDirectDisplayID
|
||||
internal let name: String
|
||||
|
|
@ -48,37 +54,35 @@ class Display {
|
|||
return
|
||||
}
|
||||
|
||||
var osdImage: Int64!
|
||||
var osdImage: OSDImage
|
||||
switch command {
|
||||
case .brightness:
|
||||
osdImage = 1 // Brightness Image
|
||||
case .audioSpeakerVolume:
|
||||
osdImage = 3 // Speaker image
|
||||
osdImage = value > 0 ? .audioSpeaker : .audioSpeakerMuted
|
||||
case .audioMuteScreenBlank:
|
||||
osdImage = 4 // Mute image
|
||||
osdImage = .audioSpeakerMuted
|
||||
default:
|
||||
osdImage = 1
|
||||
osdImage = .brightness
|
||||
}
|
||||
|
||||
let filledChiclets: Int
|
||||
let totalChiclets: Int
|
||||
|
||||
if roundChiclet {
|
||||
let osdChiclet = OSDUtils.chiclet(fromValue: Float(value), maxValue: Float(maxValue))
|
||||
let filledChiclets = round(osdChiclet)
|
||||
|
||||
manager.showImage(osdImage,
|
||||
onDisplayID: self.identifier,
|
||||
priority: 0x1F4,
|
||||
msecUntilFade: 1000,
|
||||
filledChiclets: UInt32(filledChiclets),
|
||||
totalChiclets: UInt32(16),
|
||||
locked: false)
|
||||
|
||||
filledChiclets = Int(round(osdChiclet))
|
||||
totalChiclets = 16
|
||||
} else {
|
||||
manager.showImage(osdImage,
|
||||
onDisplayID: self.identifier,
|
||||
priority: 0x1F4,
|
||||
msecUntilFade: 1000,
|
||||
filledChiclets: UInt32(value),
|
||||
totalChiclets: UInt32(maxValue),
|
||||
locked: false)
|
||||
filledChiclets = value
|
||||
totalChiclets = maxValue
|
||||
}
|
||||
|
||||
manager.showImage(osdImage.rawValue,
|
||||
onDisplayID: self.identifier,
|
||||
priority: 0x1F4,
|
||||
msecUntilFade: 1000,
|
||||
filledChiclets: UInt32(filledChiclets),
|
||||
totalChiclets: UInt32(totalChiclets),
|
||||
locked: false)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue