diff --git a/src/AppDelegate.swift b/src/AppDelegate.swift index 2178b05..0ad2967 100644 --- a/src/AppDelegate.swift +++ b/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))