corehaptics

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package corehaptics provides a fluent Go API over the macOS CoreHaptics framework.

Construction

New… functions create objects; each With… method sets one property and returns its receiver, so configuration calls chain. A <Type>FromID constructor adopts an Objective-C object obtained elsewhere.

Lifecycle

A wrapper releases its Objective-C object automatically once the garbage collector finds it unreachable. Call Release to relinquish the reference deterministically (for objects holding scarce resources); Release is idempotent, and afterwards the wrapper's methods are no-ops returning zero values.

Errors

Failing calls return errors carrying the Objective-C error domain and code. Match them against this package's Err… sentinel values with errors.Is, or inspect domain, code, and Apple's prose via errors.As with *errkit.Error.

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeBadEventEntry = errkit.New("CHHapticErrorDomain", -4830)

ErrCodeBadEventEntry matches the CoreHaptics error CHHapticErrorCodeBadEventEntry.

View Source
var ErrCodeBadParameterEntry = errkit.New("CHHapticErrorDomain", -4831)

ErrCodeBadParameterEntry matches the CoreHaptics error CHHapticErrorCodeBadParameterEntry.

View Source
var ErrCodeEngineNotRunning = errkit.New("CHHapticErrorDomain", -4805)

ErrCodeEngineNotRunning matches the CoreHaptics error CHHapticErrorCodeEngineNotRunning.

View Source
var ErrCodeEngineStartTimeout = errkit.New("CHHapticErrorDomain", -4808)

ErrCodeEngineStartTimeout matches the CoreHaptics error CHHapticErrorCodeEngineStartTimeout.

View Source
var ErrCodeFileNotFound = errkit.New("CHHapticErrorDomain", -4851)

ErrCodeFileNotFound matches the CoreHaptics error CHHapticErrorCodeFileNotFound.

View Source
var ErrCodeInsufficientPower = errkit.New("CHHapticErrorDomain", -4897)

ErrCodeInsufficientPower matches the CoreHaptics error CHHapticErrorCodeInsufficientPower.

View Source
var ErrCodeInvalidAudioResource = errkit.New("CHHapticErrorDomain", -4824)

ErrCodeInvalidAudioResource matches the CoreHaptics error CHHapticErrorCodeInvalidAudioResource.

View Source
var ErrCodeInvalidAudioSession = errkit.New("CHHapticErrorDomain", -4815)

ErrCodeInvalidAudioSession matches the CoreHaptics error CHHapticErrorCodeInvalidAudioSession.

View Source
var ErrCodeInvalidEngineParameter = errkit.New("CHHapticErrorDomain", -4816)

ErrCodeInvalidEngineParameter matches the CoreHaptics error CHHapticErrorCodeInvalidEngineParameter.

View Source
var ErrCodeInvalidEventDuration = errkit.New("CHHapticErrorDomain", -4823)

ErrCodeInvalidEventDuration matches the CoreHaptics error CHHapticErrorCodeInvalidEventDuration.

View Source
var ErrCodeInvalidEventTime = errkit.New("CHHapticErrorDomain", -4822)

ErrCodeInvalidEventTime matches the CoreHaptics error CHHapticErrorCodeInvalidEventTime.

View Source
var ErrCodeInvalidEventType = errkit.New("CHHapticErrorDomain", -4821)

ErrCodeInvalidEventType matches the CoreHaptics error CHHapticErrorCodeInvalidEventType.

View Source
var ErrCodeInvalidParameterType = errkit.New("CHHapticErrorDomain", -4820)

ErrCodeInvalidParameterType matches the CoreHaptics error CHHapticErrorCodeInvalidParameterType.

View Source
var ErrCodeInvalidPatternData = errkit.New("CHHapticErrorDomain", -4813)

ErrCodeInvalidPatternData matches the CoreHaptics error CHHapticErrorCodeInvalidPatternData.

View Source
var ErrCodeInvalidPatternDictionary = errkit.New("CHHapticErrorDomain", -4814)

ErrCodeInvalidPatternDictionary matches the CoreHaptics error CHHapticErrorCodeInvalidPatternDictionary.

View Source
var ErrCodeInvalidPatternPlayer = errkit.New("CHHapticErrorDomain", -4812)

ErrCodeInvalidPatternPlayer matches the CoreHaptics error CHHapticErrorCodeInvalidPatternPlayer.

View Source
var ErrCodeInvalidTime = errkit.New("CHHapticErrorDomain", -4840)

ErrCodeInvalidTime matches the CoreHaptics error CHHapticErrorCodeInvalidTime.

View Source
var ErrCodeMemoryError = errkit.New("CHHapticErrorDomain", -4899)

ErrCodeMemoryError matches the CoreHaptics error CHHapticErrorCodeMemoryError.

View Source
var ErrCodeNotSupported = errkit.New("CHHapticErrorDomain", -4809)

ErrCodeNotSupported matches the CoreHaptics error CHHapticErrorCodeNotSupported.

View Source
var ErrCodeOperationNotPermitted = errkit.New("CHHapticErrorDomain", -4806)

ErrCodeOperationNotPermitted matches the CoreHaptics error CHHapticErrorCodeOperationNotPermitted.

View Source
var ErrCodeResourceNotAvailable = errkit.New("CHHapticErrorDomain", -4825)

ErrCodeResourceNotAvailable matches the CoreHaptics error CHHapticErrorCodeResourceNotAvailable.

View Source
var ErrCodeServerInitFailed = errkit.New("CHHapticErrorDomain", -4810)

ErrCodeServerInitFailed matches the CoreHaptics error CHHapticErrorCodeServerInitFailed.

View Source
var ErrCodeServerInterrupted = errkit.New("CHHapticErrorDomain", -4811)

ErrCodeServerInterrupted matches the CoreHaptics error CHHapticErrorCodeServerInterrupted.

View Source
var ErrCodeUnknownError = errkit.New("CHHapticErrorDomain", -4898)

ErrCodeUnknownError matches the CoreHaptics error CHHapticErrorCodeUnknownError.

Functions

func CHHapticAudioResourceKeyLoopEnabled

func CHHapticAudioResourceKeyLoopEnabled() obj.Object

CHHapticAudioResourceKeyLoopEnabled returns the string constant CHHapticAudioResourceKeyLoopEnabled, for use as a dictionary key or argument.

func CHHapticAudioResourceKeyUseVolumeEnvelope

func CHHapticAudioResourceKeyUseVolumeEnvelope() obj.Object

CHHapticAudioResourceKeyUseVolumeEnvelope returns the string constant CHHapticAudioResourceKeyUseVolumeEnvelope, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioAttackTimeControl

func CHHapticDynamicParameterIDAudioAttackTimeControl() obj.Object

CHHapticDynamicParameterIDAudioAttackTimeControl returns the string constant CHHapticDynamicParameterIDAudioAttackTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioBrightnessControl

func CHHapticDynamicParameterIDAudioBrightnessControl() obj.Object

CHHapticDynamicParameterIDAudioBrightnessControl returns the string constant CHHapticDynamicParameterIDAudioBrightnessControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioDecayTimeControl

func CHHapticDynamicParameterIDAudioDecayTimeControl() obj.Object

CHHapticDynamicParameterIDAudioDecayTimeControl returns the string constant CHHapticDynamicParameterIDAudioDecayTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioPanControl

func CHHapticDynamicParameterIDAudioPanControl() obj.Object

CHHapticDynamicParameterIDAudioPanControl returns the string constant CHHapticDynamicParameterIDAudioPanControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioPitchControl

func CHHapticDynamicParameterIDAudioPitchControl() obj.Object

CHHapticDynamicParameterIDAudioPitchControl returns the string constant CHHapticDynamicParameterIDAudioPitchControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioReleaseTimeControl

func CHHapticDynamicParameterIDAudioReleaseTimeControl() obj.Object

CHHapticDynamicParameterIDAudioReleaseTimeControl returns the string constant CHHapticDynamicParameterIDAudioReleaseTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDAudioVolumeControl

func CHHapticDynamicParameterIDAudioVolumeControl() obj.Object

CHHapticDynamicParameterIDAudioVolumeControl returns the string constant CHHapticDynamicParameterIDAudioVolumeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDHapticAttackTimeControl

func CHHapticDynamicParameterIDHapticAttackTimeControl() obj.Object

CHHapticDynamicParameterIDHapticAttackTimeControl returns the string constant CHHapticDynamicParameterIDHapticAttackTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDHapticDecayTimeControl

func CHHapticDynamicParameterIDHapticDecayTimeControl() obj.Object

CHHapticDynamicParameterIDHapticDecayTimeControl returns the string constant CHHapticDynamicParameterIDHapticDecayTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDHapticIntensityControl

func CHHapticDynamicParameterIDHapticIntensityControl() obj.Object

CHHapticDynamicParameterIDHapticIntensityControl returns the string constant CHHapticDynamicParameterIDHapticIntensityControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDHapticReleaseTimeControl

func CHHapticDynamicParameterIDHapticReleaseTimeControl() obj.Object

CHHapticDynamicParameterIDHapticReleaseTimeControl returns the string constant CHHapticDynamicParameterIDHapticReleaseTimeControl, for use as a dictionary key or argument.

func CHHapticDynamicParameterIDHapticSharpnessControl

func CHHapticDynamicParameterIDHapticSharpnessControl() obj.Object

CHHapticDynamicParameterIDHapticSharpnessControl returns the string constant CHHapticDynamicParameterIDHapticSharpnessControl, for use as a dictionary key or argument.

func CHHapticEventParameterIDAttackTime

func CHHapticEventParameterIDAttackTime() obj.Object

CHHapticEventParameterIDAttackTime returns the string constant CHHapticEventParameterIDAttackTime, for use as a dictionary key or argument.

func CHHapticEventParameterIDAudioBrightness

func CHHapticEventParameterIDAudioBrightness() obj.Object

CHHapticEventParameterIDAudioBrightness returns the string constant CHHapticEventParameterIDAudioBrightness, for use as a dictionary key or argument.

func CHHapticEventParameterIDAudioPan

func CHHapticEventParameterIDAudioPan() obj.Object

CHHapticEventParameterIDAudioPan returns the string constant CHHapticEventParameterIDAudioPan, for use as a dictionary key or argument.

func CHHapticEventParameterIDAudioPitch

func CHHapticEventParameterIDAudioPitch() obj.Object

CHHapticEventParameterIDAudioPitch returns the string constant CHHapticEventParameterIDAudioPitch, for use as a dictionary key or argument.

func CHHapticEventParameterIDAudioVolume

func CHHapticEventParameterIDAudioVolume() obj.Object

CHHapticEventParameterIDAudioVolume returns the string constant CHHapticEventParameterIDAudioVolume, for use as a dictionary key or argument.

func CHHapticEventParameterIDDecayTime

func CHHapticEventParameterIDDecayTime() obj.Object

CHHapticEventParameterIDDecayTime returns the string constant CHHapticEventParameterIDDecayTime, for use as a dictionary key or argument.

func CHHapticEventParameterIDHapticIntensity

func CHHapticEventParameterIDHapticIntensity() obj.Object

CHHapticEventParameterIDHapticIntensity returns the string constant CHHapticEventParameterIDHapticIntensity, for use as a dictionary key or argument.

func CHHapticEventParameterIDHapticSharpness

func CHHapticEventParameterIDHapticSharpness() obj.Object

CHHapticEventParameterIDHapticSharpness returns the string constant CHHapticEventParameterIDHapticSharpness, for use as a dictionary key or argument.

func CHHapticEventParameterIDReleaseTime

func CHHapticEventParameterIDReleaseTime() obj.Object

CHHapticEventParameterIDReleaseTime returns the string constant CHHapticEventParameterIDReleaseTime, for use as a dictionary key or argument.

func CHHapticEventParameterIDSustained

func CHHapticEventParameterIDSustained() obj.Object

CHHapticEventParameterIDSustained returns the string constant CHHapticEventParameterIDSustained, for use as a dictionary key or argument.

func CHHapticEventTypeAudioContinuous

func CHHapticEventTypeAudioContinuous() obj.Object

CHHapticEventTypeAudioContinuous returns the string constant CHHapticEventTypeAudioContinuous, for use as a dictionary key or argument.

func CHHapticEventTypeAudioCustom

func CHHapticEventTypeAudioCustom() obj.Object

CHHapticEventTypeAudioCustom returns the string constant CHHapticEventTypeAudioCustom, for use as a dictionary key or argument.

func CHHapticEventTypeHapticContinuous

func CHHapticEventTypeHapticContinuous() obj.Object

CHHapticEventTypeHapticContinuous returns the string constant CHHapticEventTypeHapticContinuous, for use as a dictionary key or argument.

func CHHapticEventTypeHapticTransient

func CHHapticEventTypeHapticTransient() obj.Object

CHHapticEventTypeHapticTransient returns the string constant CHHapticEventTypeHapticTransient, for use as a dictionary key or argument.

func CHHapticPatternKeyEvent

func CHHapticPatternKeyEvent() obj.Object

CHHapticPatternKeyEvent returns the string constant CHHapticPatternKeyEvent, for use as a dictionary key or argument.

func CHHapticPatternKeyEventDuration

func CHHapticPatternKeyEventDuration() obj.Object

CHHapticPatternKeyEventDuration returns the string constant CHHapticPatternKeyEventDuration, for use as a dictionary key or argument.

func CHHapticPatternKeyEventParameters

func CHHapticPatternKeyEventParameters() obj.Object

CHHapticPatternKeyEventParameters returns the string constant CHHapticPatternKeyEventParameters, for use as a dictionary key or argument.

func CHHapticPatternKeyEventType

func CHHapticPatternKeyEventType() obj.Object

CHHapticPatternKeyEventType returns the string constant CHHapticPatternKeyEventType, for use as a dictionary key or argument.

func CHHapticPatternKeyEventWaveformLoopEnabled

func CHHapticPatternKeyEventWaveformLoopEnabled() obj.Object

CHHapticPatternKeyEventWaveformLoopEnabled returns the string constant CHHapticPatternKeyEventWaveformLoopEnabled, for use as a dictionary key or argument.

func CHHapticPatternKeyEventWaveformPath

func CHHapticPatternKeyEventWaveformPath() obj.Object

CHHapticPatternKeyEventWaveformPath returns the string constant CHHapticPatternKeyEventWaveformPath, for use as a dictionary key or argument.

func CHHapticPatternKeyEventWaveformUseVolumeEnvelope

func CHHapticPatternKeyEventWaveformUseVolumeEnvelope() obj.Object

CHHapticPatternKeyEventWaveformUseVolumeEnvelope returns the string constant CHHapticPatternKeyEventWaveformUseVolumeEnvelope, for use as a dictionary key or argument.

func CHHapticPatternKeyParameter

func CHHapticPatternKeyParameter() obj.Object

CHHapticPatternKeyParameter returns the string constant CHHapticPatternKeyParameter, for use as a dictionary key or argument.

func CHHapticPatternKeyParameterCurve

func CHHapticPatternKeyParameterCurve() obj.Object

CHHapticPatternKeyParameterCurve returns the string constant CHHapticPatternKeyParameterCurve, for use as a dictionary key or argument.

func CHHapticPatternKeyParameterCurveControlPoints

func CHHapticPatternKeyParameterCurveControlPoints() obj.Object

CHHapticPatternKeyParameterCurveControlPoints returns the string constant CHHapticPatternKeyParameterCurveControlPoints, for use as a dictionary key or argument.

func CHHapticPatternKeyParameterID

func CHHapticPatternKeyParameterID() obj.Object

CHHapticPatternKeyParameterID returns the string constant CHHapticPatternKeyParameterID, for use as a dictionary key or argument.

func CHHapticPatternKeyParameterValue

func CHHapticPatternKeyParameterValue() obj.Object

CHHapticPatternKeyParameterValue returns the string constant CHHapticPatternKeyParameterValue, for use as a dictionary key or argument.

func CHHapticPatternKeyPattern

func CHHapticPatternKeyPattern() obj.Object

CHHapticPatternKeyPattern returns the string constant CHHapticPatternKeyPattern, for use as a dictionary key or argument.

func CHHapticPatternKeyTime

func CHHapticPatternKeyTime() obj.Object

CHHapticPatternKeyTime returns the string constant CHHapticPatternKeyTime, for use as a dictionary key or argument.

func CHHapticPatternKeyVersion

func CHHapticPatternKeyVersion() obj.Object

CHHapticPatternKeyVersion returns the string constant CHHapticPatternKeyVersion, for use as a dictionary key or argument.

Types

type HapticAdvancedPatternPlayer added in v0.17.0

type HapticAdvancedPatternPlayer interface {
	PauseAtTimeError(time_ float64) bool
	ResumeAtTimeError(time_ float64) bool
	SeekToOffsetError(offsetTime float64) bool
	LoopEnabled() bool
	SetLoopEnabled(loopEnabled bool)
	LoopEnd() float64
	SetLoopEnd(loopEnd float64)
	PlaybackRate() float32
	SetPlaybackRate(playbackRate float32)
	IsMuted() bool
	SetIsMuted(isMuted bool)
	CompletionHandler() obj.Object
	SetCompletionHandler(completionHandler func(unsafe.Pointer))
}

HapticAdvancedPatternPlayer is the Go form of the Objective-C protocol CHHapticAdvancedPatternPlayer.

type HapticDeviceCapability added in v0.17.0

type HapticDeviceCapability interface {
}

HapticDeviceCapability is the Go form of the Objective-C protocol CHHapticDeviceCapability.

type HapticDynamicParameter added in v0.17.0

type HapticDynamicParameter struct {
	objref.Handle
}

HapticDynamicParameter is an idiomatic wrapper over the Objective-C class CHHapticDynamicParameter.

A value that you send to a haptic pattern player to alter a property value during playback.

func HapticDynamicParameterFromID added in v0.17.0

func HapticDynamicParameterFromID(id objc.ID) *HapticDynamicParameter

HapticDynamicParameterFromID adopts an existing Objective-C object as a HapticDynamicParameter (nil for 0), retaining it and registering a release finalizer.

func NewHapticDynamicParameterWithParameterIDValueRelativeTime added in v0.17.0

func NewHapticDynamicParameterWithParameterIDValueRelativeTime(parameterID obj.Object, value float32, time_ float64) *HapticDynamicParameter

NewHapticDynamicParameterWithParameterIDValueRelativeTime creates a dynamic parameter from its ID, value, and start time.

func (*HapticDynamicParameter) Description added in v0.17.0

func (hdp *HapticDynamicParameter) Description() string

Description returns the object's -description text.

func (*HapticDynamicParameter) IsEqual added in v0.17.0

func (hdp *HapticDynamicParameter) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticDynamicParameter) IsKind added in v0.17.0

func (hdp *HapticDynamicParameter) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticDynamicParameter) ParameterID added in v0.17.0

func (hdp *HapticDynamicParameter) ParameterID() *foundation.String

ParameterID returns the parameter ID.

func (*HapticDynamicParameter) RelativeTime added in v0.17.0

func (hdp *HapticDynamicParameter) RelativeTime() float64

RelativeTime returns the relative time.

func (*HapticDynamicParameter) String added in v0.17.0

func (hdp *HapticDynamicParameter) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticDynamicParameter) Value added in v0.17.0

func (hdp *HapticDynamicParameter) Value() float32

Value returns the value.

func (*HapticDynamicParameter) WithRelativeTime added in v0.17.0

func (hdp *HapticDynamicParameter) WithRelativeTime(relativeTime float64) *HapticDynamicParameter

WithRelativeTime sets the time at which this dynamic parameter is applied, relative to the start time of the pattern.

func (*HapticDynamicParameter) WithValue added in v0.17.0

func (hdp *HapticDynamicParameter) WithValue(value float32) *HapticDynamicParameter

WithValue sets the value of the dynamic parameter.

type HapticEngine added in v0.17.0

type HapticEngine struct {
	objref.Handle
}

HapticEngine is an idiomatic wrapper over the Objective-C class CHHapticEngine.

An object that represents the connection to the haptic server.

func HapticEngineFromID added in v0.17.0

func HapticEngineFromID(id objc.ID) *HapticEngine

HapticEngineFromID adopts an existing Objective-C object as a HapticEngine (nil for 0), retaining it and registering a release finalizer.

func NewHapticEngine added in v0.17.0

func NewHapticEngine() *HapticEngine

NewHapticEngine creates a new HapticEngine.

func NewHapticEngineWithAudioSession added in v0.17.0

func NewHapticEngineWithAudioSession(audioSession obj.Object) (result *HapticEngine, err error)

NewHapticEngineWithAudioSession creates a haptic engine from an audio session.

func (*HapticEngine) CurrentTime added in v0.17.0

func (he *HapticEngine) CurrentTime() float64

CurrentTime returns the current time.

func (*HapticEngine) Description added in v0.17.0

func (he *HapticEngine) Description() string

Description returns the object's -description text.

func (*HapticEngine) IsAutoShutdownEnabled added in v0.17.0

func (he *HapticEngine) IsAutoShutdownEnabled() bool

IsAutoShutdownEnabled reports whether when auto shutdown is enabled, the haptic engine can start and stop the hardware dynamically, to conserve power. To conserve power, it is advised that the client stop the haptic engine when not in use. But when auto shutdown is enabled, the haptic engine will stop the hardware if it was running idle for a certain duration, and restart it later when required. Note that, because this operation is dynamic, it may affect the start times of the pattern players (e.g. `CHHapticPatternplayer`), if the engine has to resume from its shutdown state. This feature is disabled by default, but the client can enable it if needed.

func (*HapticEngine) IsEqual added in v0.17.0

func (he *HapticEngine) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticEngine) IsKind added in v0.17.0

func (he *HapticEngine) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticEngine) IsMutedForAudio added in v0.17.0

func (he *HapticEngine) IsMutedForAudio() bool

IsMutedForAudio reports whether default is false.

func (*HapticEngine) IsMutedForHaptics added in v0.17.0

func (he *HapticEngine) IsMutedForHaptics() bool

IsMutedForHaptics reports whether default is false.

func (*HapticEngine) NotifyWhenPlayersFinished added in v0.18.0

func (he *HapticEngine) NotifyWhenPlayersFinished(finishedHandler func(unsafe.Pointer) int)

NotifyWhenPlayersFinished notifies you when all haptic pattern players have finished playing their haptic patterns.

func (*HapticEngine) PlayPatternFromData added in v0.17.0

func (he *HapticEngine) PlayPatternFromData(data []byte) error

PlayPatternFromData plays a pattern from the specified data.

func (*HapticEngine) PlayPatternFromURL added in v0.17.0

func (he *HapticEngine) PlayPatternFromURL(fileURL string) error

PlayPatternFromURL plays a pattern that’s defined in a file at the specified URL.

func (*HapticEngine) PlaysAudioOnly added in v0.17.0

func (he *HapticEngine) PlaysAudioOnly() bool

PlaysAudioOnly reports whether this behavior change will only take effect after the engine is stopped and restarted. The default is false.

func (*HapticEngine) PlaysHapticsOnly added in v0.17.0

func (he *HapticEngine) PlaysHapticsOnly() bool

PlaysHapticsOnly reports whether this behavior change will only take effect after the engine is stopped and restarted. The default is false.

func (*HapticEngine) RegisterAudioResourceOptions added in v0.17.0

func (he *HapticEngine) RegisterAudioResourceOptions(resourceURL string, options obj.Object) (result int, err error)

RegisterAudioResourceOptions registers an external audio to use as a custom waveform.

func (*HapticEngine) StartAndReturnError added in v0.17.0

func (he *HapticEngine) StartAndReturnError() error

StartAndReturnError synchronously starts the haptic engine.

StartAndReturnError returns an error if the operation did not succeed.

func (*HapticEngine) StartWithCompletionHandler added in v0.18.0

func (he *HapticEngine) StartWithCompletionHandler(completionHandler func(unsafe.Pointer))

StartWithCompletionHandler asynchronously starts the haptic engine.

func (*HapticEngine) StopWithCompletionHandler added in v0.18.0

func (he *HapticEngine) StopWithCompletionHandler(completionHandler func(unsafe.Pointer))

StopWithCompletionHandler asynchronously stops the haptic engine and executes the completion handler once the engine has stopped.

func (*HapticEngine) String added in v0.17.0

func (he *HapticEngine) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticEngine) UnregisterAudioResource added in v0.17.0

func (he *HapticEngine) UnregisterAudioResource(resourceID int) error

UnregisterAudioResource unregisters an external audio file that you previously registered with the engine.

func (*HapticEngine) WithAutoShutdownEnabled added in v0.17.0

func (he *HapticEngine) WithAutoShutdownEnabled(autoShutdownEnabled bool) *HapticEngine

WithAutoShutdownEnabled sets a Boolean value that indicates whether the haptic engine starts and stops automatically on request from one of its pattern players, or when idle.

func (*HapticEngine) WithIsMutedForAudio added in v0.17.0

func (he *HapticEngine) WithIsMutedForAudio(isMutedForAudio bool) *HapticEngine

WithIsMutedForAudio sets a Boolean value that indicates whether the engine mutes audio.

func (*HapticEngine) WithIsMutedForHaptics added in v0.17.0

func (he *HapticEngine) WithIsMutedForHaptics(isMutedForHaptics bool) *HapticEngine

WithIsMutedForHaptics sets a Boolean value that indicates whether the engine mutes haptics.

func (*HapticEngine) WithPlaysAudioOnly added in v0.17.0

func (he *HapticEngine) WithPlaysAudioOnly(playsAudioOnly bool) *HapticEngine

WithPlaysAudioOnly sets a Boolean value that indicates whether the engine ignores haptic events and plays audio events only.

func (*HapticEngine) WithPlaysHapticsOnly added in v0.17.0

func (he *HapticEngine) WithPlaysHapticsOnly(playsHapticsOnly bool) *HapticEngine

WithPlaysHapticsOnly sets a Boolean value that indicates whether the engine ignores audio events.

func (*HapticEngine) WithResetHandler added in v0.17.0

func (he *HapticEngine) WithResetHandler(resetHandler func()) *HapticEngine

WithResetHandler sets a block that the haptic engine calls after recovering from a haptic server error.

func (*HapticEngine) WithStoppedHandler added in v0.18.0

func (he *HapticEngine) WithStoppedHandler(stoppedHandler func(HapticEngineStoppedReason)) *HapticEngine

WithStoppedHandler sets a closure the haptic engine calls when it stops due to external causes.

type HapticEngineFinishedAction added in v0.17.0

type HapticEngineFinishedAction int64

Possible actions to take after the haptic engine finishes execution.

const (
	HapticEngineFinishedActionStopEngine         HapticEngineFinishedAction = 1
	HapticEngineFinishedActionLeaveEngineRunning HapticEngineFinishedAction = 2
)

func (HapticEngineFinishedAction) String added in v0.17.0

String returns the HapticEngineFinishedAction constant's name, or its numeric form when the value is not a known constant.

type HapticEngineStoppedReason added in v0.17.0

type HapticEngineStoppedReason int64

The enumeration of reasons the haptic engine stopped running.

const (
	HapticEngineStoppedReasonAudioSessionInterrupt    HapticEngineStoppedReason = 1
	HapticEngineStoppedReasonApplicationSuspended     HapticEngineStoppedReason = 2
	HapticEngineStoppedReasonIdleTimeout              HapticEngineStoppedReason = 3
	HapticEngineStoppedReasonNotifyWhenFinished       HapticEngineStoppedReason = 4
	HapticEngineStoppedReasonEngineDestroyed          HapticEngineStoppedReason = 5
	HapticEngineStoppedReasonGameControllerDisconnect HapticEngineStoppedReason = 6
	HapticEngineStoppedReasonSystemError              HapticEngineStoppedReason = -1
)

func (HapticEngineStoppedReason) String added in v0.17.0

func (e HapticEngineStoppedReason) String() string

String returns the HapticEngineStoppedReason constant's name, or its numeric form when the value is not a known constant.

type HapticErrorCode added in v0.17.0

type HapticErrorCode int64

Error codes for framework operations.

const (
	HapticErrorCodeEngineNotRunning         HapticErrorCode = -4805
	HapticErrorCodeOperationNotPermitted    HapticErrorCode = -4806
	HapticErrorCodeEngineStartTimeout       HapticErrorCode = -4808
	HapticErrorCodeNotSupported             HapticErrorCode = -4809
	HapticErrorCodeServerInitFailed         HapticErrorCode = -4810
	HapticErrorCodeServerInterrupted        HapticErrorCode = -4811
	HapticErrorCodeInvalidPatternPlayer     HapticErrorCode = -4812
	HapticErrorCodeInvalidPatternData       HapticErrorCode = -4813
	HapticErrorCodeInvalidPatternDictionary HapticErrorCode = -4814
	HapticErrorCodeInvalidAudioSession      HapticErrorCode = -4815
	HapticErrorCodeInvalidEngineParameter   HapticErrorCode = -4816
	HapticErrorCodeInvalidParameterType     HapticErrorCode = -4820
	HapticErrorCodeInvalidEventType         HapticErrorCode = -4821
	HapticErrorCodeInvalidEventTime         HapticErrorCode = -4822
	HapticErrorCodeInvalidEventDuration     HapticErrorCode = -4823
	HapticErrorCodeInvalidAudioResource     HapticErrorCode = -4824
	HapticErrorCodeResourceNotAvailable     HapticErrorCode = -4825
	HapticErrorCodeBadEventEntry            HapticErrorCode = -4830
	HapticErrorCodeBadParameterEntry        HapticErrorCode = -4831
	HapticErrorCodeInvalidTime              HapticErrorCode = -4840
	HapticErrorCodeFileNotFound             HapticErrorCode = -4851
	HapticErrorCodeInsufficientPower        HapticErrorCode = -4897
	HapticErrorCodeUnknownError             HapticErrorCode = -4898
	HapticErrorCodeMemoryError              HapticErrorCode = -4899
)

func (HapticErrorCode) String added in v0.17.0

func (e HapticErrorCode) String() string

String returns the HapticErrorCode constant's name, or its numeric form when the value is not a known constant.

type HapticEvent added in v0.17.0

type HapticEvent struct {
	objref.Handle
}

HapticEvent is an idiomatic wrapper over the Objective-C class CHHapticEvent.

An object that describes a single haptic or audio event.

func HapticEventFromID added in v0.17.0

func HapticEventFromID(id objc.ID) *HapticEvent

HapticEventFromID adopts an existing Objective-C object as a HapticEvent (nil for 0), retaining it and registering a release finalizer.

func NewHapticEventWithAudioResourceIDParametersRelativeTime added in v0.17.0

func NewHapticEventWithAudioResourceIDParametersRelativeTime(resID int, eventParams []*HapticEventParameter, time_ float64) *HapticEvent

NewHapticEventWithAudioResourceIDParametersRelativeTime initializes a haptic event from a previously loaded audio resource, specifying event parameters and start time.

func NewHapticEventWithAudioResourceIDParametersRelativeTimeDuration added in v0.17.0

func NewHapticEventWithAudioResourceIDParametersRelativeTimeDuration(resID int, eventParams []*HapticEventParameter, time_ float64, duration float64) *HapticEvent

NewHapticEventWithAudioResourceIDParametersRelativeTimeDuration initializes a haptic event from a previously loaded audio resource, specifying event parameters, start time, and duration.

func NewHapticEventWithEventTypeParametersRelativeTime added in v0.17.0

func NewHapticEventWithEventTypeParametersRelativeTime(type_ obj.Object, eventParams []*HapticEventParameter, time_ float64) *HapticEvent

NewHapticEventWithEventTypeParametersRelativeTime initializes a haptic event of the specified type, parameters, and start time.

func NewHapticEventWithEventTypeParametersRelativeTimeDuration added in v0.17.0

func NewHapticEventWithEventTypeParametersRelativeTimeDuration(type_ obj.Object, eventParams []*HapticEventParameter, time_ float64, duration float64) *HapticEvent

NewHapticEventWithEventTypeParametersRelativeTimeDuration initializes a haptic event of the specified type, parameters, start time, and duration.

func (*HapticEvent) Description added in v0.17.0

func (he *HapticEvent) Description() string

Description returns the object's -description text.

func (*HapticEvent) Duration added in v0.17.0

func (he *HapticEvent) Duration() float64

Duration returns the duration.

func (*HapticEvent) EventParameters added in v0.17.0

func (he *HapticEvent) EventParameters() []*HapticEventParameter

EventParameters returns the event parameters.

EventParameters returns the collection as a Go slice.

func (*HapticEvent) IsEqual added in v0.17.0

func (he *HapticEvent) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticEvent) IsKind added in v0.17.0

func (he *HapticEvent) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticEvent) RelativeTime added in v0.17.0

func (he *HapticEvent) RelativeTime() float64

RelativeTime returns the relative time.

func (*HapticEvent) String added in v0.17.0

func (he *HapticEvent) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticEvent) Type added in v0.17.0

func (he *HapticEvent) Type() *foundation.String

Type returns the type.

func (*HapticEvent) WithDuration added in v0.17.0

func (he *HapticEvent) WithDuration(duration float64) *HapticEvent

WithDuration sets the duration of the haptic event.

func (*HapticEvent) WithRelativeTime added in v0.17.0

func (he *HapticEvent) WithRelativeTime(relativeTime float64) *HapticEvent

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

type HapticEventParameter added in v0.17.0

type HapticEventParameter struct {
	objref.Handle
}

HapticEventParameter is an idiomatic wrapper over the Objective-C class CHHapticEventParameter.

A static parameter value that represents a single property of the haptic pattern.

func HapticEventParameterFromID added in v0.17.0

func HapticEventParameterFromID(id objc.ID) *HapticEventParameter

HapticEventParameterFromID adopts an existing Objective-C object as a HapticEventParameter (nil for 0), retaining it and registering a release finalizer.

func NewHapticEventParameterWithParameterIDValue added in v0.17.0

func NewHapticEventParameterWithParameterIDValue(parameterID obj.Object, value float32) *HapticEventParameter

NewHapticEventParameterWithParameterIDValue creates a haptic event parameter from its ID and value.

func (*HapticEventParameter) Description added in v0.17.0

func (hep *HapticEventParameter) Description() string

Description returns the object's -description text.

func (*HapticEventParameter) IsEqual added in v0.17.0

func (hep *HapticEventParameter) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticEventParameter) IsKind added in v0.17.0

func (hep *HapticEventParameter) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticEventParameter) ParameterID added in v0.17.0

func (hep *HapticEventParameter) ParameterID() *foundation.String

ParameterID returns the parameter ID.

func (*HapticEventParameter) String added in v0.17.0

func (hep *HapticEventParameter) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticEventParameter) Value added in v0.17.0

func (hep *HapticEventParameter) Value() float32

Value returns the value.

func (*HapticEventParameter) WithValue added in v0.17.0

func (hep *HapticEventParameter) WithValue(value float32) *HapticEventParameter

WithValue sets the value of the parameter.

type HapticParameterAttributes added in v0.17.0

type HapticParameterAttributes interface {
	MinValue() float32
	MaxValue() float32
	DefaultValue() float32
}

HapticParameterAttributes is the Go form of the Objective-C protocol CHHapticParameterAttributes.

type HapticParameterCurve added in v0.17.0

type HapticParameterCurve struct {
	objref.Handle
}

HapticParameterCurve is an idiomatic wrapper over the Objective-C class CHHapticParameterCurve.

A curve that you send to a haptic pattern player to alter a property value gradually during playback.

func HapticParameterCurveFromID added in v0.17.0

func HapticParameterCurveFromID(id objc.ID) *HapticParameterCurve

HapticParameterCurveFromID adopts an existing Objective-C object as a HapticParameterCurve (nil for 0), retaining it and registering a release finalizer.

func NewHapticParameterCurveWithParameterIDControlPointsRelativeTime added in v0.17.0

func NewHapticParameterCurveWithParameterIDControlPointsRelativeTime(parameterID obj.Object, controlPoints []*HapticParameterCurveControlPoint, relativeTime float64) *HapticParameterCurve

NewHapticParameterCurveWithParameterIDControlPointsRelativeTime creates a parameter curve from its parameter ID, control points, and start time.

func (*HapticParameterCurve) ControlPoints added in v0.17.0

ControlPoints returns the control points.

ControlPoints returns the collection as a Go slice.

func (*HapticParameterCurve) Description added in v0.17.0

func (hpc *HapticParameterCurve) Description() string

Description returns the object's -description text.

func (*HapticParameterCurve) IsEqual added in v0.17.0

func (hpc *HapticParameterCurve) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticParameterCurve) IsKind added in v0.17.0

func (hpc *HapticParameterCurve) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticParameterCurve) ParameterID added in v0.17.0

func (hpc *HapticParameterCurve) ParameterID() *foundation.String

ParameterID returns the parameter ID.

func (*HapticParameterCurve) RelativeTime added in v0.17.0

func (hpc *HapticParameterCurve) RelativeTime() float64

RelativeTime returns the relative time.

func (*HapticParameterCurve) String added in v0.17.0

func (hpc *HapticParameterCurve) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticParameterCurve) WithRelativeTime added in v0.17.0

func (hpc *HapticParameterCurve) WithRelativeTime(relativeTime float64) *HapticParameterCurve

WithRelativeTime sets the time at which this parameter curve is applied, relative to the start time of the pattern.

type HapticParameterCurveControlPoint added in v0.17.0

type HapticParameterCurveControlPoint struct {
	objref.Handle
}

HapticParameterCurveControlPoint is an idiomatic wrapper over the Objective-C class CHHapticParameterCurveControlPoint.

A single control point in a parameter curve.

func HapticParameterCurveControlPointFromID added in v0.17.0

func HapticParameterCurveControlPointFromID(id objc.ID) *HapticParameterCurveControlPoint

HapticParameterCurveControlPointFromID adopts an existing Objective-C object as a HapticParameterCurveControlPoint (nil for 0), retaining it and registering a release finalizer.

func NewHapticParameterCurveControlPointWithRelativeTimeValue added in v0.17.0

func NewHapticParameterCurveControlPointWithRelativeTimeValue(time_ float64, value float32) *HapticParameterCurveControlPoint

NewHapticParameterCurveControlPointWithRelativeTimeValue initialize a CHHapticParameterCurveControlPoint with a relative time and value.

func (*HapticParameterCurveControlPoint) Description added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) Description() string

Description returns the object's -description text.

func (*HapticParameterCurveControlPoint) IsEqual added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticParameterCurveControlPoint) IsKind added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticParameterCurveControlPoint) RelativeTime added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) RelativeTime() float64

RelativeTime returns the relative time.

func (*HapticParameterCurveControlPoint) String added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

func (*HapticParameterCurveControlPoint) Value added in v0.17.0

Value returns the value.

func (*HapticParameterCurveControlPoint) WithRelativeTime added in v0.17.0

func (hpccp *HapticParameterCurveControlPoint) WithRelativeTime(relativeTime float64) *HapticParameterCurveControlPoint

WithRelativeTime sets the relative time.

func (*HapticParameterCurveControlPoint) WithValue added in v0.17.0

WithValue sets the value.

type HapticPattern added in v0.17.0

type HapticPattern struct {
	objref.Handle
}

HapticPattern is an idiomatic wrapper over the Objective-C class CHHapticPattern.

An object representing a haptic waveform.

func HapticPatternFromID added in v0.17.0

func HapticPatternFromID(id objc.ID) *HapticPattern

HapticPatternFromID adopts an existing Objective-C object as a HapticPattern (nil for 0), retaining it and registering a release finalizer.

func NewHapticPatternWithContentsOfURL added in v0.17.0

func NewHapticPatternWithContentsOfURL(ahapURL string) (result *HapticPattern, err error)

NewHapticPatternWithContentsOfURL creates a haptic pattern with the contents of an AHAP file.

func NewHapticPatternWithDictionary added in v0.17.0

func NewHapticPatternWithDictionary(patternDict obj.Object) (result *HapticPattern, err error)

NewHapticPatternWithDictionary creates a haptic pattern from a property list dictionary.

func NewHapticPatternWithEventsParameterCurves added in v0.17.0

func NewHapticPatternWithEventsParameterCurves(events []*HapticEvent, parameterCurves []*HapticParameterCurve) (result *HapticPattern, err error)

NewHapticPatternWithEventsParameterCurves constructs a haptic pattern from a series of events and parameter curves.

func NewHapticPatternWithEventsParameters added in v0.17.0

func NewHapticPatternWithEventsParameters(events []*HapticEvent, parameters []*HapticDynamicParameter) (result *HapticPattern, err error)

NewHapticPatternWithEventsParameters constructs a haptic pattern from a series of events and parameters.

func (*HapticPattern) Description added in v0.17.0

func (hp *HapticPattern) Description() string

Description returns the object's -description text.

func (*HapticPattern) Duration added in v0.17.0

func (hp *HapticPattern) Duration() float64

Duration returns the duration.

func (*HapticPattern) ExportDictionary added in v0.17.0

func (hp *HapticPattern) ExportDictionary() (result obj.Object, err error)

ExportDictionary returns the dictionary representation of the haptic pattern.

func (*HapticPattern) IsEqual added in v0.17.0

func (hp *HapticPattern) IsEqual(other obj.Object) bool

IsEqual reports Objective-C equality (isEqual:) with another object.

func (*HapticPattern) IsKind added in v0.17.0

func (hp *HapticPattern) IsKind(className string) bool

IsKind reports whether the object is an instance of the named class or a subclass.

func (*HapticPattern) String added in v0.17.0

func (hp *HapticPattern) String() string

String returns the object's -description text, so a wrapper prints usefully under fmt.

type HapticPatternPlayer added in v0.17.0

type HapticPatternPlayer interface {
	StartAtTimeError(time_ float64) bool
	StopAtTimeError(time_ float64) bool
	SendParametersAtTimeError(parameters []*HapticDynamicParameter, time_ float64) bool
	ScheduleParameterCurveAtTimeError(parameterCurve *HapticParameterCurve, time_ float64) bool
	CancelAndReturnError() bool
	IsMuted() bool
	SetIsMuted(isMuted bool)
}

HapticPatternPlayer is the Go form of the Objective-C protocol CHHapticPatternPlayer.

type Idtype added in v0.17.0

type Idtype int32
const (
	IdtypeAll  Idtype = 0
	IdtypePid  Idtype = 1
	IdtypePgid Idtype = 2
)

func (Idtype) String added in v0.17.0

func (e Idtype) String() string

String returns the Idtype constant's name, or its numeric form when the value is not a known constant.

type PtrauthKey added in v0.17.0

type PtrauthKey int32
const (
	Ptrauth_key_none                     PtrauthKey = -1
	Ptrauth_key_asia                     PtrauthKey = 0
	Ptrauth_key_asib                     PtrauthKey = 1
	Ptrauth_key_asda                     PtrauthKey = 2
	Ptrauth_key_asdb                     PtrauthKey = 3
	Ptrauth_key_process_independent_code PtrauthKey = 0
	Ptrauth_key_process_dependent_code   PtrauthKey = 1
	Ptrauth_key_process_independent_data PtrauthKey = 2
	Ptrauth_key_process_dependent_data   PtrauthKey = 3
	Ptrauth_key_return_address           PtrauthKey = 1
	Ptrauth_key_frame_pointer            PtrauthKey = 3
	Ptrauth_key_function_pointer         PtrauthKey = 0
	Ptrauth_key_block_function           PtrauthKey = 0
	Ptrauth_key_cxx_vtable_pointer       PtrauthKey = 2
	Ptrauth_key_method_list_pointer      PtrauthKey = 2
	Ptrauth_key_objc_isa_pointer         PtrauthKey = 2
	Ptrauth_key_objc_super_pointer       PtrauthKey = 2
	Ptrauth_key_objc_sel_pointer         PtrauthKey = 3
	Ptrauth_key_objc_class_ro_pointer    PtrauthKey = 2
	Ptrauth_key_block_descriptor_pointer PtrauthKey = 2
	Ptrauth_key_init_fini_pointer        PtrauthKey = 0
)

func (PtrauthKey) String added in v0.17.0

func (e PtrauthKey) String() string

String returns the PtrauthKey constant's name, or its numeric form when the value is not a known constant.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL