0

I want to analyze the audio stream data, although I know that AVAudioRecorder can record from bluetooth headset according to this answer but by AVAudioRecorder I cannot get the real time audio data.

I am using the SpeakHere to record which uses audio queue and set session category and property as that answer mentioned in the didFinishLaunchingWithOptions method, but it doesn't work. I would appreciate a lot if anyone give me some help.

Community
  • 1
  • 1
Leon
  • 11
  • 6

1 Answers1

1

I found the problem was that the settings can't be located in the didFinishLaunchingWithOptions method, it should be after the method AudioSessionInitialize called.

//Enable Bluetooth headset input
UInt32 allowBluetoothInput = 1;
OSStatus statBluetoothInput = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
                                                           sizeof (allowBluetoothInput),
                                                           &allowBluetoothInput);

//Enable Speaker output
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
OSStatus statSpeakerOutput = AudioSessionSetProperty (
                                                          kAudioSessionProperty_OverrideAudioRoute,
                                                          sizeof (audioRouteOverride),
                                                          &audioRouteOverride);
Leon
  • 11
  • 6