Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): voice calls no longer crash when they listen again after a reply

leepokai27c47710fceb
diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/VoiceEngine.swift b/apps/ios/Kit/Sources/CodyncUI/Call/VoiceEngine.swift
index 15397e71..9506abc0 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Call/VoiceEngine.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Call/VoiceEngine.swift
@@ -193,11 +193,22 @@ enum MicTap {
var errorDescription: String? { "no microphone is available right now" }
}
- /// The microphone's format. With no usable input (no microphone, a route change, an
- /// interruption) it's 0 Hz, and a tap on it raises an exception that ends the app: throws instead.
+ /// The microphone's format for a tap: the node's, at the hardware's rate (the node's input side, which the
+ /// tap is checked against). A tap at any other rate raises an exception that ends the app, and after the route
+ /// changed (the speaker, AirPods) while the engine was stopped, the node's output side still names the old
+ /// rate. With no usable input (no microphone, a route change, an interruption) it's 0 Hz: throws instead.
static func format(of input: AVAudioInputNode) throws -> AVAudioFormat {
- let format = input.outputFormat(forBus: 0)
- guard format.sampleRate > 0, format.channelCount > 0 else { throw Unavailable() }
+ try format(node: input.outputFormat(forBus: 0), hardwareRate: input.inputFormat(forBus: 0).sampleRate)
+ }
+
+ static func format(node: AVAudioFormat, hardwareRate: Double) throws -> AVAudioFormat {
+ guard node.sampleRate > 0, node.channelCount > 0, hardwareRate > 0 else { throw Unavailable() }
+ guard node.sampleRate != hardwareRate else { return node }
+ var description = node.streamDescription.pointee
+ description.mSampleRate = hardwareRate
+ guard let format = AVAudioFormat(streamDescription: &description, channelLayout: node.channelLayout) else {
+ throw Unavailable()
+ }
return format
}
diff --git a/apps/ios/Kit/Tests/CodyncUITests/MicTapTests.swift b/apps/ios/Kit/Tests/CodyncUITests/MicTapTests.swift
new file mode 100644
index 00000000..c1dc0262
--- /dev/null
+++ b/apps/ios/Kit/Tests/CodyncUITests/MicTapTests.swift
@@ -0,0 +1,21 @@
+import AVFoundation
+import Testing
+@testable import CodyncUI
+
+/// A microphone tap runs at the rate the hardware runs at: after the route changed while a reply was read aloud,
+/// the node still names the old rate, and a tap at it ends the app. Formats only, no audio engine or session
+/// (CoreAudio deadlocks test runs).
+@Test func micTapFollowsTheHardwareRate() throws {
+ let node = try #require(AVAudioFormat(standardFormatWithSampleRate: 48000, channels: 2))
+ #expect(try MicTap.format(node: node, hardwareRate: 48000) === node)
+
+ let tap = try MicTap.format(node: node, hardwareRate: 16000)
+ #expect(tap.sampleRate == 16000)
+ #expect(tap.channelCount == 2)
+ #expect(tap.commonFormat == node.commonFormat)
+ #expect(tap.isInterleaved == node.isInterleaved)
+
+ // No usable input: the node or the hardware is at 0 Hz.
+ #expect(throws: MicTap.Unavailable.self) { try MicTap.format(node: node, hardwareRate: 0) }
+ #expect(throws: MicTap.Unavailable.self) { try MicTap.format(node: AVAudioFormat(), hardwareRate: 48000) }
+}
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 53b3f170..d9070aed 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -6,13 +6,15 @@ any left). tools/asc-submit.py reads the released version's section;
a version without one gets a generic "Bug fixes and improvements" line. Delete old sections.
-->
-## 2.38.0
+## 2.38.1
### zh-Hant
+- 修正語音通話中,bot 唸完回覆、要再聽你說話時 app 可能閃退的問題。
- 介面新增巴西葡萄牙文:可在設定選擇「Português (Brasil)」,或跟隨系統的葡萄牙文語言。
- 新增俄文介面:在設定選擇「Русский」,或跟隨系統的俄文語言。
- 用 QR Code 配對時,如果電腦當下沒能加入你的帳號(例如手機連不上 Codync 雲端,或電腦的雲端關著),下次連上時會自動補上。
### en-US
+- Fixed a crash in voice calls when the bot finished reading a reply and started listening again.
- Choose Português (Brasil) in Settings, or follow your Portuguese system language.
- Choose Русский in Settings, or follow your Russian system language.
- A computer you pair with a QR code that couldn't join your account at the time (the phone couldn't reach the Codync cloud, or the computer's cloud was off, say) joins it the next time it connects.