知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
fix(meetings): hear your own voice and name a one-to-one caller
clementchen2f1c9396b866
diff --git a/Sources/Cicada/AppModel.swift b/Sources/Cicada/AppModel.swiftindex ceb2afc..7d67562 100644--- a/Sources/Cicada/AppModel.swift+++ b/Sources/Cicada/AppModel.swift@@ -1336,6 +1336,13 @@ final class AppModel: ObservableObject {w.config = endConfiglet said = store.liveID.flatMap { store.session($0) }.map { !$0.lines.isEmpty } ?? falselet calls = w.config.followApps ? (fakeCalls ?? MicUsers.currentCalls()) : [:]+ // A meeting app call started while we were already listening to the Mac only: add the+ // room microphone, or the user's own voice is missing from the record (Tencent Meeting,+ // Zoom, …). 启动时 launch() still starts without the microphone; this is the call signal.+ if settings.autoMicOnStart, settings.listenSource == "system", !calls.isEmpty {+ debugLog("mic auto-on: a meeting app started a call")+ setMic(true)+ }let reason = w.tick(at: Date(), calls: calls, said: said)endWatch = wsetEnding(w.pending)diff --git a/Sources/Cicada/NotesWindow.swift b/Sources/Cicada/NotesWindow.swiftindex dcf2d0b..45e5183 100644--- a/Sources/Cicada/NotesWindow.swift+++ b/Sources/Cicada/NotesWindow.swift@@ -905,7 +905,7 @@ struct NotesWindowView: View {let lines = session?.lines ?? []let speakers = model.settings.speakerVoices ? session.map(SpeakerLabels.numbers) ?? [:] : [:]return VStack(alignment: .leading, spacing: 10) {- if !speakers.isEmpty, let s = session {+ if !speakers.isEmpty || (model.settings.speakerVoices && session.map { SpeakerLabels.singleVoice($0.lines) != nil } == true), let s = session {SpeakerStrip(model: model, session: s, editing: $editingVoice)}TranscriptListView(lines: lines, topics: engine.notes.topics, terms: searchTerms,diff --git a/Sources/Cicada/Settings.swift b/Sources/Cicada/Settings.swiftindex 209f8ca..a3b50a0 100644--- a/Sources/Cicada/Settings.swift+++ b/Sources/Cicada/Settings.swift@@ -287,7 +287,7 @@ final class AppSettings: ObservableObject {sourceMode = .auto}target = defaults.string(forKey: "target") ?? "system"- subtitles = defaults.string(forKey: "subtitles") ?? "both"+ subtitles = defaults.string(forKey: "subtitles") ?? "original"notesLanguage = defaults.string(forKey: "notesLanguage") ?? "mine"speakEnabled = defaults.bool(forKey: "speakEnabled")// Anyone who had it on before this question existed already knows.diff --git a/Sources/Cicada/SpeakerID.swift b/Sources/Cicada/SpeakerID.swiftindex 89fd9b6..32b3699 100644--- a/Sources/Cicada/SpeakerID.swift+++ b/Sources/Cicada/SpeakerID.swift@@ -262,12 +262,21 @@ enum SpeakerLabels {/// The voices a meeting already knows by name; `Session.voiceProfiles` is the snapshot.static func knownVoices(_ s: Session) -> Set<Int> {Set((s.voiceProfiles ?? [:]).keys.compactMap(Int.init))+ .union((s.voiceNames ?? [:]).keys.compactMap(Int.init))}static func voiceNumbers(_ s: Session) -> [Int: Int] {voiceNumbers(s.lines, known: knownVoices(s))}+ /// The only other-side voice in a one-to-one call. `voiceNumbers` deliberately hides a single+ /// anonymous voice (it would just say 说话人 1 for the whole call), but the user still needs a+ /// way to name it and remember its voiceprint for the next meeting.+ static func singleVoice(_ lines: [TranscriptLine]) -> Int? {+ let voices = Set(lines.filter { $0.speaker == "them" }.compactMap(\.voice))+ return voices.count == 1 ? voices.first : nil+ }+/// Line id → 1-based speaker number; lines without one show as 对方.static func numbers(_ lines: [TranscriptLine], known: Set<Int> = []) -> [String: Int] {let number = voiceNumbers(lines, known: known)diff --git a/Sources/Cicada/SpeakerViews.swift b/Sources/Cicada/SpeakerViews.swiftindex 625e455..b7d60a0 100644--- a/Sources/Cicada/SpeakerViews.swift+++ b/Sources/Cicada/SpeakerViews.swift@@ -79,7 +79,12 @@ struct SpeakerStrip: View {@State private var popover: Int?var body: some View {- let numbers = SpeakerLabels.voiceNumbers(session)+ let numbered = SpeakerLabels.voiceNumbers(session)+ // A one-to-one call has one voice, which `voiceNumbers` hides; show it anyway so it can be+ // named and remembered for the next meeting.+ let numbers = numbered.isEmpty+ ? SpeakerLabels.singleVoice(session.lines).map { [$0: 1] } ?? [:]+ : numberedlet names = SpeakerLabels.names(session)VStack(alignment: .leading, spacing: 10) {HStack(alignment: .top, spacing: 8) {@@ -143,7 +148,9 @@ struct SpeakerEditor: View {var body: some View {// Gone once merged into someone else: the editor closes on the next turn.- if let s = session, let n = SpeakerLabels.voiceNumbers(s)[voice] {+ if let s = session,+ let n = SpeakerLabels.voiceNumbers(s)[voice]+ ?? (SpeakerLabels.singleVoice(s.lines) == voice ? 1 : nil) {let numbers = SpeakerLabels.voiceNumbers(s)let names = SpeakerLabels.names(s)let guess = SpeakerLabels.guessed(s)[n]diff --git a/Sources/Cicada/Views.swift b/Sources/Cicada/Views.swiftindex fb74cd8..375ff8d 100644--- a/Sources/Cicada/Views.swift+++ b/Sources/Cicada/Views.swift@@ -1400,7 +1400,7 @@ struct MainWindowView: View {.pinnedHeader($pinned)LazyVStack(alignment: .leading, spacing: 0) {let speakers = settings.speakerVoices ? SpeakerLabels.numbers(s) : [:]- if !speakers.isEmpty { SpeakerStrip(model: model, session: s).padding(.bottom, 8) }+ if !speakers.isEmpty || (settings.speakerVoices && SpeakerLabels.singleVoice(s.lines) != nil) { SpeakerStrip(model: model, session: s).padding(.bottom, 8) }let both = RecordList.heardBoth(s.lines)// In a meeting that heard the room and the Mac, a change of place starts a new run too.let starts = SpeakerLabels.runStarts(s.lines, speakers).union(both ? RecordList.placeStarts(s.lines) : [])