Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix: holding the talk key with AirPods as the microphone no longer quits Cicada

wquguru5e0a421f799c
diff --git a/.claude/skills/room-test/SKILL.md b/.claude/skills/audio-test/SKILL.md
similarity index 100%
rename from .claude/skills/room-test/SKILL.md
rename to .claude/skills/audio-test/SKILL.md
diff --git a/.claude/skills/room-test/scripts/audio.swift b/.claude/skills/audio-test/scripts/audio.swift
similarity index 100%
rename from .claude/skills/room-test/scripts/audio.swift
rename to .claude/skills/audio-test/scripts/audio.swift
diff --git a/.claude/skills/room-test/scripts/clips.py b/.claude/skills/audio-test/scripts/clips.py
similarity index 100%
rename from .claude/skills/room-test/scripts/clips.py
rename to .claude/skills/audio-test/scripts/clips.py
diff --git a/.claude/skills/room-test/scripts/round.sh b/.claude/skills/audio-test/scripts/room-round.sh
similarity index 100%
rename from .claude/skills/room-test/scripts/round.sh
rename to .claude/skills/audio-test/scripts/room-round.sh
diff --git a/Sources/Cicada/SpeakEngine.swift b/Sources/Cicada/SpeakEngine.swift
index 29a0050..d980b0a 100644
--- a/Sources/Cicada/SpeakEngine.swift
+++ b/Sources/Cicada/SpeakEngine.swift
@@ -102,7 +102,7 @@ final class SpeakEngine {
let settings: AppSettings
private(set) var phase: Phase = .idle
- private let mic = AVAudioEngine()
+ private var mic = AVAudioEngine()
/// The mic with echo cancellation, shared with 电脑和会议室's room (`VoiceMic`): used when
/// `echoCancel` is on, or whenever the room already has it running.
private let voiceMic: VoiceMic
@@ -364,6 +364,11 @@ final class SpeakEngine {
// A unit left over (toggled off mid-press, a virtual mic) would starve the plain mic; one the
// room is using stays (the talk key is then on another mic).
if !voiceMic.inUse { voiceMic.release() }
+ // A fresh engine each press: one kept from the last press still reports the input's old
+ // format after the device changed it (AirPods drop to call quality when their mic opens),
+ // and installing a tap in that format raises an exception that ends the app.
+ if mic.isRunning { mic.inputNode.removeTap(onBus: 0); mic.stop() }
+ mic = AVAudioEngine()
let inputNode = mic.inputNode
AudioDevices.pinInput(mic, to: inputDevice?())
// Pinning can leave the client format at BlackHole's rate/channels. A tap must use