Structure

CHHapticEvent.ParameterID

An identifier that indicates the event parameter being defined.

Declaration

struct ParameterID

Overview

Use haptic parameter IDs in two ways:

  • Event parameters, specified as part of the initial event, determine the specific waveform used to generate the haptic or audio feedback.

  • Dynamic parameters, specified separately from the event, change the event's characteristics—such as intensity or sharpness—while it is in live playback.

The range for all parameters except haptic intensity is -1 to 1, where -1 represents decreasing the parameter, and 1 represents increasing the parameter. Haptic intensity changes multiplicatively, so specifying a dynamic parameter for hapticIntensityControl of 0.5 halves the pattern's intensity.

The parameter IDs that begin with CHHapticParameterIDHaptic... affect only haptic event types, while the parameter IDs that begin with CHHapticParameterIDAudio... affect only audio event types. Not all parameter types have an effect on every CHHapticEvent.EventType.

Topics

Haptic Event Parameter IDs

static let hapticIntensity: CHHapticEvent.ParameterID

The strength of a haptic event, from weak (0.0) to strong (1.0).

static let hapticSharpness: CHHapticEvent.ParameterID

The feel of a haptic event, along a spectrum from dull (0.0) to sharp (1.0).

static let attackTime: CHHapticEvent.ParameterID

The time at which a haptic pattern's intensity begins increasing.

static let decayTime: CHHapticEvent.ParameterID

The time at which a haptic pattern's intensity begins decreasing.

static let releaseTime: CHHapticEvent.ParameterID

The time at which to begin fading the haptic pattern.

static let sustained: CHHapticEvent.ParameterID

A Boolean that indicates whether to sustain a haptic event for its specified duration.

Audio Event Parameter IDs

static let audioBrightness: CHHapticEvent.ParameterID

The high-frequency content of an audio event.

static let audioVolume: CHHapticEvent.ParameterID

The volume or loudness of an audio event.

Swift Initializers

Relationships

See Also

Configuring Haptic Events

var eventParameters: [CHHapticEventParameter]

An array of event parameters, possibly empty.

var relativeTime: TimeInterval

The start time of the event, relative to other events in the same pattern.

var duration: TimeInterval

The duration of the haptic event.