I am trying to implement a feature in Objective-C where the use case requires the user to speak into a Hands-Free bluetooth headset and have their voice mix with an audio file and play both over the headphone jack.
I have the program working and will allow mixing of microphone and audio over the HFB, or using a wired microphone. But the audio always plays the same place as the microphone source. I cannot find a way to override only audio output to the headphone jack.
I used the following code, which I found in the documentation to override output to the speaker, but I cannot find one to force audio to the headphone jack:
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
Another problem with the above line of code is that it overrides input and output to the built in speaker and built in microphone.
Back to my use case - I need to use hands free bluetooth to voice over audio going out of the headphone jack. Any ideas how this can be implemented?