FR: Disable Bluetooth HFP by default

On iOS there is a very noticeable drop in sound quality (to a sample rate of 8k or 16k) as soon as one connects a Bluetooth device which supports HFP (be it earphones or a speaker), if one uses the audio inputs and not just the outputs. It can easily be observed using the DemoRunner.

I think it’s a big problem because nowdays most bluetooth earphones and speakers have inputs and the audio will be downgraded if HFP audio input is enabled.

A solution was proposed here:

But the solution proposed there by @Logan_Thomas does not seem to work anymore.

What did work for me was to remove AVAudioSessionCategoryOptionAllowBluetooth in line 293 of juce_audio_devices/native/juce_ios_audio.cpp

This simple change allows one to use the internal microphone for audio input while audio output is done via Bluetooth, with no degradation in audio quality. If HFP is enabled, this is not possible as iOS “forces” one to use the bluetooth headset input.

Here is a more recent example of someone running into this issue:

I think it would make sense for Bluetooth HFP to be disabled by default, with a way to enable it when needed.