Skip to content

Multi-mic selection with audio mixer integration#222

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-audio-mixer-support
Draft

Multi-mic selection with audio mixer integration#222
Copilot wants to merge 5 commits intomainfrom
copilot/add-audio-mixer-support

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

The app only supports one mic at a time. This adds an audio mixer that mixes one or more mics into a single output stream, and updates the UI to allow multi-mic selection.

Audio mixer integration (AudioUnit.swift)

  • Integrates the existing (unused) AudioMixer class into the audio pipeline
  • When >1 source is registered, lazily starts the mixer with a periodic timer rendering mixed output to the encoder
  • Converts between CMSampleBuffer and AVAudioPCMBuffer at the mixer boundary
  • Falls back to the existing direct single-source path when ≤1 source is active — zero behavior change for single-mic users
  • Exposes addMixerSource/removeMixerSource/addMixerBuiltinSource/removeMixerBuiltinSource through Processor and Media

Multi-mic selection model (ModelAudio.swift)

  • Mic class gains selectedMicIds: Set<String> and isSelected(mic:)
  • manualToggleMicById toggles mics in/out of the mixer via addMicToMixer/removeMicFromMixer helpers that dispatch to the correct mixer API per mic type (builtin, RTMP, SRTLA, RIST, media player)
  • Existing selectMic (auto-switch, scene override) resets to single-mic mode for backward compat

UI changes

  • QuickButtonMicView: Single-select checkmark → multi-select toggle (circle / checkmark.circle.fill), calls manualToggleMicById. Removed swipe-to-delete.
  • AudioSettingsView / StreamOverlayLeftView: Show comma-separated names of all selected mics
// Usage from app code
media.addMixerBuiltinSource()           // built-in mic
media.addMixerSource(sourceId: rtmpId)  // network camera mic
media.removeMixerSource(sourceId: rtmpId)

Tests (AudioMixerSuite.swift)

  • Added three-input mixing test and dynamic add/remove test

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 8, 2026 10:47
- Add AudioMixer instance and mixer source management to AudioUnit
- Add mixer processing timer that periodically renders mixed output
- Convert CMSampleBuffer to AVAudioPCMBuffer for mixer input
- Convert mixer PCM output back to CMSampleBuffer for encoder
- Add addMixerSource/removeMixerSource/addMixerBuiltinSource/removeMixerBuiltinSource APIs
- Expose mixer source management through Processor and Media classes
- When multiple sources are active, route through mixer; single source uses direct path

Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
…ove test coverage

Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot AI changed the title [WIP] Add audio mixer for multiple mic inputs Integrate AudioMixer into audio pipeline for multi-mic mixing Feb 8, 2026
Copilot AI requested a review from eerimoq February 8, 2026 10:51
Copilot AI and others added 2 commits February 8, 2026 11:15
- Add selectedMicIds set to Mic model class to track which mics are active
- Add manualToggleMicById method for toggling mics on/off in the mixer
- Add addMicToMixer/removeMicFromMixer helpers to wire up the mixer API
- Update QuickButtonMicView to use circle/checkmark toggle instead of single select
- Remove delete functionality (mics are toggled, not deleted)
- Update AudioSettingsView to show all selected mic names
- Update StreamOverlayLeftView to show all selected mic names
- Update footer text to say "Select one or more mics to mix together"
- When selectMic is called (auto-switch, scene override), reset to single mic

Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
…fter deselect

Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot AI changed the title Integrate AudioMixer into audio pipeline for multi-mic mixing Multi-mic selection with audio mixer integration Feb 8, 2026
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