AVAudioEngine Stop Method

Hi all!

I have been experiencing some issues when using the AVAudioEngine to play audio and record input while doing a voice chat (through the PTT Interface).

I noticed if I connect any players to the AudioGraph OR call start that the audio session becomes active (this is on iOS).

I don't see anything in the docs or the header files in the AVFoundation, but is it possible that calling the stop method on an engine deactivates the audio session too?

In a normal app this behavior seems logical, but when using PTT all activation and deactivation of the audio session must go through the framework and its delegate methods.

The issue I am debugging is that when the engine with the input node tapped gets stopped, and there is a gap between the input and when the server replies with inbound audio to be played and something seems to be getting the hardware/audio session into a jammed state.

Thanks for any feedback and/or confirmation on this behavior!

Hello @draff27, thank you for your post. What is the reason for stopping the engine? And how long is the gap?

Hello @draff27, thank you for your response. It's not clear to me why it would be necessary to use two audio engines, could you point me to the documentation you mentioned?

More generally, it might not be necessary to stop the engine if the network fluctuates. If you don't stop it, is there a gap still?

In a normal app this behavior seems logical, but when using PTT all activation and deactivation of the audio session must go through the framework and its delegate methods.

Are you waiting for channelManager(_:didActivate:) before staring your engine?

AVAudioEngine Stop Method
 
 
Q