---
title: "setInputMuteStateChangeHandler(_:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudioapplication/setinputmutestatechangehandler(_:)"
---

# setInputMuteStateChangeHandler(_:)

Sets a callback to handle changes to application-level audio muting states.

## Declaration

```swift
func setInputMuteStateChangeHandler(_ inputMuteHandler: ((Bool) -> Bool)?) throws
```

## Parameters

- `inputMuteHandler`: A callback that the system invokes when the input mute state changes. If the callback receives a doc://com.apple.documentation/documentation/Swift/true value, mute all input audio samples until the next time the system calls the handler. Return a value of doc://com.apple.documentation/documentation/Swift/true if you muted input successfully, or in exceptional cases, return doc://com.apple.documentation/documentation/Swift/false to indicate the mute action fails.

## Discussion

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. note: This method is available in macOS only. On other platforms, the system handles muting logic internally. Perform your input muting logic within this closure, and perform your user interface updates within the handler for inputMuteStateChangeNotification.

## See Also

### Managing audio input mute state

- [isInputMuted](avfaudio/avaudioapplication/isinputmuted.md)
- [setInputMuted(_:)](avfaudio/avaudioapplication/setinputmuted(_:).md)
- [inputMuteStateChangeNotification](avfaudio/avaudioapplication/inputmutestatechangenotification.md)
