Files
VCCPlusOSS/platforms/macos/App/CoCoCaptureFeedback.swift
T

23 lines
843 B
Swift

// SPDX-License-Identifier: GPL-3.0-or-later
import AppKit
/// Host feedback has no connection to the emulator's generated PCM or either
/// video/playtest capture path. No microphone or system-output recording is used.
@MainActor enum CoCoCaptureFeedback {
enum Cue: Equatable { case screenshot, recordingStarted }
private static let shutter = sound("screenshot")
private static let recording = sound("recording-start")
private static func sound(_ name: String) -> NSSound? {
guard let url = Bundle.main.url(forResource: name, withExtension: "wav", subdirectory: "CaptureSounds") else { return nil }
return NSSound(contentsOf: url, byReference: false)
}
static func play(_ cue: Cue) {
let sound = cue == .screenshot ? shutter : recording
sound?.stop()
sound?.play()
}
}