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.

build(ios): the simulator's host recognizer builds again, with the AI service's stream stubbed out

wquguru10e7d0b25cd2
diff --git a/ios/scripts/host-recognizer.sh b/ios/scripts/host-recognizer.sh
index dafd023..27c79fc 100755
--- a/ios/scripts/host-recognizer.sh
+++ b/ios/scripts/host-recognizer.sh
@@ -8,7 +8,7 @@ OUT=ios/build/host-recognizer
mkdir -p ios/build
xcrun --sdk macosx swiftc -O -swift-version 5 -parse-as-library -target arm64-apple-macos26.0 \
Sources/Cicada/Recognition.swift Sources/Cicada/Languages.swift Sources/Cicada/AudioFiles.swift \
- ios/tools/host-recognizer/main.swift -o "$OUT"
+ ios/tools/host-recognizer/main.swift ios/tools/host-recognizer/CloudStubs.swift -o "$OUT"
# Simulator UDIDs: the booted ones, or the named devices.
if [[ $# -eq 0 ]]; then
ids=($(xcrun simctl list devices booted | grep -oE '[0-9A-F-]{36}'))
diff --git a/ios/tools/host-recognizer/CloudStubs.swift b/ios/tools/host-recognizer/CloudStubs.swift
new file mode 100644
index 0000000..58fbc79
--- /dev/null
+++ b/ios/tools/host-recognizer/CloudStubs.swift
@@ -0,0 +1,17 @@
+import AVFoundation
+
+// The host recognizer only uses the speech models; Recognition.swift also names the AI service's
+// stream (CloudHearing.swift), which would pull in the whole AI client. These stand in for it here.
+
+struct CloudHeard: Equatable, Sendable {}
+
+final class CloudStream: RecognitionStream, @unchecked Sendable {
+ typealias Hear = @MainActor @Sendable (_ wav: Data, _ seconds: Double) async -> CloudHeard?
+ let format = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: 16000, channels: 1, interleaved: false)!
+ let results = AsyncThrowingStream<Recognition.Piece, Error> { $0.finish() }
+ init(format: AVAudioFormat? = nil, hear: @escaping Hear) {}
+ func append(_ buffer: AVAudioPCMBuffer) {}
+ func finalize(through seconds: Double) async throws {}
+ func finish() async {}
+ func cancel() async {}
+}