VoiceWake: centralize send chime and guard play

This commit is contained in:
Peter Steinberger
2025-12-08 21:25:30 +01:00
parent 7a82777fc5
commit bb3606b64f
4 changed files with 40 additions and 19 deletions

View File

@@ -42,10 +42,15 @@ struct VoiceWakeChimeCatalog {
}
}
@MainActor
enum VoiceWakeChimePlayer {
private static var lastSound: NSSound?
@MainActor
static func play(_ chime: VoiceWakeChime) {
guard let sound = self.sound(for: chime) else { return }
self.lastSound = sound
sound.stop()
sound.play()
}