<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/AudioServicesAddSystemSoundCompletion(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@AudioServicesAddSystemSoundCompletion"
  },
  "title" : "AudioServicesAddSystemSoundCompletion(_:_:_:_:_:)"
}
-->

# AudioServicesAddSystemSoundCompletion(_:_:_:_:_:)

Registers a callback function that is invoked when a specified system sound finishes playing.

```
func AudioServicesAddSystemSoundCompletion(_ inSystemSoundID: SystemSoundID, _ inRunLoop: CFRunLoop?, _ inRunLoopMode: CFString?, _ inCompletionRoutine: AudioServicesSystemSoundCompletionProc, _ inClientData: UnsafeMutableRawPointer?) -> OSStatus
```

## Parameters

`inSystemSoundID`

The system sound that your callback function is to respond to.

`inRunLoop`

The run loop in which the callback function should run. Pass `NULL` to use the main run loop.

`inRunLoopMode`

The mode for the run loop in which the callback functions should run. Pass `NULL` to use the default run loop mode.

`inCompletionRoutine`

The callback function to be invoked when the specified system sound has finished playing.

`inClientData`

Application data to be passed to your callback function when it is invoked. Can be `NULL`.

## Return Value

A result code.

## Discussion

Because a system sound may play for several seconds, you might want to know when it has finished playing. For example, you may want to wait until a system sound has finished playing before you play another sound.

## See Also

[`AudioServicesCreateSystemSoundID`](/documentation/AudioToolbox/AudioServicesCreateSystemSoundID(_:_:))

Creates a system sound object.



---

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)