Static AVAudioEngineConfigurationChangeNotification

Source
pub unsafe static AVAudioEngineConfigurationChangeNotification: &'static NSString
Available on crate feature AVAudioEngine only.
Expand description

A notification generated on engine configuration changes when rendering to/from an audio device.

Register for this notification on your engine instances, as follows:

[[NSNotificationCenter defaultCenter] addObserver: myObject
selector:
sel!(handleInterruption:)
name:        AVAudioEngineConfigurationChangeNotification
object:      engine];

When the engine’s I/O unit observes a change to the audio input or output hardware’s channel count or sample rate, the engine stops itself (see AVAudioEngine(stop)), and issues this notification. The nodes remain attached and connected with previously set formats. However, the app must reestablish connections if the connection formats need to change (e.g. in an input node chain, connections must follow the hardware sample rate, while in an output only chain, the output node supports rate conversion).

Note that the engine must not be deallocated from within the client’s notification handler because the callback happens on an internal dispatch queue and can deadlock while trying to synchronously teardown the engine.

See also Apple’s documentation