System Sound Services

Overview

System Sound Services provides a C interface for playing short sounds and for invoking vibration on iOS devices that support vibration.

You can use System Sound Services to play short (30 seconds or shorter) sounds. The interface does not provide level, positioning, looping, or timing control, and does not support simultaneous playback: You can play only one sound at a time. You can use System Sound Services to provide audible alerts. On some iOS devices, alerts can include vibration.

Topics

Creating and Disposing of System Sound Objects

AudioServicesCreateSystemSoundID

Creates a system sound object.

AudioServicesDisposeSystemSoundID

Disposes of a system sound object and associated resources.

Playing Sounds

AudioServicesPlayAlertSound

Plays a system sound as an alert.

AudioServicesPlaySystemSound

Plays a system sound object.

Adding and Removing System Sound Callbacks

AudioServicesAddSystemSoundCompletion

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

AudioServicesRemoveSystemSoundCompletion

Unregisters any completion callback functions that were registered for a specified system sound.

Managing System Sound Services Properties

AudioServicesGetPropertyInfo

Gets information about a System Sound Services property.

AudioServicesGetProperty

Gets a specified System Sound Services property value.

AudioServicesSetProperty

Sets the value for a specified System Sound Services property.

Callbacks

AudioServicesSystemSoundCompletionProc

Invoked when a system sound finishes playing.

Data Types

AudioServicesPropertyID

The data type for a system sound property identifier.

SystemSoundID

A system sound object, identified with a sound file you want to play.

Constants

Alert Sound Identifiers

Identifiers for alert sounds and alternatives to sounds, for use with the AudioServicesPlayAlertSound function.

System Sound Services Property Identifiers

Property identifiers used when playing alerts with System Sound Services.

Result Codes

This table lists the result codes defined for System Sound Services.

kAudioServicesNoError

No error has occurred.

kAudioServicesUnsupportedPropertyError

The property is not supported.

kAudioServicesBadPropertySizeError

The size of the property data was not correct.

kAudioServicesBadSpecifierSizeError

The size of the specifier data was not correct.

kAudioServicesSystemSoundUnspecifiedError

An unspecified error has occurred.

kAudioServicesSystemSoundClientTimedOutError

System sound client message timed out.