Is there a way to route the audio coming from the wired line-in input directly to AirPods?
Currently, I'm creating a .playAndRecord
audio session. Paired the AirPods. Later on, with AVAudioEngine
I connect the input device directly to the output device.
engine.connect(
engine.inputNode,
to: engine.outputNode,
format: engine.inputNode.inputFormat(forBus: 0)
)
Works nicely, I can hear the live (!) sound from the AirPods microphone directly in my ears. But then I connect the line-in cable, unfortunately, it overrides the output as well to the line-in (I can read the metering levels nicely, though). If I connect the AirPods, then again, both the input and the output change to AirPods.
Is there a way to reroute the output device to AirPods, but keep the input device unchanged?
UPDATE: I tried set the input port (to line-in) manually using
setPreferredInput
, but as soon as the input is selected, the output is also get adjusted (to the wired device).
UPDATE: I tried routing both with
AVRoutePickerView
andMPVolumeView
, but all yielded the same result. If I pick a new output, the input gets modified as well.
UPDATE: AudioBus app does this, I can set wired headphones as input, and AirPods as output, works like a charm. So it is definitely possible, I just have no idea what API to use. Actually, neither AudioBus can share the audio to two sets of AirPods.