Full duplex Bluetooth


#1

Using JUCE, I can only select bluetooth as an option from the MPVolumeView when the audio inputs are disabled. How do I get full duplex operation (I don’t mind if the sample rate drops to 8kHz).


#2

Fixed it. There is a small error in the juce iOS code. You need to set kAudioSessionProperty_OverrideCategoryEnableBluetoothInput after the kAudioSessionCategory_PlayAndRecord has been set, otherwise it will not register . .

        UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;

        if (numInputChannels > 0 && audioInputIsAvailable)
        {
            audioCategory = kAudioSessionCategory_PlayAndRecord;

//            UInt32 allowBluetoothInput = 1;
//            AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
//                                     sizeof (allowBluetoothInput), &allowBluetoothInput);
        }

        AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof (audioCategory), &audioCategory);
        
        if (numInputChannels > 0 && audioInputIsAvailable) 
        {            
            UInt32 allowBluetoothInput = 1;
            AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
                                     sizeof (allowBluetoothInput), &allowBluetoothInput);     
        }

#3

Ah! Thanks so much for spotting that! I’ll get it sorted out…


#4

The problem with this is that the deviceManager will not fire a change message when bluetooth is selected, and so I cannot see a way of getting a notification about the sample rate change.

One option is to fire off an audioDeviceError on routing change to stop the audio device, but this blows a bit.

Any suggestions? I see a similar thread talking about external rate changes in this section of the forum.