Skip to content

Comments

Add audio input monitoring with route change handling#5

Merged
rudrankriyam merged 1 commit intorryam:mainfrom
IfritLabs:feature/input-switching
Oct 10, 2025
Merged

Add audio input monitoring with route change handling#5
rudrankriyam merged 1 commit intorryam:mainfrom
IfritLabs:feature/input-switching

Conversation

@IfritLabs
Copy link
Contributor

  • Created AudioInputInfo struct to encapsulate AVAudioSession port details without requiring main targets to import AVFoundation
  • Added audioInputConfigurationStream to SpeechSession for monitoring audio input changes (microphone, AirPods, etc.)
  • Implemented automatic audio engine reset on route changes to handle device switching seamlessly
  • Added proper cleanup in deinit for notification observers and stream continuations

Technical note: Currently the stream only yields values after audio starts flowing (when AVAudioSession is activated). The stream could be made to flow immediately on SpeechSession creation if we configure AVAudioSession on app launch instead of when transcription starts. This would allow consumers to get mic info right away instead of waiting for the engine to start. It's up to you.

- Created AudioInputInfo struct to encapsulate AVAudioSession port details
without requiring main targets to import AVFoundation
- Added audioInputConfigurationStream to SpeechSession for monitoring
audio input changes (microphone, AirPods, etc.)
- Implemented automatic audio engine reset on route changes to handle
device switching seamlessly
- Added proper cleanup in deinit for notification observers and stream
continuations

Technical note: Currently the stream only yields values after audio starts
flowing (when AVAudioSession is activated). The stream could be made to
flow immediately on SpeechSession creation if we configure AVAudioSession
on app launch instead of when transcription starts. This would allow
consumers to get mic info right away instead of waiting for the engine to
start. It's up to you.
@rudrankriyam rudrankriyam merged commit dc785ea into rryam:main Oct 10, 2025
@rudrankriyam
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants