<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioApplication/setInputMuteStateChangeHandler(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioApplication(im)setInputMuteStateChangeHandler:error:"
  },
  "title" : "setInputMuteStateChangeHandler(_:)"
}
-->

# setInputMuteStateChangeHandler(_:)

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

```
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

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`](/documentation/AVFAudio/AVAudioApplication/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 ``doc://com.apple.avfaudio/documentation/AVFAudio/AVAudioApplication/inputMuteStateChangeNotification``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)