2026-06-19 02:10:25 +02:00
|
|
|
import Foundation
|
|
|
|
|
import AVFoundation
|
|
|
|
|
import VoiceCatCore
|
|
|
|
|
|
|
|
|
|
// MARK: - Helper types
|
|
|
|
|
|
|
|
|
|
struct ChatMessage: Identifiable {
|
|
|
|
|
let id = UUID()
|
|
|
|
|
let timestamp: Date
|
|
|
|
|
let senderName: String
|
|
|
|
|
let text: String
|
|
|
|
|
let scope: VoiceCatTextScope
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ActivityEntry: Identifiable {
|
|
|
|
|
let id = UUID()
|
|
|
|
|
let timestamp: Date
|
|
|
|
|
let text: String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct VoiceState {
|
|
|
|
|
var micActive = false
|
|
|
|
|
var selfMuted = false
|
|
|
|
|
var selfDeafened = false
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
var serverMuted = false
|
|
|
|
|
var serverDeafened = false
|
2026-06-19 02:10:25 +02:00
|
|
|
var inputMode: VoiceCatInputMode = .voiceActivation
|
|
|
|
|
var vadThreshold: Float = 0.025
|
|
|
|
|
var level: Float = 0.0
|
|
|
|
|
var currentDeviceId: String?
|
|
|
|
|
var localStreamId: UInt32 = 0
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
var screenSharing = false
|
|
|
|
|
var screenStreamId: UInt32 = 0
|
2026-06-19 02:10:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - SessionState
|
|
|
|
|
|
|
|
|
|
@Observable
|
|
|
|
|
@MainActor
|
|
|
|
|
final class SessionState {
|
|
|
|
|
let client: VoiceCatClient
|
|
|
|
|
let selfUserId: UInt32
|
|
|
|
|
|
|
|
|
|
var channels: [Channel] = []
|
|
|
|
|
var users: [User] = []
|
|
|
|
|
var currentChannelId: UInt32 = 0
|
|
|
|
|
var messages: [ChatMessage] = []
|
|
|
|
|
var activityLog: [ActivityEntry] = []
|
|
|
|
|
var voiceState = VoiceState()
|
|
|
|
|
var permissions: Permissions
|
|
|
|
|
var accounts: [Account] = []
|
|
|
|
|
var devices: [Device] = []
|
|
|
|
|
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
/// Host side of iOS screen-audio sharing — drains the broadcast extension's App Group ring
|
|
|
|
|
/// and feeds the SCREEN_AUDIO stream this session owns. See BroadcastAudioPump.
|
|
|
|
|
private let broadcastPump = BroadcastAudioPump()
|
|
|
|
|
|
2026-06-19 02:10:25 +02:00
|
|
|
init(client: VoiceCatClient, selfUserId: UInt32, permissions: Permissions) {
|
|
|
|
|
self.client = client
|
|
|
|
|
self.selfUserId = selfUserId
|
|
|
|
|
self.permissions = permissions
|
|
|
|
|
AudioSessionManager.shared.client = client
|
|
|
|
|
refreshChannels()
|
|
|
|
|
refreshUsers()
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
syncSelfChannel()
|
2026-06-19 02:10:25 +02:00
|
|
|
refreshDevices()
|
|
|
|
|
client.onEvent = { [weak self] ev in
|
|
|
|
|
Task { @MainActor [weak self] in self?.handleEvent(ev) }
|
|
|
|
|
}
|
|
|
|
|
client.onLevel = { [weak self] _, rms in
|
|
|
|
|
Task { @MainActor [weak self] in self?.voiceState.level = rms }
|
|
|
|
|
}
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
broadcastPump.onBroadcastStarted = { [weak self] in self?.startScreenShare() }
|
|
|
|
|
broadcastPump.onBroadcastFinished = { [weak self] in self?.stopScreenShare() }
|
|
|
|
|
broadcastPump.start()
|
2026-06-22 02:38:01 +02:00
|
|
|
// When IOSAudioRouter changes the audio config, restart the voice path if needed so the
|
|
|
|
|
// native VPIO engine (AEC/NS/AGC) engages or disengages to match the new preset/route.
|
|
|
|
|
AudioSessionManager.shared.reconcileVoicePath = { [weak self] in self?.reconcileVoicePath() }
|
2026-06-19 02:10:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deinit {
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
broadcastPump.stop()
|
2026-06-19 02:10:25 +02:00
|
|
|
MainActor.assumeIsolated {
|
|
|
|
|
AudioSessionManager.shared.client = nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Event dispatch
|
|
|
|
|
|
|
|
|
|
func handleEvent(_ ev: VoiceCatEvent) {
|
|
|
|
|
switch ev.type {
|
|
|
|
|
case .channelList:
|
|
|
|
|
refreshChannels()
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
syncSelfChannel()
|
|
|
|
|
case .userJoined, .userLeft:
|
2026-06-19 02:10:25 +02:00
|
|
|
refreshUsers()
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
syncSelfChannel()
|
|
|
|
|
case .userUpdated:
|
|
|
|
|
refreshUsers()
|
|
|
|
|
syncSelfChannel()
|
|
|
|
|
if let me = users.first(where: { $0.id == selfUserId }) {
|
|
|
|
|
applyServerMuteState(muted: me.serverMuted, deafened: me.serverDeafened)
|
|
|
|
|
}
|
2026-06-19 02:10:25 +02:00
|
|
|
case .textMessage:
|
|
|
|
|
let sender = users.first(where: { $0.id == ev.userId })?.nickname ?? "Unknown"
|
|
|
|
|
messages.append(ChatMessage(
|
|
|
|
|
timestamp: Date(timeIntervalSince1970: Double(ev.timestampUnixMs) / 1000),
|
|
|
|
|
senderName: sender,
|
|
|
|
|
text: ev.text ?? "",
|
|
|
|
|
scope: ev.textScope))
|
|
|
|
|
case .talkState:
|
|
|
|
|
let talking = ev.u32a != 0
|
|
|
|
|
let who = users.first(where: { $0.id == ev.userId })?.nickname ?? "user \(ev.userId)"
|
|
|
|
|
addActivity(talking ? "\(who) started talking" : "\(who) stopped talking")
|
|
|
|
|
case .streamStarted:
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
// Our own SCREEN_AUDIO stream is live — begin draining the broadcast ring into it,
|
|
|
|
|
// in the stream's effective channel mode (downmix to mono if the channel is mono).
|
|
|
|
|
if ev.userId == selfUserId && ev.streamId == voiceState.screenStreamId {
|
|
|
|
|
let sid = voiceState.screenStreamId
|
|
|
|
|
let (r, cfg) = client.getStreamAudioConfig(userId: selfUserId, streamId: sid)
|
|
|
|
|
let channels: UInt32 = (r == .ok && cfg?.stereo == true) ? 2 : 1
|
|
|
|
|
let c = client
|
|
|
|
|
broadcastPump.beginFeeding(streamChannels: channels) { pcm, samples, ch in
|
|
|
|
|
c.feedPcm(streamId: sid, pcm: pcm, samplesPerChannel: samples, channels: ch)
|
|
|
|
|
}
|
|
|
|
|
addActivity("Sharing screen audio (\(channels == 2 ? "stereo" : "mono"))")
|
|
|
|
|
break
|
|
|
|
|
}
|
2026-06-19 13:46:20 +02:00
|
|
|
// A remote user started a stream — ensure the audio session is active so we can
|
2026-06-20 03:03:34 +02:00
|
|
|
// hear them even if we haven't joined voice ourselves.
|
2026-06-19 13:46:20 +02:00
|
|
|
if ev.userId != selfUserId {
|
|
|
|
|
do {
|
|
|
|
|
try AudioSessionManager.shared.ensureSessionActive()
|
|
|
|
|
} catch {
|
|
|
|
|
addActivity("Audio session activate failed: \(error)")
|
|
|
|
|
}
|
|
|
|
|
}
|
fix(ios): stop miniaudio from clobbering AVAudioSession (stereo->A2DP output death)
The real root cause of "selecting Stereo Mic kills headphone/A2DP output on Join
Voice." Every prior fix worked on the Swift IOSAudioRouter under the false premise
that "miniaudio does NOT touch AVAudioSession on iOS." It does: the core opened
devices via ma_device_init(nullptr, ...), and with a NULL context miniaudio 0.11.25
runs an iOS "hack" that sets the session category by device type, then
ma_context_init__coreaudio calls setCategory()+setActive() on every device open --
capture -> AVAudioSessionCategoryRecord with zero options. That wipes the
.playAndRecord category, the mode, and .allowBluetoothA2DP / .mixWithOthers /
.allowAirPlay that IOSAudioRouter had just configured, killing headphone/A2DP (and
even wired) output. Stereo presets break worst because they rely on the A2DP output
route the wipe removes. TeamTalk avoids this by opening RemoteIO/VPIO AudioUnits
directly and leaving the session entirely to the app.
Fix (core, cross-platform safe): AudioEngine now owns a ma_context built by
make_context_config() with coreaudio.sessionCategory = ma_ios_session_category_none
and noAudioSessionActivate/Deactivate = MA_TRUE, and routes all ma_device_init calls
(playback, capture, loopback) plus enumerate_devices through it. miniaudio no longer
touches AVAudioSession; IOSAudioRouter is the sole owner (the session is already
activated on connect in AppState before any device opens). Context is lazily inited
in start(), reused across restarts, uninited in ~AudioEngine.
Adds TEMP AudioSessionManager.logSessionState() diagnostics (after activate, on route
change, on .streamStarted) to verify on-device that the category stays
PlayAndRecord+allowBluetoothA2DP instead of flipping to Record. Remove once confirmed.
Windows: cmake --build --preset dev clean; ctest --preset dev 21/21.
iOS build + on-device verification pending on Mac.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 02:34:07 +02:00
|
|
|
AudioSessionManager.shared.logSessionState("stream started (user \(ev.userId))")
|
2026-06-19 02:10:25 +02:00
|
|
|
addActivity("Stream started (user \(ev.userId))")
|
|
|
|
|
case .streamStopped:
|
|
|
|
|
addActivity("Stream stopped (user \(ev.userId))")
|
|
|
|
|
case .joinResult:
|
|
|
|
|
if ev.result == .ok {
|
|
|
|
|
currentChannelId = ev.channelId
|
|
|
|
|
addActivity("Joined channel")
|
|
|
|
|
refreshUsers()
|
|
|
|
|
} else {
|
|
|
|
|
addActivity("Join failed: \(ev.result.description)")
|
|
|
|
|
}
|
|
|
|
|
case .error:
|
|
|
|
|
addActivity("Error: \(ev.text ?? ev.result.description)")
|
|
|
|
|
case .genericResult:
|
|
|
|
|
if ev.result != .ok {
|
|
|
|
|
addActivity("Operation failed: \(ev.result.description)")
|
|
|
|
|
}
|
|
|
|
|
case .accountList:
|
|
|
|
|
accounts = client.listAccounts()
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func addActivity(_ text: String) {
|
|
|
|
|
activityLog.append(ActivityEntry(timestamp: Date(), text: text))
|
|
|
|
|
if activityLog.count > 500 { activityLog.removeFirst() }
|
|
|
|
|
}
|
|
|
|
|
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
// MARK: - Self-channel / server-mute sync
|
|
|
|
|
|
|
|
|
|
/// Sync currentChannelId from the self user's channelId in the user list. Mirrors macOS
|
|
|
|
|
/// MainWindowController.swift:461,491,522. The server auto-places every authed user into
|
|
|
|
|
/// the Lobby (channel 1) on connect, but without this sync currentChannelId stays 0 and
|
|
|
|
|
/// the mic button (gated on currentChannelId == 0) stays permanently dimmed.
|
|
|
|
|
private func syncSelfChannel() {
|
|
|
|
|
if let me = users.first(where: { $0.id == selfUserId }) {
|
|
|
|
|
currentChannelId = me.channelId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Apply server-side mute/deafen state — mirrors macOS MainWindowController.swift:693-700.
|
|
|
|
|
/// iOS was previously ignoring server mute/deafen entirely.
|
|
|
|
|
private func applyServerMuteState(muted: Bool, deafened: Bool) {
|
|
|
|
|
if muted && !voiceState.serverMuted { addActivity("You have been server-muted") }
|
|
|
|
|
if deafened && !voiceState.serverDeafened { addActivity("You have been server-deafened") }
|
|
|
|
|
if !muted && voiceState.serverMuted { addActivity("Server mute cleared") }
|
|
|
|
|
if !deafened && voiceState.serverDeafened { addActivity("Server deafen cleared") }
|
|
|
|
|
voiceState.serverMuted = muted
|
|
|
|
|
voiceState.serverDeafened = deafened
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-19 02:10:25 +02:00
|
|
|
// MARK: - Data refresh
|
|
|
|
|
|
|
|
|
|
func refreshChannels() { channels = client.listChannels() }
|
|
|
|
|
func refreshUsers() { users = client.listUsers() }
|
|
|
|
|
func refreshDevices() { devices = client.listDevices(.input) }
|
|
|
|
|
|
|
|
|
|
// MARK: - Voice controls
|
|
|
|
|
|
|
|
|
|
func joinChannel(_ channelId: UInt32, password: String = "") {
|
|
|
|
|
client.joinChannel(channelId, password: password.isEmpty ? nil : password)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func leaveChannel() {
|
|
|
|
|
client.leaveChannel()
|
|
|
|
|
currentChannelId = 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func startMicStream() {
|
|
|
|
|
AVAudioApplication.requestRecordPermission { [weak self] granted in
|
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
|
guard let self else { return }
|
|
|
|
|
if granted {
|
|
|
|
|
self.doStartMicStream()
|
|
|
|
|
} else {
|
|
|
|
|
self.addActivity("Microphone permission denied — grant in Settings > Privacy > Microphone")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func doStartMicStream() {
|
|
|
|
|
do {
|
2026-06-19 13:46:20 +02:00
|
|
|
try AudioSessionManager.shared.ensureSessionActive()
|
2026-06-19 02:10:25 +02:00
|
|
|
} catch {
|
|
|
|
|
addActivity("AVAudioSession activate failed: \(error)")
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-06-22 02:38:01 +02:00
|
|
|
|
|
|
|
|
// VPIO path: on the AEC presets, the native AVAudioEngine does AEC/NS/AGC and the core
|
|
|
|
|
// runs in external mode (no hardware mic/playback). The mic stream is started with
|
|
|
|
|
// externalFeed so the core skips the hardware capture device; setExternalPlayback makes
|
|
|
|
|
// it skip the hardware playback device and deliver the mix to IOSVoiceProcessingEngine.
|
2026-06-22 03:43:00 +02:00
|
|
|
//
|
|
|
|
|
// ORDER MATTERS: set the external-playback flag now, but defer audioRestart() until
|
|
|
|
|
// AFTER startStream (below) so the MIC LocalStream — which carries external_feed=true —
|
|
|
|
|
// already exists when ensure_audio_running() derives external_capture. Restarting before
|
|
|
|
|
// the stream exists makes the core reopen a hardware capture device that is never dropped
|
|
|
|
|
// (the announce-result restart early-returns because the engine is already running); that
|
|
|
|
|
// lingering miniaudio capture unit then fights the AVAudioEngine VPIO unit on the same
|
|
|
|
|
// .voiceChat session and silences VPIO playback.
|
2026-06-22 02:38:01 +02:00
|
|
|
let useVPIO = IOSAudioRouter.shared.currentConfigUsesVoiceProcessing
|
2026-06-22 03:43:00 +02:00
|
|
|
client.setExternalPlayback(useVPIO)
|
2026-06-22 02:38:01 +02:00
|
|
|
|
|
|
|
|
let desc = StreamDescriptor(kind: .mic, deviceId: voiceState.currentDeviceId, label: "Mic",
|
|
|
|
|
externalFeed: useVPIO)
|
2026-06-19 02:10:25 +02:00
|
|
|
let (result, streamId) = client.startStream(desc)
|
|
|
|
|
if result == .ok {
|
|
|
|
|
voiceState.micActive = true
|
|
|
|
|
voiceState.localStreamId = streamId
|
2026-06-19 16:58:21 +02:00
|
|
|
// Publish the active mic stream ID so IOSAudioRouter can reset the core's capture
|
|
|
|
|
// channel count when the user switches mono↔stereo (selectCaptureChannels /
|
|
|
|
|
// applyPreset). Without this, switching stereo→mono leaves the LocalStream's
|
|
|
|
|
// capture_channels field at 2 and the next engine start still opens stereo.
|
|
|
|
|
AudioSessionManager.shared.activeMicStreamId = streamId
|
2026-06-19 17:39:23 +02:00
|
|
|
// Store the user's capture channel selection before the server acknowledges
|
|
|
|
|
// the stream. The engine hasn't started yet at this point (it starts when
|
|
|
|
|
// handle_stream_announce_result fires), so vc_set_capture_channels just
|
|
|
|
|
// stores the value — no restart. ensure_audio_running() picks it up when
|
|
|
|
|
// the stream is confirmed and opens the device with the right channel count.
|
feat(ios): audio overhaul, Join/Leave Voice, channel-id sync fix, stereo mic capture
Three iOS client problems fixed plus a new core stereo-mic capture ABI:
1. Channel-id sync bug (mic button permanently dimmed): SessionState never
synced currentChannelId from the self user's channelId on connect, so the
mic button (gated on currentChannelId == 0) stayed dimmed. Added
syncSelfChannel() (mirrors macOS MainWindowController.swift:461,491,522);
called from init/.channelList/.userJoined/.userLeft/.userUpdated/.joinResult.
Added applyServerMuteState() + serverMuted/serverDeafened to VoiceState.
2. Join/Leave Voice button: replaced icon-only mic toggle with explicit
text button (parity with macOS). Mute/deafen disable when not in voice.
3. IOSAudioRouter.swift (new): full AVAudioSession routing layer — input
port selection, built-in mic orientation/polar patterns, Bluetooth
HFP/A2DP/Off modes, Standard/Raw mic processing, stereo capture, AirPlay,
UserDefaults persistence. AudioSessionManager delegates to it.
4. Core stereo-mic capture (append-only ABI): vc_set_capture_channels()
lets the core open the mic device in stereo (2-ch interleaved). LocalStream
gains capture_channels; ensure_audio_running reads it; audio_engine.cpp
capture_accum_ + on_capture updated to channel-aware accumulation. Test
test_stereo_mic_capture (headless, L!=R stereo round-trip). Swift wrapper
VoiceCatClient.setCaptureChannels.
5. Settings UI rework: AVAudioSession-derived input/output tree replaces
miniaudio device picker.
6. iOS deployment target raised to 18.0 (Package.swift + project.pbxproj).
swift-tools-version 6.0 with swiftLanguageModes .v5.
Docs: tech-stack.md, architecture.md, voice.md, roadmap.md, building.md
updated; stale 'vc_audio_suspend/resume deferred' claims corrected.
Verified: ctest --preset dev 21/21 green; swift test 6/6 green;
xcodebuild -target VoiceCatiOS -sdk iphonesimulator BUILD SUCCEEDED.
2026-06-19 13:17:52 +02:00
|
|
|
let channels = IOSAudioRouter.shared.captureChannels.channelCount
|
|
|
|
|
if channels != 1 {
|
|
|
|
|
client.setCaptureChannels(streamId: streamId, channels: channels)
|
|
|
|
|
}
|
2026-06-22 02:38:01 +02:00
|
|
|
if useVPIO {
|
2026-06-22 03:43:00 +02:00
|
|
|
// The external-feed MIC stream now exists, so restart the core into full
|
|
|
|
|
// external mode (no hardware capture/playback, mixer-timer only) — mic and
|
|
|
|
|
// speaker are owned entirely by the VPIO engine, which we start right after.
|
|
|
|
|
client.audioRestart()
|
2026-06-22 02:38:01 +02:00
|
|
|
IOSVoiceProcessingEngine.shared.start(
|
|
|
|
|
client: client, micStreamId: streamId, captureChannels: channels)
|
|
|
|
|
}
|
2026-06-19 02:10:25 +02:00
|
|
|
} else {
|
|
|
|
|
addActivity("Failed to start mic: \(result.description)")
|
2026-06-22 02:38:01 +02:00
|
|
|
if useVPIO { // revert external-playback mode so remote audio still plays
|
|
|
|
|
client.setExternalPlayback(false)
|
|
|
|
|
client.audioRestart()
|
|
|
|
|
}
|
2026-06-19 02:10:25 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func stopMicStream() {
|
2026-06-22 02:38:01 +02:00
|
|
|
// Tear down the VPIO engine first (removes the mic tap + unregisters the mixed sink),
|
|
|
|
|
// then stop the mic stream, then restore the core's hardware playback for any remaining
|
|
|
|
|
// remote audio. Order matters: the mic stream must be gone before audioRestart so the
|
|
|
|
|
// core opens a normal playback device (and no capture device — there's no mic stream).
|
|
|
|
|
let wasVPIO = IOSVoiceProcessingEngine.shared.isRunning
|
|
|
|
|
if wasVPIO {
|
|
|
|
|
IOSVoiceProcessingEngine.shared.stop()
|
|
|
|
|
}
|
2026-06-19 02:10:25 +02:00
|
|
|
if voiceState.localStreamId != 0 {
|
|
|
|
|
client.stopStream(voiceState.localStreamId)
|
|
|
|
|
voiceState.localStreamId = 0
|
2026-06-19 16:58:21 +02:00
|
|
|
AudioSessionManager.shared.activeMicStreamId = nil
|
2026-06-19 02:10:25 +02:00
|
|
|
}
|
2026-06-22 02:38:01 +02:00
|
|
|
if wasVPIO {
|
|
|
|
|
client.setExternalPlayback(false)
|
|
|
|
|
client.audioRestart() // reopen hardware playback (no mic stream → no hw capture)
|
|
|
|
|
}
|
2026-06-19 02:10:25 +02:00
|
|
|
voiceState.micActive = false
|
|
|
|
|
voiceState.level = 0
|
2026-06-19 13:46:20 +02:00
|
|
|
// Do NOT deactivate the AVAudioSession here — the user may still want to hear
|
|
|
|
|
// remote audio (other people talking). The session is deactivated only when
|
|
|
|
|
// disconnecting from the server (see AppState.disconnect / .disconnected event).
|
2026-06-19 02:10:25 +02:00
|
|
|
}
|
|
|
|
|
|
2026-06-22 02:38:01 +02:00
|
|
|
/// Restart the voice path when the audio config changes mid-call (driven by IOSAudioRouter).
|
|
|
|
|
/// If VPIO is involved on either the current or desired side, restart the mic so the native
|
|
|
|
|
/// voice-processing engine engages/disengages and re-binds to the new route. Pure miniaudio
|
|
|
|
|
/// config tweaks need no restart — the core's own audioRestart (already issued) handles them.
|
|
|
|
|
private func reconcileVoicePath() {
|
|
|
|
|
guard voiceState.micActive else { return }
|
|
|
|
|
let want = IOSAudioRouter.shared.currentConfigUsesVoiceProcessing
|
|
|
|
|
let have = IOSVoiceProcessingEngine.shared.isRunning
|
|
|
|
|
guard want || have else { return }
|
|
|
|
|
stopMicStream()
|
|
|
|
|
doStartMicStream()
|
|
|
|
|
}
|
|
|
|
|
|
feat(apple): screen-audio sharing -- macOS ScreenCaptureKit, iOS ReplayKit
Implement system/desktop audio sharing on the Apple clients, feeding the
existing SCREEN_AUDIO Opus -> AEAD -> UDP path via vc_stream_feed_pcm. No
C++/protocol/codec changes -- the core was already ready (the Windows-only
loopback is #ifdef VOICECAT_HAS_LOOPBACK; off Windows the stream just waits
for fed PCM). Audio only; video is dropped.
macOS (in-process):
- ScreenAudioCapture.swift drives an audio-only SCStream
(excludesCurrentProcessAudio), converts Float32 -> int16 in the channel's
mono/stereo mode, and calls feedPcm. Capture starts on the self
.streamStarted event (effective config known then). Wired into
MainWindowController.screenAudioClicked().
iOS (forward-to-host, single session):
- VoiceCatBroadcast: a ReplayKit Broadcast Upload Extension consumes
.audioApp only, resamples to 48kHz int16 stereo (AVAudioConverter), and
writes a shared App Group SPSC ring (BroadcastAudioRing.swift). It does
not link libvoicecat.
- Host BroadcastAudioPump drains the ring (reacting to the extension's
Darwin notifications) and feeds the SCREEN_AUDIO stream it owns, downmixing
to mono when the channel is mono. Screen audio appears as a second stream
of the same user; no credentials persisted. UI is RPSystemBroadcastPicker
View in VoiceControlsView. Removes the speculative BroadcastCredentials.
Docs: voice.md s9, CLAUDE.md status, PROGRESS.md.
2026-06-21 00:14:31 +02:00
|
|
|
// MARK: - Screen audio share
|
|
|
|
|
|
|
|
|
|
/// Called when the broadcast extension becomes active. Announces the SCREEN_AUDIO stream;
|
|
|
|
|
/// feeding begins on the resulting `.streamStarted` event (see handleEvent). The actual
|
|
|
|
|
/// system-audio capture happens in the ReplayKit upload extension (a separate process).
|
|
|
|
|
private func startScreenShare() {
|
|
|
|
|
guard voiceState.screenStreamId == 0 else { return }
|
|
|
|
|
guard currentChannelId != 0 else {
|
|
|
|
|
addActivity("Screen audio ignored — join a channel first")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let (result, streamId) = client.startStream(
|
|
|
|
|
StreamDescriptor(kind: .screenAudio, deviceId: nil, label: "Screen audio"))
|
|
|
|
|
if result == .ok {
|
|
|
|
|
voiceState.screenStreamId = streamId
|
|
|
|
|
voiceState.screenSharing = true
|
|
|
|
|
addActivity("Screen audio share starting…")
|
|
|
|
|
} else {
|
|
|
|
|
addActivity("Failed to start screen audio: \(result.description)")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Called when the broadcast ends (or on disconnect). Stops feeding and the stream.
|
|
|
|
|
private func stopScreenShare() {
|
|
|
|
|
broadcastPump.endFeeding()
|
|
|
|
|
if voiceState.screenStreamId != 0 {
|
|
|
|
|
client.stopStream(voiceState.screenStreamId)
|
|
|
|
|
voiceState.screenStreamId = 0
|
|
|
|
|
}
|
|
|
|
|
if voiceState.screenSharing {
|
|
|
|
|
voiceState.screenSharing = false
|
|
|
|
|
addActivity("Stopped sharing screen audio")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-19 02:10:25 +02:00
|
|
|
func setMute(_ muted: Bool, deafened: Bool) {
|
|
|
|
|
client.setSelfMute(micMuted: muted, deafened: deafened)
|
|
|
|
|
voiceState.selfMuted = muted
|
|
|
|
|
voiceState.selfDeafened = deafened
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func setInputMode(_ mode: VoiceCatInputMode) {
|
|
|
|
|
client.setInputMode(mode)
|
|
|
|
|
voiceState.inputMode = mode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func setVadThreshold(_ threshold: Float) {
|
|
|
|
|
client.setVadThreshold(threshold)
|
|
|
|
|
voiceState.vadThreshold = threshold
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func setPushToTalk(_ active: Bool) {
|
|
|
|
|
client.setPushToTalk(active)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Text
|
|
|
|
|
|
|
|
|
|
func sendText(_ text: String, scope: VoiceCatTextScope, targetId: UInt32 = 0) {
|
|
|
|
|
client.sendText(scope: scope, targetId: targetId, text: text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - Admin
|
|
|
|
|
|
|
|
|
|
func kickUser(_ userId: UInt32, reason: String) {
|
|
|
|
|
client.kickUser(userId, reason: reason.isEmpty ? nil : reason)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func banUser(_ userId: UInt32, reason: String, expiresUnixMs: UInt64) {
|
|
|
|
|
client.banUser(userId, reason: reason.isEmpty ? nil : reason, expiresUnixMs: expiresUnixMs)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func moveUser(_ userId: UInt32, toChannel channelId: UInt32) {
|
|
|
|
|
client.moveUser(userId, toChannel: channelId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func setPermissions(_ userId: UInt32, perms: Permissions) {
|
|
|
|
|
client.setPermission(userId, perms: perms)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func setServerMute(_ userId: UInt32, muted: Bool, deafened: Bool) {
|
|
|
|
|
client.setServerMute(userId, muted: muted, deafened: deafened)
|
|
|
|
|
}
|
|
|
|
|
|
feat(clients): expose all channel codec params + guest nickname everywhere
Channel create/edit UIs only surfaced a subset of the core's vc_audio_config,
and DRED was exposed nowhere. While adding it, found a latent ABI mismatch:
both Swift AudioConfig and the C# VcAudioConfigNative blittable struct were one
int short of the native vc_audio_config (missing the trailing `dred`), so native
read past the managed struct in vc_create_channel/vc_edit_channel.
- core marshaling: thread `dred` through Swift (Models/Marshaling/toNative) and
C# (Structs/Models/Marshaling/VoiceCatClient) -- fixes the ABI gap + enables it
- windows: add the one missing DRED checkbox to ChannelEditDialog
- macos: ChannelEditSheet now exposes application, sample rate, packet loss,
complexity, and DRED (was stereo/bitrate/frame/FEC/DTX only)
- ios: rebuild ChannelEditView into a full create+edit form (all params); add
SessionState.editChannel + an admin Edit swipe action (iOS had no edit UI)
- guest nickname: add a dedicated `nickname` to SavedServer on macOS+iOS
(backward-compatible Codable), shown in Guest mode, wired into the guest auth
path -- guests could not set a display name on either before (only Windows)
Verified: macOS + iOS (sim, arm64) xcodebuild BUILD SUCCEEDED; core ctest 22/23
(only external_pcm aborts on a pre-existing shutdown mutex race; no C++ changed).
2026-06-21 04:03:50 +02:00
|
|
|
func createChannel(_ info: ChannelEdit) {
|
2026-06-19 02:10:25 +02:00
|
|
|
client.createChannel(info)
|
|
|
|
|
}
|
|
|
|
|
|
feat(clients): expose all channel codec params + guest nickname everywhere
Channel create/edit UIs only surfaced a subset of the core's vc_audio_config,
and DRED was exposed nowhere. While adding it, found a latent ABI mismatch:
both Swift AudioConfig and the C# VcAudioConfigNative blittable struct were one
int short of the native vc_audio_config (missing the trailing `dred`), so native
read past the managed struct in vc_create_channel/vc_edit_channel.
- core marshaling: thread `dred` through Swift (Models/Marshaling/toNative) and
C# (Structs/Models/Marshaling/VoiceCatClient) -- fixes the ABI gap + enables it
- windows: add the one missing DRED checkbox to ChannelEditDialog
- macos: ChannelEditSheet now exposes application, sample rate, packet loss,
complexity, and DRED (was stereo/bitrate/frame/FEC/DTX only)
- ios: rebuild ChannelEditView into a full create+edit form (all params); add
SessionState.editChannel + an admin Edit swipe action (iOS had no edit UI)
- guest nickname: add a dedicated `nickname` to SavedServer on macOS+iOS
(backward-compatible Codable), shown in Guest mode, wired into the guest auth
path -- guests could not set a display name on either before (only Windows)
Verified: macOS + iOS (sim, arm64) xcodebuild BUILD SUCCEEDED; core ctest 22/23
(only external_pcm aborts on a pre-existing shutdown mutex race; no C++ changed).
2026-06-21 04:03:50 +02:00
|
|
|
func editChannel(_ info: ChannelEdit) {
|
|
|
|
|
client.editChannel(info)
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-19 02:10:25 +02:00
|
|
|
func deleteChannel(_ channelId: UInt32) {
|
|
|
|
|
client.deleteChannel(channelId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func fetchAccountList() {
|
|
|
|
|
client.requestAccountList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func createAccount(username: String, password: String) {
|
|
|
|
|
client.createAccount(username, password: password)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func deleteAccount(username: String) {
|
|
|
|
|
client.deleteAccount(username)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func resetPassword(username: String, newPassword: String) {
|
|
|
|
|
client.resetPassword(username, newPassword: newPassword)
|
|
|
|
|
}
|
|
|
|
|
}
|