Skip to main content

Module activate

Module activate 

Source
Expand description

Platform-specific audio input device activation.

On macOS, Bluetooth devices (like AirPods) connect in A2DP mode which provides high-quality audio output but no microphone input. The mic requires a switch to the HFP/SCO profile, which macOS normally triggers when an app selects the device as the system input.

Higher-level Apple frameworks (AVAudioSession, AVCaptureSession) handle this automatically, but the low-level AudioUnit HAL that cpal uses does not always trigger the switch.

This module provides a best-effort activation hook that re-sets the default input device via CoreAudio, nudging macOS into establishing the SCO link. It is a no-op on non-macOS platforms.

Functions§

prepare_default_input
Attempt to activate the system default input device for audio capture.