I am unable to record Bluetooth using streaming audio (AudioQueues).
I have a test "AVAudioRecorder" project where I successfully record voice using my Bluetooth microphone. Snippet follows:
AVAudioRecorder* avRecorder;
NSError* sessionError = nil;
BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP error:&sessionError];
if (success) {
NSLog(@"The audio session category is set");
} else {
NSLog(@"The audio session category error is %@", sessionError.description);
}
[snipped for brevity]
// Start the audio session
[[AVAudioSession sharedInstance] setActive:YES error:nil];
[self.avRecorder prepareToRecord];
[self.avRecorder record];
PROBLEM:
Using the same AVAudioSession setup, when I replace AVAudioRecorder with my streaming audio recorder (AudioQueues) I get no input from my Bluetooth microphone. I know this because I stick my iPhone in the drawer and can barely hear the recording when I play it back. 🙂
Apparently the iPhone is still using the built-in microphone instead of Bluetooth when streaming input.
When I query the AVAudioSession object and look at AVAudioSessionPortDescriptions and AVAudioSessionDataSourceDescriptions it looks as if Bluetooth is available and set. But I feel as if I am missing something which I cannot quite pin down.
Can anyone shed some light as to how to use a Bluetooth microphone with streaming audio input?
Thanks,
Allen