1

I am writing a VoIP app that uses AudioUnit for it's audio related tasks. Here, a lot of properties of AudioUnit and AudioSession are being set from a lot of places using the following two method

AudioComponentInstance audioUnit;
AudioComponent inputComponent;
AudioComponentDescription audioComponentDescription;
AudioStreamBasicDescription audioStreamBasicDescription;

AudioUnitSetProperty(audioUnit,
                     kAudioUnitProperty_StreamFormat,
                     kAudioUnitScope_Input,
                     kOutputBus,
                     &audioStreamBasicDescription,
                     sizeof(audioStreamBasicDescription));

AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, 
                        sizeof(allowBluetoothInput),
                        &allowBluetoothInput);

But at some point i want to clear all of my AudioUnit and AudioSession properties. And want to bring back all default settings. But i couldn't figure out how to do that. I tried with the following codes but none of those could do what i wanted.

AudioComponentInstance audioUnit;
AudioOutputUnitStop(audioUnit);

[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

AudioUnitUninitialize(audioUnit);

Can anyone help me in this purpose ? Any code example would be very much helpful and appreciated. Solutions need to be from iOS 7 to upper.

Partho Biswas
  • 2,290
  • 1
  • 24
  • 39

0 Answers0