setInputMuteStateChangeHandler(_:)
Sets a callback to handle changes to application-level audio muting states.
Declaration
func setInputMuteStateChangeHandler(_ inputMuteHandler: ((Bool) -> Bool)?) throwsParameters
- inputMuteHandler:
A callback that the system invokes when the input mute state changes. If the callback receives a True value, mute all input audio samples until the next time the system calls the handler. Return a value of True if you muted input successfully, or in exceptional cases, return False to indicate the mute action fails.
Discussion
Use this method to set a closure to handle your macOS app’s input muting logic. The system calls thie closure when the input mute state changes, either due to setting the isInputMuted state, or due to a Bluetooth audio accessory gesture (certain AirPods / Beats headphones) changing the mute state.
Since the input mute handling logic should happen a single place, subsequent calls to this method overwrite any previously registered block with the one you provide. You can specify a nil to cancel the callback.