Documentation
¶
Overview ¶
Package corehaptics provides purego-based Go bindings for the macOS CoreHaptics framework.
Apple documentation: https://developer.apple.com/documentation/corehaptics
Index ¶
- func CHHapticAudioResourceKeyLoopEnabled() uintptr
- func CHHapticAudioResourceKeyUseVolumeEnvelope() uintptr
- func CHHapticDynamicParameterIDAudioAttackTimeControl() uintptr
- func CHHapticDynamicParameterIDAudioBrightnessControl() uintptr
- func CHHapticDynamicParameterIDAudioDecayTimeControl() uintptr
- func CHHapticDynamicParameterIDAudioPanControl() uintptr
- func CHHapticDynamicParameterIDAudioPitchControl() uintptr
- func CHHapticDynamicParameterIDAudioReleaseTimeControl() uintptr
- func CHHapticDynamicParameterIDAudioVolumeControl() uintptr
- func CHHapticDynamicParameterIDHapticAttackTimeControl() uintptr
- func CHHapticDynamicParameterIDHapticDecayTimeControl() uintptr
- func CHHapticDynamicParameterIDHapticIntensityControl() uintptr
- func CHHapticDynamicParameterIDHapticReleaseTimeControl() uintptr
- func CHHapticDynamicParameterIDHapticSharpnessControl() uintptr
- func CHHapticEventParameterIDAttackTime() uintptr
- func CHHapticEventParameterIDAudioBrightness() uintptr
- func CHHapticEventParameterIDAudioPan() uintptr
- func CHHapticEventParameterIDAudioPitch() uintptr
- func CHHapticEventParameterIDAudioVolume() uintptr
- func CHHapticEventParameterIDDecayTime() uintptr
- func CHHapticEventParameterIDHapticIntensity() uintptr
- func CHHapticEventParameterIDHapticSharpness() uintptr
- func CHHapticEventParameterIDReleaseTime() uintptr
- func CHHapticEventParameterIDSustained() uintptr
- func CHHapticEventTypeAudioContinuous() uintptr
- func CHHapticEventTypeAudioCustom() uintptr
- func CHHapticEventTypeHapticContinuous() uintptr
- func CHHapticEventTypeHapticTransient() uintptr
- func CHHapticPatternKeyEvent() uintptr
- func CHHapticPatternKeyEventDuration() uintptr
- func CHHapticPatternKeyEventParameters() uintptr
- func CHHapticPatternKeyEventType() uintptr
- func CHHapticPatternKeyEventWaveformLoopEnabled() uintptr
- func CHHapticPatternKeyEventWaveformPath() uintptr
- func CHHapticPatternKeyEventWaveformUseVolumeEnvelope() uintptr
- func CHHapticPatternKeyParameter() uintptr
- func CHHapticPatternKeyParameterCurve() uintptr
- func CHHapticPatternKeyParameterCurveControlPoints() uintptr
- func CHHapticPatternKeyParameterID() uintptr
- func CHHapticPatternKeyParameterValue() uintptr
- func CHHapticPatternKeyPattern() uintptr
- func CHHapticPatternKeyTime() uintptr
- func CHHapticPatternKeyVersion() uintptr
- type CHHapticAdvancedPatternPlayer
- type CHHapticDeviceCapability
- type CHHapticDynamicParameter
- func (o *CHHapticDynamicParameter) InitWithParameterIDValueRelativeTime(parameterID *foundation.NSString, value float32, time_ float64) *CHHapticDynamicParameter
- func (o *CHHapticDynamicParameter) ParameterID() *foundation.NSString
- func (o *CHHapticDynamicParameter) RelativeTime() float64
- func (o *CHHapticDynamicParameter) SetRelativeTime(relativeTime float64)
- func (o *CHHapticDynamicParameter) SetValue(value float32)
- func (o *CHHapticDynamicParameter) Value() float32
- type CHHapticEngine
- func (o *CHHapticEngine) CreateAdvancedPlayerWithPatternError(pattern *CHHapticPattern) (CHHapticAdvancedPatternPlayer, error)
- func (o *CHHapticEngine) CreatePlayerWithPatternError(pattern *CHHapticPattern) (CHHapticPatternPlayer, error)
- func (o *CHHapticEngine) CurrentTime() float64
- func (o *CHHapticEngine) InitAndReturnError() (*CHHapticEngine, error)
- func (o *CHHapticEngine) InitWithAudioSessionError(audioSession objc.ID) (*CHHapticEngine, error)
- func (o *CHHapticEngine) IsAutoShutdownEnabled() bool
- func (o *CHHapticEngine) IsMutedForAudio() bool
- func (o *CHHapticEngine) IsMutedForHaptics() bool
- func (o *CHHapticEngine) NotifyWhenPlayersFinished(finishedHandler func(unsafe.Pointer) CHHapticEngineFinishedAction)
- func (o *CHHapticEngine) PlayPatternFromDataError(data *foundation.NSData) (bool, error)
- func (o *CHHapticEngine) PlayPatternFromURLError(fileURL *foundation.NSURL) (bool, error)
- func (o *CHHapticEngine) PlaysAudioOnly() bool
- func (o *CHHapticEngine) PlaysHapticsOnly() bool
- func (o *CHHapticEngine) RegisterAudioResourceOptionsError(resourceURL *foundation.NSURL, ...) (uint, error)
- func (o *CHHapticEngine) ResetHandler() objc.Block
- func (o *CHHapticEngine) SetAutoShutdownEnabled(autoShutdownEnabled bool)
- func (o *CHHapticEngine) SetIsMutedForAudio(isMutedForAudio bool)
- func (o *CHHapticEngine) SetIsMutedForHaptics(isMutedForHaptics bool)
- func (o *CHHapticEngine) SetPlaysAudioOnly(playsAudioOnly bool)
- func (o *CHHapticEngine) SetPlaysHapticsOnly(playsHapticsOnly bool)
- func (o *CHHapticEngine) SetResetHandler(resetHandler func())
- func (o *CHHapticEngine) SetStoppedHandler(stoppedHandler func(CHHapticEngineStoppedReason))
- func (o *CHHapticEngine) StartAndReturnError() (bool, error)
- func (o *CHHapticEngine) StartWithCompletionHandler(completionHandler func(unsafe.Pointer))
- func (o *CHHapticEngine) StopWithCompletionHandler(completionHandler func(unsafe.Pointer))
- func (o *CHHapticEngine) StoppedHandler() objc.Block
- func (o *CHHapticEngine) UnregisterAudioResourceError(resourceID uint) (bool, error)
- type CHHapticEngineFinishedAction
- type CHHapticEngineStoppedReason
- type CHHapticErrorCode
- type CHHapticEvent
- func (o *CHHapticEvent) Duration() float64
- func (o *CHHapticEvent) EventParameters() *foundation.NSArray[*CHHapticEventParameter]
- func (o *CHHapticEvent) InitWithAudioResourceIDParametersRelativeTime(resID uint, eventParams *foundation.NSArray[*CHHapticEventParameter], ...) *CHHapticEvent
- func (o *CHHapticEvent) InitWithAudioResourceIDParametersRelativeTimeDuration(resID uint, eventParams *foundation.NSArray[*CHHapticEventParameter], ...) *CHHapticEvent
- func (o *CHHapticEvent) InitWithEventTypeParametersRelativeTime(type_ *foundation.NSString, ...) *CHHapticEvent
- func (o *CHHapticEvent) InitWithEventTypeParametersRelativeTimeDuration(type_ *foundation.NSString, ...) *CHHapticEvent
- func (o *CHHapticEvent) RelativeTime() float64
- func (o *CHHapticEvent) SetDuration(duration float64)
- func (o *CHHapticEvent) SetRelativeTime(relativeTime float64)
- func (o *CHHapticEvent) Type() *foundation.NSString
- type CHHapticEventParameter
- func (o *CHHapticEventParameter) InitWithParameterIDValue(parameterID *foundation.NSString, value float32) *CHHapticEventParameter
- func (o *CHHapticEventParameter) ParameterID() *foundation.NSString
- func (o *CHHapticEventParameter) SetValue(value float32)
- func (o *CHHapticEventParameter) Value() float32
- type CHHapticParameterAttributes
- type CHHapticParameterCurve
- func (o *CHHapticParameterCurve) ControlPoints() *foundation.NSArray[*CHHapticParameterCurveControlPoint]
- func (o *CHHapticParameterCurve) InitWithParameterIDControlPointsRelativeTime(parameterID *foundation.NSString, ...) *CHHapticParameterCurve
- func (o *CHHapticParameterCurve) ParameterID() *foundation.NSString
- func (o *CHHapticParameterCurve) RelativeTime() float64
- func (o *CHHapticParameterCurve) SetRelativeTime(relativeTime float64)
- type CHHapticParameterCurveControlPoint
- func (o *CHHapticParameterCurveControlPoint) InitWithRelativeTimeValue(time_ float64, value float32) *CHHapticParameterCurveControlPoint
- func (o *CHHapticParameterCurveControlPoint) RelativeTime() float64
- func (o *CHHapticParameterCurveControlPoint) SetRelativeTime(relativeTime float64)
- func (o *CHHapticParameterCurveControlPoint) SetValue(value float32)
- func (o *CHHapticParameterCurveControlPoint) Value() float32
- type CHHapticPattern
- func (o *CHHapticPattern) Duration() float64
- func (o *CHHapticPattern) ExportDictionaryAndReturnError() (*foundation.NSDictionary[*foundation.NSString, objc.ID], error)
- func (o *CHHapticPattern) InitWithContentsOfURLError(ahapURL *foundation.NSURL) (*CHHapticPattern, error)
- func (o *CHHapticPattern) InitWithDictionaryError(patternDict *foundation.NSDictionary[*foundation.NSString, objc.ID]) (*CHHapticPattern, error)
- func (o *CHHapticPattern) InitWithEventsParameterCurvesError(events *foundation.NSArray[*CHHapticEvent], ...) (*CHHapticPattern, error)
- func (o *CHHapticPattern) InitWithEventsParametersError(events *foundation.NSArray[*CHHapticEvent], ...) (*CHHapticPattern, error)
- type CHHapticPatternPlayer
- type Idtype_t
- type Ptrauth_key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CHHapticAudioResourceKeyLoopEnabled ¶
func CHHapticAudioResourceKeyLoopEnabled() uintptr
func CHHapticAudioResourceKeyUseVolumeEnvelope ¶
func CHHapticAudioResourceKeyUseVolumeEnvelope() uintptr
func CHHapticDynamicParameterIDAudioAttackTimeControl ¶
func CHHapticDynamicParameterIDAudioAttackTimeControl() uintptr
func CHHapticDynamicParameterIDAudioBrightnessControl ¶
func CHHapticDynamicParameterIDAudioBrightnessControl() uintptr
func CHHapticDynamicParameterIDAudioDecayTimeControl ¶
func CHHapticDynamicParameterIDAudioDecayTimeControl() uintptr
func CHHapticDynamicParameterIDAudioPanControl ¶
func CHHapticDynamicParameterIDAudioPanControl() uintptr
func CHHapticDynamicParameterIDAudioPitchControl ¶
func CHHapticDynamicParameterIDAudioPitchControl() uintptr
func CHHapticDynamicParameterIDAudioReleaseTimeControl ¶
func CHHapticDynamicParameterIDAudioReleaseTimeControl() uintptr
func CHHapticDynamicParameterIDAudioVolumeControl ¶
func CHHapticDynamicParameterIDAudioVolumeControl() uintptr
func CHHapticDynamicParameterIDHapticAttackTimeControl ¶
func CHHapticDynamicParameterIDHapticAttackTimeControl() uintptr
func CHHapticDynamicParameterIDHapticDecayTimeControl ¶
func CHHapticDynamicParameterIDHapticDecayTimeControl() uintptr
func CHHapticDynamicParameterIDHapticIntensityControl ¶
func CHHapticDynamicParameterIDHapticIntensityControl() uintptr
func CHHapticDynamicParameterIDHapticReleaseTimeControl ¶
func CHHapticDynamicParameterIDHapticReleaseTimeControl() uintptr
func CHHapticDynamicParameterIDHapticSharpnessControl ¶
func CHHapticDynamicParameterIDHapticSharpnessControl() uintptr
func CHHapticEventParameterIDAttackTime ¶
func CHHapticEventParameterIDAttackTime() uintptr
func CHHapticEventParameterIDAudioBrightness ¶
func CHHapticEventParameterIDAudioBrightness() uintptr
func CHHapticEventParameterIDAudioPan ¶
func CHHapticEventParameterIDAudioPan() uintptr
func CHHapticEventParameterIDAudioPitch ¶
func CHHapticEventParameterIDAudioPitch() uintptr
func CHHapticEventParameterIDAudioVolume ¶
func CHHapticEventParameterIDAudioVolume() uintptr
func CHHapticEventParameterIDDecayTime ¶
func CHHapticEventParameterIDDecayTime() uintptr
func CHHapticEventParameterIDHapticIntensity ¶
func CHHapticEventParameterIDHapticIntensity() uintptr
func CHHapticEventParameterIDHapticSharpness ¶
func CHHapticEventParameterIDHapticSharpness() uintptr
func CHHapticEventParameterIDReleaseTime ¶
func CHHapticEventParameterIDReleaseTime() uintptr
func CHHapticEventParameterIDSustained ¶
func CHHapticEventParameterIDSustained() uintptr
func CHHapticEventTypeAudioContinuous ¶
func CHHapticEventTypeAudioContinuous() uintptr
func CHHapticEventTypeAudioCustom ¶
func CHHapticEventTypeAudioCustom() uintptr
func CHHapticEventTypeHapticContinuous ¶
func CHHapticEventTypeHapticContinuous() uintptr
func CHHapticEventTypeHapticTransient ¶
func CHHapticEventTypeHapticTransient() uintptr
func CHHapticPatternKeyEvent ¶
func CHHapticPatternKeyEvent() uintptr
func CHHapticPatternKeyEventDuration ¶
func CHHapticPatternKeyEventDuration() uintptr
func CHHapticPatternKeyEventParameters ¶
func CHHapticPatternKeyEventParameters() uintptr
func CHHapticPatternKeyEventType ¶
func CHHapticPatternKeyEventType() uintptr
func CHHapticPatternKeyEventWaveformLoopEnabled ¶
func CHHapticPatternKeyEventWaveformLoopEnabled() uintptr
func CHHapticPatternKeyEventWaveformPath ¶
func CHHapticPatternKeyEventWaveformPath() uintptr
func CHHapticPatternKeyEventWaveformUseVolumeEnvelope ¶
func CHHapticPatternKeyEventWaveformUseVolumeEnvelope() uintptr
func CHHapticPatternKeyParameter ¶
func CHHapticPatternKeyParameter() uintptr
func CHHapticPatternKeyParameterCurve ¶
func CHHapticPatternKeyParameterCurve() uintptr
func CHHapticPatternKeyParameterCurveControlPoints ¶
func CHHapticPatternKeyParameterCurveControlPoints() uintptr
func CHHapticPatternKeyParameterID ¶
func CHHapticPatternKeyParameterID() uintptr
func CHHapticPatternKeyParameterValue ¶
func CHHapticPatternKeyParameterValue() uintptr
func CHHapticPatternKeyPattern ¶
func CHHapticPatternKeyPattern() uintptr
func CHHapticPatternKeyTime ¶
func CHHapticPatternKeyTime() uintptr
func CHHapticPatternKeyVersion ¶
func CHHapticPatternKeyVersion() uintptr
Types ¶
type CHHapticAdvancedPatternPlayer ¶
type CHHapticAdvancedPatternPlayer interface {
CHHapticPatternPlayer
PauseAtTimeError(time_ float64) (bool, error)
ResumeAtTimeError(time_ float64) (bool, error)
SeekToOffsetError(offsetTime float64) (bool, error)
LoopEnabled() bool
SetLoopEnabled(loopEnabled bool)
LoopEnd() float64
SetLoopEnd(loopEnd float64)
PlaybackRate() float32
SetPlaybackRate(playbackRate float32)
IsMuted() bool
SetIsMuted(isMuted bool)
CompletionHandler() objc.Block
SetCompletionHandler(completionHandler func(unsafe.Pointer))
}
CHHapticAdvancedPatternPlayer wraps the ObjC protocol CHHapticAdvancedPatternPlayer.
type CHHapticDeviceCapability ¶
type CHHapticDeviceCapability interface {
}
CHHapticDeviceCapability wraps the ObjC protocol CHHapticDeviceCapability.
func CHHapticEngineCapabilitiesForHardware ¶
func CHHapticEngineCapabilitiesForHardware() CHHapticDeviceCapability
@method capabilitiesForHardware @abstract Get the protocol that describes haptic and audio capabilities on this device. @discussion Detailed description on the capability protocol is in CHHapticDeviceCapability.h.
type CHHapticDynamicParameter ¶
type CHHapticDynamicParameter struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameter
func CHHapticDynamicParameterFromID ¶
func CHHapticDynamicParameterFromID(id objc.ID) *CHHapticDynamicParameter
func (*CHHapticDynamicParameter) InitWithParameterIDValueRelativeTime ¶
func (o *CHHapticDynamicParameter) InitWithParameterIDValueRelativeTime(parameterID *foundation.NSString, value float32, time_ float64) *CHHapticDynamicParameter
@method initWithParameterID:value:relativeTime @abstract Initialize a CHHapticDynamicParameter with a parameter ID, value, and relative time. @param parameterID The CHHapticDynamicParameterID for the desired parameter change. @param value The value for that parameter. @param time The time at which this parameter should be applied, relative to the start time of the pattern.
func (*CHHapticDynamicParameter) ParameterID ¶
func (o *CHHapticDynamicParameter) ParameterID() *foundation.NSString
@property parameterID The ID of the dynamic parameter to use.
func (*CHHapticDynamicParameter) RelativeTime ¶
func (o *CHHapticDynamicParameter) RelativeTime() float64
@property relativeTime The time at which the parameter should be applied, relative to the start time for the pattern.
func (*CHHapticDynamicParameter) SetRelativeTime ¶
func (o *CHHapticDynamicParameter) SetRelativeTime(relativeTime float64)
func (*CHHapticDynamicParameter) SetValue ¶
func (o *CHHapticDynamicParameter) SetValue(value float32)
func (*CHHapticDynamicParameter) Value ¶
func (o *CHHapticDynamicParameter) Value() float32
@property value The value of the parameter.
type CHHapticEngine ¶
type CHHapticEngine struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticengine
func CHHapticEngineFromID ¶
func CHHapticEngineFromID(id objc.ID) *CHHapticEngine
func (*CHHapticEngine) CreateAdvancedPlayerWithPatternError ¶
func (o *CHHapticEngine) CreateAdvancedPlayerWithPatternError(pattern *CHHapticPattern) (CHHapticAdvancedPatternPlayer, error)
@method createAdvancedPlayerWithPattern:error @abstract Factory method for creating a CHHapticAdvancedPatternPlayer from a CHHapticPattern. @param pattern The pattern to be played.
func (*CHHapticEngine) CreatePlayerWithPatternError ¶
func (o *CHHapticEngine) CreatePlayerWithPatternError(pattern *CHHapticPattern) (CHHapticPatternPlayer, error)
@method createPlayerWithPattern:error @abstract Factory method for creating a CHHapticPatternPlayer from a CHHapticPattern. @param pattern The pattern to be played.
func (*CHHapticEngine) CurrentTime ¶
func (o *CHHapticEngine) CurrentTime() float64
@property currentTime The absolute time from which all current and future event times may be calculated. The units are seconds.
func (*CHHapticEngine) InitAndReturnError ¶
func (o *CHHapticEngine) InitAndReturnError() (*CHHapticEngine, error)
@method initAndReturnError: @abstract Create an instance of the CHHapticEngine. @discussion More than one instance may exist within a process. Each will function independently of the others. CHHapticEngines created using this method will be associated with the device's internal haptics hardware system, if one exists. For systems without internal haptics, this method will fail with the error `CHHapticErrorCodeNotSupported`. To access engine instances associated with external game controllers, see the GameController framework documentation for the `hapticEngines` property on the GCController class.
func (*CHHapticEngine) InitWithAudioSessionError ¶
func (o *CHHapticEngine) InitWithAudioSessionError(audioSession objc.ID) (*CHHapticEngine, error)
@method initWithAudioSession:error @abstract Create an instance of an CHHapticEngine and associate it with an audio session. If 'audioSession' is nil, the engine will create its own. @discussion More than one instance may exist within a process. Each will function independently of the others, but all CHHapticEngines which share an audio session will have identical audio behavior with regard to interruptions, etc. CHHapticEngines created using this method will be associated with the device's internal haptics hardware system, if one exists. For systems without internal haptics, this method will fail with the error `CHHapticErrorCodeNotSupported`. To access engine instances associated with external game controllers, see the GameController framework documentation for the `hapticEngines` property on the GCController class.
func (*CHHapticEngine) IsAutoShutdownEnabled ¶
func (o *CHHapticEngine) IsAutoShutdownEnabled() bool
@property autoShutdownEnabled @abstract When auto shutdown is enabled, the haptic engine can start and stop the hardware dynamically, to conserve power. @discussion 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 (*CHHapticEngine) IsMutedForAudio ¶
func (o *CHHapticEngine) IsMutedForAudio() bool
@property isMutedForAudio When set to YES, the CHHapticEngine mutes audio playback from its players. @discussion Default is NO.
func (*CHHapticEngine) IsMutedForHaptics ¶
func (o *CHHapticEngine) IsMutedForHaptics() bool
@property isMutedForHaptics When set to YES, the CHHapticEngine mutes haptic playback from its players. @discussion Default is NO.
func (*CHHapticEngine) NotifyWhenPlayersFinished ¶
func (o *CHHapticEngine) NotifyWhenPlayersFinished(finishedHandler func(unsafe.Pointer) CHHapticEngineFinishedAction)
@method notifyWhenPlayersFinished: @abstract Tell the engine to asynchronously call the passed-in handler when all active pattern players associated with this engine have stopped. @param finishedHandler The block that will be called asynchronously. The return value of this block determines the action the engine will take when the block finishes (see `CHHapticEngineFinishedHandler`). @discussion If additional players are started after this call is made, they will delay the callback. If no players are active or the engine is stopped, the callback will happen immediately.
func (*CHHapticEngine) PlayPatternFromDataError ¶
func (o *CHHapticEngine) PlayPatternFromDataError(data *foundation.NSData) (bool, error)
@method playPatternFromData:error @abstract Simple one-shot call to play a pattern specified by NSData. @param data The NSData containing a haptic/audio pattern dictionary. @param outError If the operation fails, this will be set to a valid NSError describing the error. @discussion The engine should be started prior to calling this method if low latency is desired. If this is not done, this method will start it, which can cause a significant delay.
func (*CHHapticEngine) PlayPatternFromURLError ¶
func (o *CHHapticEngine) PlayPatternFromURLError(fileURL *foundation.NSURL) (bool, error)
@method playPatternFromURL:error @abstract Simple one-shot call to play a pattern specified by a URL. @param fileURL The URL of the file containing a haptic/audio pattern dictionary. @param outError If the operation fails, this will be set to a valid NSError describing the error. @discussion The engine should be started prior to calling this method if low latency is desired. If this is not done, this method will start it, which can cause a significant delay.
func (*CHHapticEngine) PlaysAudioOnly ¶
func (o *CHHapticEngine) PlaysAudioOnly() bool
@property playsAudioOnly If set to YES, the CHHapticEngine will ignore all events of type CHHapticEventTypeHaptic and play only audio events. @discussion This behavior change will only take effect after the engine is stopped and restarted. The default is NO.
func (*CHHapticEngine) PlaysHapticsOnly ¶
func (o *CHHapticEngine) PlaysHapticsOnly() bool
@property playsHapticsOnly If set to YES, the CHHapticEngine will ignore all events of type CHHapticEventTypeAudio and play only haptic events. @discussion This behavior change will only take effect after the engine is stopped and restarted. The default is NO.
func (*CHHapticEngine) RegisterAudioResourceOptionsError ¶
func (o *CHHapticEngine) RegisterAudioResourceOptionsError(resourceURL *foundation.NSURL, options *foundation.NSDictionary[objc.ID, objc.ID]) (uint, error)
@method registerAudioResource:options:error @abstract Register an external audio file for use as a custom waveform. @param resourceURL A URL referencing the location of the audio file to be registered. @param options A dictionary containing CHHapticAudioResourceKey/value pairs describing how this resource should be played. @param outError If register operation fails, this will be set to a valid NSError describing the error.
func (*CHHapticEngine) ResetHandler ¶
func (o *CHHapticEngine) ResetHandler() objc.Block
@property resetHandler @abstract This block will called asynchronously if the haptic engine has to reset itself after a server failure. @discussion In response to this handler being called, the client must release all haptic pattern players and recreate them. All CHHapticPattern objects and CHHapticEngine properties will have been preserved. In general, callbacks arrive on a non-main thread and it is the client's responsibility to handle it in a thread-safe manner.
func (*CHHapticEngine) SetAutoShutdownEnabled ¶
func (o *CHHapticEngine) SetAutoShutdownEnabled(autoShutdownEnabled bool)
func (*CHHapticEngine) SetIsMutedForAudio ¶
func (o *CHHapticEngine) SetIsMutedForAudio(isMutedForAudio bool)
func (*CHHapticEngine) SetIsMutedForHaptics ¶
func (o *CHHapticEngine) SetIsMutedForHaptics(isMutedForHaptics bool)
func (*CHHapticEngine) SetPlaysAudioOnly ¶
func (o *CHHapticEngine) SetPlaysAudioOnly(playsAudioOnly bool)
func (*CHHapticEngine) SetPlaysHapticsOnly ¶
func (o *CHHapticEngine) SetPlaysHapticsOnly(playsHapticsOnly bool)
func (*CHHapticEngine) SetResetHandler ¶
func (o *CHHapticEngine) SetResetHandler(resetHandler func())
func (*CHHapticEngine) SetStoppedHandler ¶
func (o *CHHapticEngine) SetStoppedHandler(stoppedHandler func(CHHapticEngineStoppedReason))
func (*CHHapticEngine) StartAndReturnError ¶
func (o *CHHapticEngine) StartAndReturnError() (bool, error)
@method startAndReturnError: @abstract Start the engine and block until the engine has started. @discussion This method will return NO upon failure, and outError will be set to a valid NSError describing the error.
func (*CHHapticEngine) StartWithCompletionHandler ¶
func (o *CHHapticEngine) StartWithCompletionHandler(completionHandler func(unsafe.Pointer))
@method startWithCompletionHandler: @abstract Asynchronously start the engine. The handler will be called when the operation completes. @discussion The handler is guaranteed to be called on either success or failure.
func (*CHHapticEngine) StopWithCompletionHandler ¶
func (o *CHHapticEngine) StopWithCompletionHandler(completionHandler func(unsafe.Pointer))
@method stopWithCompletionHandler: @abstract Asynchronously stop the engine. The handler will be called when the operation completes. @discussion The handler is guaranteed to be called on either success or failure.
func (*CHHapticEngine) StoppedHandler ¶
func (o *CHHapticEngine) StoppedHandler() objc.Block
func (*CHHapticEngine) UnregisterAudioResourceError ¶
func (o *CHHapticEngine) UnregisterAudioResourceError(resourceID uint) (bool, error)
@method unregisterAudioResource:error @abstract Unregister and remove a previously-registered audio resource. @param resourceID The resource ID that was returned when the resource was registered. @param outError If the unregister operation fails, this will be set to a valid NSError describing the error.
type CHHapticEngineFinishedAction ¶
type CHHapticEngineFinishedAction int64
const ( CHHapticEngineFinishedActionStopEngine CHHapticEngineFinishedAction = 1 CHHapticEngineFinishedActionLeaveEngineRunning CHHapticEngineFinishedAction = 2 )
func (CHHapticEngineFinishedAction) String ¶
func (e CHHapticEngineFinishedAction) String() string
type CHHapticEngineStoppedReason ¶
type CHHapticEngineStoppedReason int64
const ( CHHapticEngineStoppedReasonAudioSessionInterrupt CHHapticEngineStoppedReason = 1 CHHapticEngineStoppedReasonApplicationSuspended CHHapticEngineStoppedReason = 2 CHHapticEngineStoppedReasonIdleTimeout CHHapticEngineStoppedReason = 3 CHHapticEngineStoppedReasonNotifyWhenFinished CHHapticEngineStoppedReason = 4 CHHapticEngineStoppedReasonEngineDestroyed CHHapticEngineStoppedReason = 5 CHHapticEngineStoppedReasonGameControllerDisconnect CHHapticEngineStoppedReason = 6 CHHapticEngineStoppedReasonSystemError CHHapticEngineStoppedReason = -1 )
func (CHHapticEngineStoppedReason) String ¶
func (e CHHapticEngineStoppedReason) String() string
type CHHapticErrorCode ¶
type CHHapticErrorCode int64
const ( CHHapticErrorCodeEngineNotRunning CHHapticErrorCode = -4805 CHHapticErrorCodeOperationNotPermitted CHHapticErrorCode = -4806 CHHapticErrorCodeEngineStartTimeout CHHapticErrorCode = -4808 CHHapticErrorCodeNotSupported CHHapticErrorCode = -4809 CHHapticErrorCodeServerInitFailed CHHapticErrorCode = -4810 CHHapticErrorCodeServerInterrupted CHHapticErrorCode = -4811 CHHapticErrorCodeInvalidPatternPlayer CHHapticErrorCode = -4812 CHHapticErrorCodeInvalidPatternData CHHapticErrorCode = -4813 CHHapticErrorCodeInvalidPatternDictionary CHHapticErrorCode = -4814 CHHapticErrorCodeInvalidAudioSession CHHapticErrorCode = -4815 CHHapticErrorCodeInvalidEngineParameter CHHapticErrorCode = -4816 CHHapticErrorCodeInvalidParameterType CHHapticErrorCode = -4820 CHHapticErrorCodeInvalidEventType CHHapticErrorCode = -4821 CHHapticErrorCodeInvalidEventTime CHHapticErrorCode = -4822 CHHapticErrorCodeInvalidEventDuration CHHapticErrorCode = -4823 CHHapticErrorCodeInvalidAudioResource CHHapticErrorCode = -4824 CHHapticErrorCodeResourceNotAvailable CHHapticErrorCode = -4825 CHHapticErrorCodeBadEventEntry CHHapticErrorCode = -4830 CHHapticErrorCodeBadParameterEntry CHHapticErrorCode = -4831 CHHapticErrorCodeInvalidTime CHHapticErrorCode = -4840 CHHapticErrorCodeFileNotFound CHHapticErrorCode = -4851 CHHapticErrorCodeInsufficientPower CHHapticErrorCode = -4897 CHHapticErrorCodeUnknownError CHHapticErrorCode = -4898 CHHapticErrorCodeMemoryError CHHapticErrorCode = -4899 )
func (CHHapticErrorCode) String ¶
func (e CHHapticErrorCode) String() string
type CHHapticEvent ¶
type CHHapticEvent struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticevent
func CHHapticEventFromID ¶
func CHHapticEventFromID(id objc.ID) *CHHapticEvent
func (*CHHapticEvent) Duration ¶
func (o *CHHapticEvent) Duration() float64
@property duration The duration for this event. Units are seconds. If unset (0.0), Continuous event types will have no fixed end.
func (*CHHapticEvent) EventParameters ¶
func (o *CHHapticEvent) EventParameters() *foundation.NSArray[*CHHapticEventParameter]
@property eventParameters NSArray of Event parameters. Can be empty.
func (*CHHapticEvent) InitWithAudioResourceIDParametersRelativeTime ¶
func (o *CHHapticEvent) InitWithAudioResourceIDParametersRelativeTime(resID uint, eventParams *foundation.NSArray[*CHHapticEventParameter], time_ float64) *CHHapticEvent
@method initWithAudioResourceID:parameters:relativeTime @abstract Initialize a new CHHapticEvent using a previously-loaded audio resource. @param resID A previously-registered audio resource ID (see `CHHapticEngine(registerAudioResource:options:error)`). @param eventParams An NSArray of Event parameters. Can be empty. @param time The relative time for this event versus the other events in the CHHapticPattern.
func (*CHHapticEvent) InitWithAudioResourceIDParametersRelativeTimeDuration ¶
func (o *CHHapticEvent) InitWithAudioResourceIDParametersRelativeTimeDuration(resID uint, eventParams *foundation.NSArray[*CHHapticEventParameter], time_ float64, duration float64) *CHHapticEvent
@method initWithAudioResourceID:parameters:relativeTime:duration @abstract Initialize a new CHHapticEvent using a previously-loaded audio resource. @param resID A previously-registered audio resource ID (see `CHHapticEngine(registerAudioResource:options:error)`). @param eventParams An NSArray of Event parameters. Can be empty. @param time The relative time for this event versus the other events in the CHHapticPattern. @param duration The duration of this event in seconds. @discussion If the specified duration is less than the duration of the audio resource, its playback will be truncated. If it is greater, its playback will be padded with silence. If zero, it will be ignored.
func (*CHHapticEvent) InitWithEventTypeParametersRelativeTime ¶
func (o *CHHapticEvent) InitWithEventTypeParametersRelativeTime(type_ *foundation.NSString, eventParams *foundation.NSArray[*CHHapticEventParameter], time_ float64) *CHHapticEvent
@method initWithEventType:parameters:relativeTime @abstract Initialize a new CHHapticEvent. This can only be used to create Transient event types (which do not require a duration). @param type The type of event. @param eventParams An NSArray of Event parameters. Can be empty. @param time The relative time for this event versus the other events in the CHHapticPattern.
func (*CHHapticEvent) InitWithEventTypeParametersRelativeTimeDuration ¶
func (o *CHHapticEvent) InitWithEventTypeParametersRelativeTimeDuration(type_ *foundation.NSString, eventParams *foundation.NSArray[*CHHapticEventParameter], time_ float64, duration float64) *CHHapticEvent
@method initWithEventType:parameters:relativeTime:duration @abstract Initialize a new CHHapticEvent, providing a duration. @param type The type of event. @param eventParams An NSArray of Event parameters. Can be empty. @param time The relative time for this event versus the other events in the CHHapticPattern. @param duration For Continuous event types, the length of time before the event playback begins its release. For Transient event types, the logical length of the event (used to determine pattern end and loop points).
func (*CHHapticEvent) RelativeTime ¶
func (o *CHHapticEvent) RelativeTime() float64
@property relativeTime The relative time for this event versus the start time of the pattern. Units are seconds.
func (*CHHapticEvent) SetDuration ¶
func (o *CHHapticEvent) SetDuration(duration float64)
func (*CHHapticEvent) SetRelativeTime ¶
func (o *CHHapticEvent) SetRelativeTime(relativeTime float64)
func (*CHHapticEvent) Type ¶
func (o *CHHapticEvent) Type() *foundation.NSString
@property type The type of event.
type CHHapticEventParameter ¶
type CHHapticEventParameter struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticeventparameter
func CHHapticEventParameterFromID ¶
func CHHapticEventParameterFromID(id objc.ID) *CHHapticEventParameter
func (*CHHapticEventParameter) InitWithParameterIDValue ¶
func (o *CHHapticEventParameter) InitWithParameterIDValue(parameterID *foundation.NSString, value float32) *CHHapticEventParameter
func (*CHHapticEventParameter) ParameterID ¶
func (o *CHHapticEventParameter) ParameterID() *foundation.NSString
@property parameterID The ID of the event parameter to use.
func (*CHHapticEventParameter) SetValue ¶
func (o *CHHapticEventParameter) SetValue(value float32)
func (*CHHapticEventParameter) Value ¶
func (o *CHHapticEventParameter) Value() float32
@property value The value of the event parameter.
type CHHapticParameterAttributes ¶
type CHHapticParameterAttributes interface {
MinValue() float32
MaxValue() float32
DefaultValue() float32
}
CHHapticParameterAttributes wraps the ObjC protocol CHHapticParameterAttributes.
type CHHapticParameterCurve ¶
type CHHapticParameterCurve struct {
foundation.NSObject
}
@class CHHapticParameterCurve @abstract A CHHapticParameterCurve is a set of CHHapticParameterCurveControlPoints which describe the control (inflection) points for the parameter values to be applied to the associated pattern. @discussion The CHHapticParameterCurve generates an interpolated value output which passed through each control point at its associated relative time. These times will all be relative to the start time of the CHHapticParameterCurve within the playing pattern.
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticparametercurve
func CHHapticParameterCurveFromID ¶
func CHHapticParameterCurveFromID(id objc.ID) *CHHapticParameterCurve
func (*CHHapticParameterCurve) ControlPoints ¶
func (o *CHHapticParameterCurve) ControlPoints() *foundation.NSArray[*CHHapticParameterCurveControlPoint]
func (*CHHapticParameterCurve) InitWithParameterIDControlPointsRelativeTime ¶
func (o *CHHapticParameterCurve) InitWithParameterIDControlPointsRelativeTime(parameterID *foundation.NSString, controlPoints *foundation.NSArray[*CHHapticParameterCurveControlPoint], relativeTime float64) *CHHapticParameterCurve
@method initWithParameterID:controlPoints:relativeTime @abstract Initialize a CHHapticParameterCurve with a parameter ID, time, and an array of CHHapticParameterCurveControlPoint. @param parameterID The CHHapticDynamicParameterID for the desired parameter. @param controlPoints An array of CHHapticParameterCurveControlPoints. @param relativeTime The time at which this parameter curve should start, relative to the start time of the CHHapticPattern to which this parameter curve belongs.
func (*CHHapticParameterCurve) ParameterID ¶
func (o *CHHapticParameterCurve) ParameterID() *foundation.NSString
func (*CHHapticParameterCurve) RelativeTime ¶
func (o *CHHapticParameterCurve) RelativeTime() float64
func (*CHHapticParameterCurve) SetRelativeTime ¶
func (o *CHHapticParameterCurve) SetRelativeTime(relativeTime float64)
type CHHapticParameterCurveControlPoint ¶
type CHHapticParameterCurveControlPoint struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticparametercurvecontrolpoint
func CHHapticParameterCurveControlPointFromID ¶
func CHHapticParameterCurveControlPointFromID(id objc.ID) *CHHapticParameterCurveControlPoint
func (*CHHapticParameterCurveControlPoint) InitWithRelativeTimeValue ¶
func (o *CHHapticParameterCurveControlPoint) InitWithRelativeTimeValue(time_ float64, value float32) *CHHapticParameterCurveControlPoint
@method initWithRelativeTime:value @abstract Initialize a CHHapticParameterCurveControlPoint with a relative time and value. @param value The value of the associated parameter. @param time The time at which the associated parameter will reach this value, relative to the start time of the parameter curve.
func (*CHHapticParameterCurveControlPoint) RelativeTime ¶
func (o *CHHapticParameterCurveControlPoint) RelativeTime() float64
func (*CHHapticParameterCurveControlPoint) SetRelativeTime ¶
func (o *CHHapticParameterCurveControlPoint) SetRelativeTime(relativeTime float64)
func (*CHHapticParameterCurveControlPoint) SetValue ¶
func (o *CHHapticParameterCurveControlPoint) SetValue(value float32)
func (*CHHapticParameterCurveControlPoint) Value ¶
func (o *CHHapticParameterCurveControlPoint) Value() float32
type CHHapticPattern ¶
type CHHapticPattern struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/corehaptics/chhapticpattern
func CHHapticPatternFromID ¶
func CHHapticPatternFromID(id objc.ID) *CHHapticPattern
func (*CHHapticPattern) Duration ¶
func (o *CHHapticPattern) Duration() float64
@property duration Pattern duration is calculated as the start time of the pattern's last event or parameter, plus that event's duration if present.
func (*CHHapticPattern) ExportDictionaryAndReturnError ¶
func (o *CHHapticPattern) ExportDictionaryAndReturnError() (*foundation.NSDictionary[*foundation.NSString, objc.ID], error)
@method exportDictionaryAndReturnError:error @abstract Returns a NSDictionary representation of the contents of the pattern. @discussion Patterns containing custom audio resource IDs cannot be exported and will return nil with the error code set to CHHapticErrorCodeOperationNotPermitted.
func (*CHHapticPattern) InitWithContentsOfURLError ¶
func (o *CHHapticPattern) InitWithContentsOfURLError(ahapURL *foundation.NSURL) (*CHHapticPattern, error)
@method initWithContentsOfURL:error @abstract Initialize a new CHHapticPattern using the contents of the passed-in NSURL. @param ahapURL NSURL of an ahap file. @discussion This URL must reference a valid AHAP file.
func (*CHHapticPattern) InitWithDictionaryError ¶
func (o *CHHapticPattern) InitWithDictionaryError(patternDict *foundation.NSDictionary[*foundation.NSString, objc.ID]) (*CHHapticPattern, error)
@method initWithDictionary:error @abstract Initialize a new CHHapticPattern using the passed-in NSDictionary. @param patternDict NSDictionary containing a pattern property list.
func (*CHHapticPattern) InitWithEventsParameterCurvesError ¶
func (o *CHHapticPattern) InitWithEventsParameterCurvesError(events *foundation.NSArray[*CHHapticEvent], parameterCurves *foundation.NSArray[*CHHapticParameterCurve]) (*CHHapticPattern, error)
@method initWithEvents:parameterCurves:error @abstract Initialize a new CHHapticPattern with parameters modulated by parameter curves. @param events An NSArray of CHHapticEvents. Can be empty. @param parameterCurves An NSArray of CHHapticParameterCurves. Can be empty.
func (*CHHapticPattern) InitWithEventsParametersError ¶
func (o *CHHapticPattern) InitWithEventsParametersError(events *foundation.NSArray[*CHHapticEvent], parameters *foundation.NSArray[*CHHapticDynamicParameter]) (*CHHapticPattern, error)
@method initWithEvents:parameters:error @abstract Initialize a new CHHapticPattern. @param events An NSArray of CHHapticEvents. Can be empty. @param parameters An NSArray of CHHapticDynamicParameters. Can be empty.
type CHHapticPatternPlayer ¶
type CHHapticPatternPlayer interface {
StartAtTimeError(time_ float64) (bool, error)
StopAtTimeError(time_ float64) (bool, error)
SendParametersAtTimeError(parameters *foundation.NSArray[*CHHapticDynamicParameter], time_ float64) (bool, error)
ScheduleParameterCurveAtTimeError(parameterCurve *CHHapticParameterCurve, time_ float64) (bool, error)
CancelAndReturnError() (bool, error)
IsMuted() bool
SetIsMuted(isMuted bool)
}
CHHapticPatternPlayer wraps the ObjC protocol CHHapticPatternPlayer.
type Ptrauth_key ¶
type Ptrauth_key int64
const ( Ptrauth_key_none Ptrauth_key = -1 Ptrauth_key_asia Ptrauth_key = 0 Ptrauth_key_asib Ptrauth_key = 1 Ptrauth_key_asda Ptrauth_key = 2 Ptrauth_key_asdb Ptrauth_key = 3 Ptrauth_key_process_independent_code Ptrauth_key = 0 Ptrauth_key_process_dependent_code Ptrauth_key = 1 Ptrauth_key_process_independent_data Ptrauth_key = 2 Ptrauth_key_process_dependent_data Ptrauth_key = 3 Ptrauth_key_return_address Ptrauth_key = 1 Ptrauth_key_frame_pointer Ptrauth_key = 3 Ptrauth_key_function_pointer Ptrauth_key = 0 Ptrauth_key_block_function Ptrauth_key = 0 Ptrauth_key_cxx_vtable_pointer Ptrauth_key = 2 Ptrauth_key_method_list_pointer Ptrauth_key = 2 Ptrauth_key_objc_isa_pointer Ptrauth_key = 2 Ptrauth_key_objc_super_pointer Ptrauth_key = 2 Ptrauth_key_objc_sel_pointer Ptrauth_key = 3 Ptrauth_key_objc_class_ro_pointer Ptrauth_key = 2 Ptrauth_key_block_descriptor_pointer Ptrauth_key = 2 Ptrauth_key_init_fini_pointer Ptrauth_key = 0 )
func (Ptrauth_key) String ¶
func (e Ptrauth_key) String() string