Browse Source

fix: loud Hero activation chime with afplay fallback

main
Ali Alavi 1 week ago
parent
commit
965307be77
  1. 17
      src/AppDelegate.swift

17
src/AppDelegate.swift

@ -112,8 +112,19 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
}
private func playSystemSound(name: String) {
if SonioxSettings.shared.playSounds {
NSSound(named: NSSound.Name(name))?.play()
guard SonioxSettings.shared.playSounds else { return }
DispatchQueue.main.async {
if let sound = NSSound(named: NSSound.Name(name)) {
sound.volume = 1.0
sound.play()
} else {
DispatchQueue.global(qos: .userInitiated).async {
let p = Process()
p.executableURL = URL(fileURLWithPath: "/usr/bin/afplay")
p.arguments = ["/System/Library/Sounds/\(name).aiff"]
try? p.run()
}
}
}
}
@ -193,7 +204,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
do {
try audioRecorder.startRecording()
playSystemSound(name: "Tink")
playSystemSound(name: "Hero")
statusBarController.updateIcon(state: .recording)
statusBarController.buildMenu(isRecording: true)
HUDOverlayController.shared.show(state: .recording(level: 0.1, isLagging: false, pingQuality: PingMonitor.shared.currentQuality))

Loading…
Cancel
Save