objc2-core-haptics 0.3.2

Bindings to the CoreHaptics framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// Parameters used to modify individual haptic and/or audio events.
///
/// Event parameters are specified as part of the creation of a CHHapticEvent or in an event definition in a haptic pattern.
/// The combination of Event parameters will determine the character of the haptic or audio event.
///
///
/// The perceived intensity (volume) of a haptic event.
/// Range: 0.0 (maximum attenuation) to 1.0 (no attenuation).
///
///
/// Depending on the event's signal content, this may map to frequency, frequency content (i.e., filtering),
/// or some other signal processing.
/// Range: 0.0 (least sharp) to 1.0 (most sharp).
///
///
/// The attack time adjuster for a Continuous event's envelope.
/// Range: 0.0 to 1.0, with default: 0.0 (shortest attack time).  Higher values increase the time exponentially.
/// Not all event types respond to this parameter.
///
///
/// The decay time adjuster for a Continuous event's envelope.
/// Range: 0.0 to 1.0, with default: 0.0 (shortest decay time).  Higher values increase the time exponentially.
/// For envelope decay to take effect, the `CHHapticEventParameterIDSustained` parameter must be set to 0.0.
/// Not all event types respond to this parameter.
///
///
/// The release time adjuster for a Continuous event's envelope.
/// Range: 0.0 to 1.0, with default: 0.0 (shortest release time).  Higher values increase the time exponentially.
/// Not all Continuous event types respond to this parameter.
///
///
/// A boolean (1.0 or 0.0) which indicates whether a Continuous event sustains for its specified duration
/// (using an Attack/Release envelope) or whether the event ends when its envelope decay segment reaches its minimum
/// (i.e., using an Attack/Decay envelope with no sustain).  Default: 1.0 (sustained, Attack/Release).
///
///
/// The volume of an audio event.
/// Range: 0.0 (maximum attenuation) to 1.0 (no attenuation).
///
///
/// The pitch adjuster for audio events.
/// Range: -1.0 (lowest pitch) to 1.0 (highest pitch).
///
///
/// The stereo panning for an audio event.
/// Range: -1.0 (panned full left) to 1.0 (panned full right).  Default: 0.0 (panned center).
///
///
/// The high frequency content an audio event.
/// Range: 0.0 (frequency content reduced the most) to 1.0 (no reduction of frequency content).  Default: 1.0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameterid?language=objc)
// NS_TYPED_ENUM
pub type CHHapticEventParameterID = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridhapticintensity?language=objc)
    pub static CHHapticEventParameterIDHapticIntensity: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridhapticsharpness?language=objc)
    pub static CHHapticEventParameterIDHapticSharpness: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridattacktime?language=objc)
    pub static CHHapticEventParameterIDAttackTime: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteriddecaytime?language=objc)
    pub static CHHapticEventParameterIDDecayTime: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridreleasetime?language=objc)
    pub static CHHapticEventParameterIDReleaseTime: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridsustained?language=objc)
    pub static CHHapticEventParameterIDSustained: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiovolume?language=objc)
    pub static CHHapticEventParameterIDAudioVolume: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiopitch?language=objc)
    pub static CHHapticEventParameterIDAudioPitch: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiopan?language=objc)
    pub static CHHapticEventParameterIDAudioPan: &'static CHHapticEventParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiobrightness?language=objc)
    pub static CHHapticEventParameterIDAudioBrightness: &'static CHHapticEventParameterID;
}

/// Parameters used to dynamically modify all haptic or audio events within a pattern.
///
/// Dynamic parameters are not tied to specific events; each dynamic parameter modifies (modulates) the
/// effect of the corresponding event parameter for events which respond to the parameter.
///
/// The CHHapticDynamicParameterIDHaptic types only affect haptic event types, and the CHHapticDynamicParameterIDAudio
/// types only affect audio event types.  Not all CHHapticDynamicParameterIDs will have an effect on every CHHapticEventType.
///
///
/// Adjusts the intensity of all active and future haptic events.
/// Range: 0.0 (event intensities reduced by the maximum amount) to 1.0 (no effect on event intensities).
/// Default: 1.0.
///
///
/// This will adjust the frequency, frequency content (i.e., filtering), or other aspects of all active and future haptic events.
/// Range: -1.0 (less sharp) to 1.0 (more sharp).  Default: 0.0 (no effect).
///
///
/// Adjusts the envelope attack time of all active and future haptic events.
/// Range: -1.0 (event attacks shorter) to 1.0 (event attacks longer).  Default: 0.0 (no effect).
/// Not all haptic event types respond to this parameter.
///
///
/// Adjusts the envelope decay time of all active and future Transient haptic events.
/// Range: -1.0 (event decays shorter) to 1.0 (event decays longer).  Default: 0.0 (no effect).
/// Not all haptic event types respond to this parameter.
///
///
/// Adjusts the envelope release time of all active and future Continuous haptic events.
/// Range: -1.0 (event releases shorter) to 1.0 (event releases longer).  Default: 0.0 (no effect).
/// Not all haptic event types respond to this parameter.
///
///
/// Adjusts the volume of all active and future audio events.
/// Range: 0.0 (event intensities reduced by the maximum amount) to 1.0 (no effect).
/// Default: 1.0.
///
///
/// Adjusts the panning of all active and future audio events.
/// Range: -1.0 (events panned more left) to 1.0 (event panned more right).  Default: 0.0 (no effect).
///
///
/// Adjusts the high frequency content of all active and future audio events.
/// Range: -1.0 (more filtering) to 1.0 (less filtering).  Default: 0.0 (no effect).
///
///
/// Adjusts the transposition of the audio event.
/// Range: -1.0 to 1.0.  Negative values decrease pitch; positive values increase pitch.
/// Default: 0.0 (no effect).
///
///
/// Adjusts the envelope attack time of all active and future audio events.
/// Range: -1.0 (event attacks shorter) to 1.0 (event attacks longer).  Default: 0.0 (no effect).
/// Not all audio event types respond to this parameter.
///
///
/// Adjusts the envelope decay time of all active and future Transient audio events.
/// Range: -1.0 (event decays shorter) to 1.0 (event decays longer).  Default: 0.0 (no effect).
/// Not all audio event types respond to this parameter.
///
///
/// Adjusts the envelope release time of all active and future Continuous audio events.
/// Range: -1.0 (event releases shorter) to 1.0 (event releases longer).  Default: 0.0 (no effect).
/// Not all audio event types respond to this parameter.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameterid?language=objc)
// NS_TYPED_ENUM
pub type CHHapticDynamicParameterID = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticintensitycontrol?language=objc)
    pub static CHHapticDynamicParameterIDHapticIntensityControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticsharpnesscontrol?language=objc)
    pub static CHHapticDynamicParameterIDHapticSharpnessControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticattacktimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDHapticAttackTimeControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticdecaytimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDHapticDecayTimeControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticreleasetimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDHapticReleaseTimeControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiovolumecontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioVolumeControl: &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiopancontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioPanControl: &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiobrightnesscontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioBrightnessControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiopitchcontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioPitchControl: &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudioattacktimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioAttackTimeControl:
        &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiodecaytimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioDecayTimeControl: &'static CHHapticDynamicParameterID;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudioreleasetimecontrol?language=objc)
    pub static CHHapticDynamicParameterIDAudioReleaseTimeControl:
        &'static CHHapticDynamicParameterID;
}

extern_class!(
    /// A CHHapticEventParameter contains a CHHapticEventParameterID/value pair which helps determine the initial character
    /// of a haptic or audio event.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameter?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CHHapticEventParameter;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CHHapticEventParameter {}
);

impl CHHapticEventParameter {
    extern_methods!(
        /// The ID of the event parameter to use.
        #[unsafe(method(parameterID))]
        #[unsafe(method_family = none)]
        pub unsafe fn parameterID(&self) -> Retained<CHHapticEventParameterID>;

        /// The value of the event parameter.
        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> c_float;

        /// Setter for [`value`][Self::value].
        #[unsafe(method(setValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue(&self, value: c_float);

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

        #[unsafe(method(initWithParameterID:value:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithParameterID_value(
            this: Allocated<Self>,
            parameter_id: &CHHapticEventParameterID,
            value: c_float,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CHHapticEventParameter {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// A CHHapticDynamicParameter contains a CHHapticDynamicParameterID/value pair which will modify (modulate) the ongoing character
    /// of a haptic or audio event.
    ///
    /// CHHapticDynamicParameters have a relative time property to allow specifying the time relationship between parameters in a pattern.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameter?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CHHapticDynamicParameter;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CHHapticDynamicParameter {}
);

impl CHHapticDynamicParameter {
    extern_methods!(
        /// The ID of the dynamic parameter to use.
        #[unsafe(method(parameterID))]
        #[unsafe(method_family = none)]
        pub unsafe fn parameterID(&self) -> Retained<CHHapticDynamicParameterID>;

        /// The value of the parameter.
        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> c_float;

        /// Setter for [`value`][Self::value].
        #[unsafe(method(setValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue(&self, value: c_float);

        /// The time at which the parameter should be applied, relative to the start time for the pattern.
        #[unsafe(method(relativeTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn relativeTime(&self) -> NSTimeInterval;

        /// Setter for [`relativeTime`][Self::relativeTime].
        #[unsafe(method(setRelativeTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

        /// Initialize a CHHapticDynamicParameter with a parameter ID, value, and relative time.
        ///
        /// Parameter `parameterID`: The CHHapticDynamicParameterID for the desired parameter change.
        ///
        /// Parameter `value`: The value for that parameter.
        ///
        /// Parameter `time`: The time at which this parameter should be applied, relative to the start time of the pattern.
        #[unsafe(method(initWithParameterID:value:relativeTime:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithParameterID_value_relativeTime(
            this: Allocated<Self>,
            parameter_id: &CHHapticDynamicParameterID,
            value: c_float,
            time: NSTimeInterval,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CHHapticDynamicParameter {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// A CHHapticParameterCurveControlPoint contains a time/value pair for a single control point within a CHHapticParameterCurve.
    ///
    /// The relativeTime property specifies the amount of time elapsed since the start of the CHHapticParameterCurve before the
    /// value is reached.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparametercurvecontrolpoint?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CHHapticParameterCurveControlPoint;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CHHapticParameterCurveControlPoint {}
);

impl CHHapticParameterCurveControlPoint {
    extern_methods!(
        #[unsafe(method(relativeTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn relativeTime(&self) -> NSTimeInterval;

        /// Setter for [`relativeTime`][Self::relativeTime].
        #[unsafe(method(setRelativeTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);

        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> c_float;

        /// Setter for [`value`][Self::value].
        #[unsafe(method(setValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue(&self, value: c_float);

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

        /// Initialize a CHHapticParameterCurveControlPoint with a relative time and value.
        ///
        /// Parameter `value`: The value of the associated parameter.
        ///
        /// Parameter `time`: The time at which the associated parameter will reach this value, relative to the start time of the parameter curve.
        #[unsafe(method(initWithRelativeTime:value:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRelativeTime_value(
            this: Allocated<Self>,
            time: NSTimeInterval,
            value: c_float,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CHHapticParameterCurveControlPoint {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// A CHHapticParameterCurve is a set of CHHapticParameterCurveControlPoints which describe the control (inflection) points
    /// for the parameter values to be applied to the associated pattern.
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparametercurve?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CHHapticParameterCurve;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CHHapticParameterCurve {}
);

impl CHHapticParameterCurve {
    extern_methods!(
        #[unsafe(method(parameterID))]
        #[unsafe(method_family = none)]
        pub unsafe fn parameterID(&self) -> Retained<CHHapticDynamicParameterID>;

        #[unsafe(method(relativeTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn relativeTime(&self) -> NSTimeInterval;

        /// Setter for [`relativeTime`][Self::relativeTime].
        #[unsafe(method(setRelativeTime:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);

        #[unsafe(method(controlPoints))]
        #[unsafe(method_family = none)]
        pub unsafe fn controlPoints(&self)
            -> Retained<NSArray<CHHapticParameterCurveControlPoint>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

        /// Initialize a CHHapticParameterCurve with a parameter ID, time, and an array of CHHapticParameterCurveControlPoint.
        ///
        /// Parameter `parameterID`: The CHHapticDynamicParameterID for the desired parameter.
        ///
        /// Parameter `controlPoints`: An array of CHHapticParameterCurveControlPoints.
        ///
        /// Parameter `relativeTime`: The time at which this parameter curve should start, relative to the start time of the CHHapticPattern to which this
        /// parameter curve belongs.
        #[unsafe(method(initWithParameterID:controlPoints:relativeTime:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithParameterID_controlPoints_relativeTime(
            this: Allocated<Self>,
            parameter_id: &CHHapticDynamicParameterID,
            control_points: &NSArray<CHHapticParameterCurveControlPoint>,
            relative_time: NSTimeInterval,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CHHapticParameterCurve {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}