# langstaffe/mobilespeak architecture

> Architecture diagram of the GitHub repository langstaffe/mobilespeak, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langstaffe/mobilespeak
- Repository: https://github.com/langstaffe/mobilespeak

## Overview

MobileSpeak is a TeamSpeak voice-chat client for Android and iOS, backed by a Rust native core. The principal workflow is connecting to a server, browsing channels and communicating by voice/chat, with client state driving audio and session behavior. The graph preserves major documented features while distinguishing app UI/session orchestration, native protocol handling, and audio processing. Edges are limited to excerpted references or README statements; unsampled feature links are documented but not asserted as specific calls.

Main entry points: [`native/src/lib.rs`](https://github.com/langstaffe/mobilespeak/blob/main/native/src/lib.rs) (Native command worker), [`android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt) (Android session), [`native/patched/tsproto/src/client.rs`](https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/client.rs) (Protocol client), [`native/src/receive_audio.rs`](https://github.com/langstaffe/mobilespeak/blob/main/native/src/receive_audio.rs) (Receive audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["Mobile apps"]
  node_android_ui["Android interface<br/>[MainActivity.kt]"]
  node_ios_ui["iOS interface"]
end

subgraph group_session["Connection and session"]
  node_android_session["Android session<br/>[ClientSession.kt]"]
  node_ios_client["iOS client<br/>[Client.swift]"]
  node_connection_gate["Connection gate<br/>[ConnectionGate.kt]"]
  node_secure_store["Identity and secrets<br/>[SecureStore.kt]"]
  node_voice_service["Background voice service<br/>[VoiceService.kt]"]
end

subgraph group_protocol["Native protocol"]
  node_native_bridge["Native bridge<br/>[NativeCore.kt]"]
  node_native_core["Native command worker<br/>[lib.rs]"]
  node_protocol_client["Protocol client<br/>[client.rs]"]
  node_protocol_connection["Connection transport<br/>[connection.rs]"]
  node_packet_resend["Packet reliability<br/>[resend.rs]"]
  node_channel_files["Channel file transfers<br/>[channel_files.rs]"]
  node_chat["Chat and history<br/>[chat.rs]"]
  node_avatar["Avatars and profile<br/>[avatar.rs]"]
  node_network_quality["Connection quality<br/>[network_quality.rs]"]
end

subgraph group_audio["Voice and media"]
  node_audio_engine["Android audio engine<br/>[AudioEngine.kt]"]
  node_ios_audio["iOS phone audio<br/>[PhoneAudio.swift]"]
  node_audio_receive["Receive audio<br/>[receive_audio.rs]"]
  node_audio_client["Audio packet queues<br/>[audio.rs]"]
  node_audio_processing["Audio processing"]
  node_audio_models["Noise suppression models<br/>[audio_models.rs]"]
  node_playback["Playback and sounds<br/>[playback.rs]"]
end

node_user(("Mobile user"))
node_team_server{{"TeamSpeak server"}}

node_user -->|"uses"| node_android_ui
node_user -->|"uses"| node_ios_ui
node_android_ui -->|"requests actions"| node_android_session
node_ios_ui -->|"uses client"| node_ios_client
node_android_session -->|"coordinates connection"| node_connection_gate
node_android_session -->|"uses secrets"| node_secure_store
node_android_session -->|"sends commands"| node_native_bridge
node_android_session -->|"updates service"| node_voice_service
node_voice_service -->|"starts and updates"| node_audio_engine
node_audio_engine -->|"reports audio state"| node_android_session
node_native_bridge -.->|"bridges commands"| node_native_core
node_native_core -->|"runs protocol worker"| node_protocol_client
node_protocol_client -->|"uses transport"| node_protocol_connection
node_protocol_connection -->|"uses reliability"| node_packet_resend
node_protocol_client -->|"connects securely"| node_team_server
node_native_core -->|"dispatches file operations"| node_channel_files
node_native_core -->|"dispatches chat"| node_chat
node_native_core -->|"dispatches avatar operations"| node_avatar
node_native_core -->|"dispatches receive audio"| node_audio_receive
node_audio_receive -->|"uses audio queues"| node_audio_client
node_audio_receive -->|"uses processing"| node_audio_processing
node_audio_processing -->|"uses models"| node_audio_models
node_native_core -->|"dispatches playback"| node_playback
node_playback -->|"uses audio packets"| node_audio_client
node_ios_client -->|"manages audio"| node_ios_audio
node_native_core -->|"publishes quality"| node_network_quality
node_user -.->|"joins channels and chats"| node_team_server

click node_android_ui "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/MainActivity.kt"
click node_ios_ui "https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/MobileSpeakApp.swift"
click node_android_session "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt"
click node_ios_client "https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/Client.swift"
click node_connection_gate "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ConnectionGate.kt"
click node_secure_store "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/SecureStore.kt"
click node_voice_service "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/VoiceService.kt"
click node_native_bridge "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/NativeCore.kt"
click node_native_core "https://github.com/langstaffe/mobilespeak/blob/main/native/src/lib.rs"
click node_protocol_client "https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/client.rs"
click node_protocol_connection "https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/connection.rs"
click node_packet_resend "https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/resend.rs"
click node_channel_files "https://github.com/langstaffe/mobilespeak/blob/main/native/src/channel_files.rs"
click node_chat "https://github.com/langstaffe/mobilespeak/blob/main/native/src/chat.rs"
click node_avatar "https://github.com/langstaffe/mobilespeak/blob/main/native/src/avatar.rs"
click node_audio_engine "https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/AudioEngine.kt"
click node_ios_audio "https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/PhoneAudio.swift"
click node_audio_receive "https://github.com/langstaffe/mobilespeak/blob/main/native/src/receive_audio.rs"
click node_audio_client "https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsclientlib/src/audio.rs"
click node_audio_processing "https://github.com/langstaffe/mobilespeak/blob/main/native/src/audio_processing.rs"
click node_audio_models "https://github.com/langstaffe/mobilespeak/blob/main/native/src/audio_models.rs"
click node_playback "https://github.com/langstaffe/mobilespeak/blob/main/native/src/playback.rs"
click node_network_quality "https://github.com/langstaffe/mobilespeak/blob/main/native/src/network_quality.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_android_ui,node_ios_ui,node_user toneBlue
class node_android_session,node_ios_client,node_connection_gate,node_secure_store,node_voice_service toneAmber
class node_native_bridge,node_native_core,node_protocol_client,node_protocol_connection,node_packet_resend,node_channel_files,node_chat,node_avatar,node_network_quality,node_team_server toneMint
class node_audio_engine,node_ios_audio,node_audio_receive,node_audio_client,node_audio_processing,node_audio_models,node_playback toneRose
```

## Components

### Mobile apps

- [Android interface](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/MainActivity.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/MainActivity.kt`
- [iOS interface](https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/MobileSpeakApp.swift): `ios/NativeApp/MobileSpeakApp.swift`

### Connection and session

- [Android session](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`
- [iOS client](https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/Client.swift): `ios/NativeApp/Client.swift`
- [Connection gate](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ConnectionGate.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ConnectionGate.kt`
- [Identity and secrets](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/SecureStore.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/SecureStore.kt`
- [Background voice service](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/VoiceService.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/VoiceService.kt`

### Native protocol

- [Native bridge](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/NativeCore.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/NativeCore.kt`
- [Native command worker](https://github.com/langstaffe/mobilespeak/blob/main/native/src/lib.rs): `native/src/lib.rs`
- [Protocol client](https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/client.rs): `native/patched/tsproto/src/client.rs`
- [Connection transport](https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/connection.rs): `native/patched/tsproto/src/connection.rs`
- [Packet reliability](https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsproto/src/resend.rs): `native/patched/tsproto/src/resend.rs`
- [Channel file transfers](https://github.com/langstaffe/mobilespeak/blob/main/native/src/channel_files.rs): `native/src/channel_files.rs`
- [Chat and history](https://github.com/langstaffe/mobilespeak/blob/main/native/src/chat.rs): `native/src/chat.rs`
- [Avatars and profile](https://github.com/langstaffe/mobilespeak/blob/main/native/src/avatar.rs): `native/src/avatar.rs`
- [Connection quality](https://github.com/langstaffe/mobilespeak/blob/main/native/src/network_quality.rs): `native/src/network_quality.rs`

### Voice and media

- [Android audio engine](https://github.com/langstaffe/mobilespeak/blob/main/android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/AudioEngine.kt): `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/AudioEngine.kt`
- [iOS phone audio](https://github.com/langstaffe/mobilespeak/blob/main/ios/NativeApp/PhoneAudio.swift): `ios/NativeApp/PhoneAudio.swift`
- [Receive audio](https://github.com/langstaffe/mobilespeak/blob/main/native/src/receive_audio.rs): `native/src/receive_audio.rs`
- [Audio packet queues](https://github.com/langstaffe/mobilespeak/blob/main/native/patched/tsclientlib/src/audio.rs): `native/patched/tsclientlib/src/audio.rs`
- [Audio processing](https://github.com/langstaffe/mobilespeak/blob/main/native/src/audio_processing.rs): `native/src/audio_processing.rs`
- [Noise suppression models](https://github.com/langstaffe/mobilespeak/blob/main/native/src/audio_models.rs): `native/src/audio_models.rs`
- [Playback and sounds](https://github.com/langstaffe/mobilespeak/blob/main/native/src/playback.rs): `native/src/playback.rs`

### Other components

- **Mobile user**
- **TeamSpeak server**

## Connections

- Mobile user → Android interface: uses
- Mobile user → iOS interface: uses
- Android interface → Android session: requests actions (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/MainActivity.kt`)
- iOS interface → iOS client: uses client (evidence: `ios/NativeApp/MobileSpeakApp.swift`)
- Android session → Connection gate: coordinates connection (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`)
- Android session → Identity and secrets: uses secrets (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`)
- Android session → Native bridge: sends commands (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`)
- Android session → Background voice service: updates service (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/ClientSession.kt`)
- Background voice service → Android audio engine: starts and updates (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/VoiceService.kt`)
- Android audio engine → Android session: reports audio state (evidence: `android/app/src/main/kotlin/dev/mobilespeak/mobilespeak/AudioEngine.kt`)
- Native bridge → Native command worker: bridges commands
- Native command worker → Protocol client: runs protocol worker
- Protocol client → Connection transport: uses transport (evidence: `native/patched/tsproto/src/client.rs`)
- Connection transport → Packet reliability: uses reliability (evidence: `native/patched/tsproto/src/connection.rs`)
- Protocol client → TeamSpeak server: connects securely
- Native command worker → Channel file transfers: dispatches file operations (evidence: `native/src/lib.rs`)
- Native command worker → Chat and history: dispatches chat (evidence: `native/src/lib.rs`)
- Native command worker → Avatars and profile: dispatches avatar operations (evidence: `native/src/lib.rs`)
- Native command worker → Receive audio: dispatches receive audio (evidence: `native/src/lib.rs`)
- Receive audio → Audio packet queues: uses audio queues (evidence: `native/src/receive_audio.rs`)
- Receive audio → Audio processing: uses processing (evidence: `native/src/receive_audio.rs`)
- Audio processing → Noise suppression models: uses models (evidence: `native/src/audio_processing.rs`)
- Native command worker → Playback and sounds: dispatches playback (evidence: `native/src/lib.rs`)
- Playback and sounds → Audio packet queues: uses audio packets (evidence: `native/src/playback.rs`)
- iOS client → iOS phone audio: manages audio (evidence: `ios/NativeApp/Client.swift`)
- Native command worker → Connection quality: publishes quality (evidence: `native/src/lib.rs`)
- Mobile user → TeamSpeak server: joins channels and chats
