export type PreferredAudioInput = 'bluetoothHighQualityMic' | 'builtInMic' | 'none'; export type RouteConfigEntry = { category: 'playAndRecord' | 'record' | 'soloAmbient' | 'ambient' | 'playback'; mode: 'default' | 'measurement' | 'voiceChat' | 'videoRecording' | 'gameChat'; options: ('mixWithOthers' | 'duckOthers' | 'allowBluetooth' | 'allowBluetoothHFP' | 'allowBluetoothA2DP' | 'bluetoothHighQualityRecording' | 'allowAirPlay' | 'defaultToSpeaker' | 'overrideMutedMicrophoneInterruption')[]; /** First input policy to try. HD Bluetooth requires iOS 26, mode=default, and bluetoothHighQualityRecording. */ preferredInput: PreferredAudioInput; /** * Forced fallback after an HD Bluetooth request fails. builtInMic switches * to phone-mic + A2DP; none switches to ordinary headset HFP. */ forceFallback?: PreferredAudioInput; /** Lowercase JSON alias for forceFallback. Prefer forceFallback in TypeScript. */ forcefallback?: PreferredAudioInput; /** Backward-compatible alias for forceFallback. */ preferredInputFallback?: PreferredAudioInput; /** Additional forced fallback after forceFallback. */ forceFallback1?: PreferredAudioInput; /** Lowercase JSON alias for forceFallback1. */ forcefallback1?: PreferredAudioInput; /** Backward-compatible alias for forceFallback1. */ preferredInputFallback1?: PreferredAudioInput; /** Final forced fallback. */ forceFallback2?: PreferredAudioInput; /** Lowercase JSON alias for forceFallback2. */ forcefallback2?: PreferredAudioInput; /** Backward-compatible alias for forceFallback2. */ preferredInputFallback2?: PreferredAudioInput; }; export type AudioRoutingConfig = { /** * App-wide echo cancellation for STT, wake word and TTS. When present it * replaces WakewordAEC. * - 'off': no AEC. * - 'duringTTS': AEC only while TTS audio is playing. * - 'always': AEC whenever STT or wake word is listening, kept on (no * switching around TTS). * Newer iPhones (iOS 18.2+ with hardware support) use iOS's session-level * AEC. Older iPhones use an echo-cancelling audio engine that TTS plays * through, owned by STT while STT runs. * Android: wake word and TTS on all supported versions; STT on Android 13+ * (VOICE_COMMUNICATION capture + AcousticEchoCanceler), speaker routes only. */ AEC?: { mode: 'off' | 'duringTTS' | 'always'; }; /** Older wake-word-only AEC preferences; ignored when AEC is set. */ WakewordAEC?: { regular: boolean; duringTTS: boolean; }; default: RouteConfigEntry; byOutputPort: { carAudio?: RouteConfigEntry; builtInReceiver?: RouteConfigEntry; builtInSpeaker?: RouteConfigEntry; bluetoothA2DP?: RouteConfigEntry; bluetoothHFP?: RouteConfigEntry; headphones?: RouteConfigEntry; }; /** Temporary wake-word sensitivity used only while physical TTS audio plays. */ wakeWordDuringTTS?: { threshold: number; buffer_cnt: number; }; };