objc2_core_haptics/generated/CHHapticParameter.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// Parameters used to modify individual haptic and/or audio events.
11///
12/// Event parameters are specified as part of the creation of a CHHapticEvent or in an event definition in a haptic pattern.
13/// The combination of Event parameters will determine the character of the haptic or audio event.
14///
15///
16/// The perceived intensity (volume) of a haptic event.
17/// Range: 0.0 (maximum attenuation) to 1.0 (no attenuation).
18///
19///
20/// Depending on the event's signal content, this may map to frequency, frequency content (i.e., filtering),
21/// or some other signal processing.
22/// Range: 0.0 (least sharp) to 1.0 (most sharp).
23///
24///
25/// The attack time adjuster for a Continuous event's envelope.
26/// Range: 0.0 to 1.0, with default: 0.0 (shortest attack time). Higher values increase the time exponentially.
27/// Not all event types respond to this parameter.
28///
29///
30/// The decay time adjuster for a Continuous event's envelope.
31/// Range: 0.0 to 1.0, with default: 0.0 (shortest decay time). Higher values increase the time exponentially.
32/// For envelope decay to take effect, the `CHHapticEventParameterIDSustained` parameter must be set to 0.0.
33/// Not all event types respond to this parameter.
34///
35///
36/// The release time adjuster for a Continuous event's envelope.
37/// Range: 0.0 to 1.0, with default: 0.0 (shortest release time). Higher values increase the time exponentially.
38/// Not all Continuous event types respond to this parameter.
39///
40///
41/// A boolean (1.0 or 0.0) which indicates whether a Continuous event sustains for its specified duration
42/// (using an Attack/Release envelope) or whether the event ends when its envelope decay segment reaches its minimum
43/// (i.e., using an Attack/Decay envelope with no sustain). Default: 1.0 (sustained, Attack/Release).
44///
45///
46/// The volume of an audio event.
47/// Range: 0.0 (maximum attenuation) to 1.0 (no attenuation).
48///
49///
50/// The pitch adjuster for audio events.
51/// Range: -1.0 (lowest pitch) to 1.0 (highest pitch).
52///
53///
54/// The stereo panning for an audio event.
55/// Range: -1.0 (panned full left) to 1.0 (panned full right). Default: 0.0 (panned center).
56///
57///
58/// The high frequency content an audio event.
59/// Range: 0.0 (frequency content reduced the most) to 1.0 (no reduction of frequency content). Default: 1.0.
60///
61/// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameterid?language=objc)
62// NS_TYPED_ENUM
63pub type CHHapticEventParameterID = NSString;
64
65extern "C" {
66 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridhapticintensity?language=objc)
67 pub static CHHapticEventParameterIDHapticIntensity: &'static CHHapticEventParameterID;
68}
69
70extern "C" {
71 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridhapticsharpness?language=objc)
72 pub static CHHapticEventParameterIDHapticSharpness: &'static CHHapticEventParameterID;
73}
74
75extern "C" {
76 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridattacktime?language=objc)
77 pub static CHHapticEventParameterIDAttackTime: &'static CHHapticEventParameterID;
78}
79
80extern "C" {
81 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteriddecaytime?language=objc)
82 pub static CHHapticEventParameterIDDecayTime: &'static CHHapticEventParameterID;
83}
84
85extern "C" {
86 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridreleasetime?language=objc)
87 pub static CHHapticEventParameterIDReleaseTime: &'static CHHapticEventParameterID;
88}
89
90extern "C" {
91 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridsustained?language=objc)
92 pub static CHHapticEventParameterIDSustained: &'static CHHapticEventParameterID;
93}
94
95extern "C" {
96 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiovolume?language=objc)
97 pub static CHHapticEventParameterIDAudioVolume: &'static CHHapticEventParameterID;
98}
99
100extern "C" {
101 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiopitch?language=objc)
102 pub static CHHapticEventParameterIDAudioPitch: &'static CHHapticEventParameterID;
103}
104
105extern "C" {
106 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiopan?language=objc)
107 pub static CHHapticEventParameterIDAudioPan: &'static CHHapticEventParameterID;
108}
109
110extern "C" {
111 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameteridaudiobrightness?language=objc)
112 pub static CHHapticEventParameterIDAudioBrightness: &'static CHHapticEventParameterID;
113}
114
115/// Parameters used to dynamically modify all haptic or audio events within a pattern.
116///
117/// Dynamic parameters are not tied to specific events; each dynamic parameter modifies (modulates) the
118/// effect of the corresponding event parameter for events which respond to the parameter.
119///
120/// The CHHapticDynamicParameterIDHaptic types only affect haptic event types, and the CHHapticDynamicParameterIDAudio
121/// types only affect audio event types. Not all CHHapticDynamicParameterIDs will have an effect on every CHHapticEventType.
122///
123///
124/// Adjusts the intensity of all active and future haptic events.
125/// Range: 0.0 (event intensities reduced by the maximum amount) to 1.0 (no effect on event intensities).
126/// Default: 1.0.
127///
128///
129/// This will adjust the frequency, frequency content (i.e., filtering), or other aspects of all active and future haptic events.
130/// Range: -1.0 (less sharp) to 1.0 (more sharp). Default: 0.0 (no effect).
131///
132///
133/// Adjusts the envelope attack time of all active and future haptic events.
134/// Range: -1.0 (event attacks shorter) to 1.0 (event attacks longer). Default: 0.0 (no effect).
135/// Not all haptic event types respond to this parameter.
136///
137///
138/// Adjusts the envelope decay time of all active and future Transient haptic events.
139/// Range: -1.0 (event decays shorter) to 1.0 (event decays longer). Default: 0.0 (no effect).
140/// Not all haptic event types respond to this parameter.
141///
142///
143/// Adjusts the envelope release time of all active and future Continuous haptic events.
144/// Range: -1.0 (event releases shorter) to 1.0 (event releases longer). Default: 0.0 (no effect).
145/// Not all haptic event types respond to this parameter.
146///
147///
148/// Adjusts the volume of all active and future audio events.
149/// Range: 0.0 (event intensities reduced by the maximum amount) to 1.0 (no effect).
150/// Default: 1.0.
151///
152///
153/// Adjusts the panning of all active and future audio events.
154/// Range: -1.0 (events panned more left) to 1.0 (event panned more right). Default: 0.0 (no effect).
155///
156///
157/// Adjusts the high frequency content of all active and future audio events.
158/// Range: -1.0 (more filtering) to 1.0 (less filtering). Default: 0.0 (no effect).
159///
160///
161/// Adjusts the transposition of the audio event.
162/// Range: -1.0 to 1.0. Negative values decrease pitch; positive values increase pitch.
163/// Default: 0.0 (no effect).
164///
165///
166/// Adjusts the envelope attack time of all active and future audio events.
167/// Range: -1.0 (event attacks shorter) to 1.0 (event attacks longer). Default: 0.0 (no effect).
168/// Not all audio event types respond to this parameter.
169///
170///
171/// Adjusts the envelope decay time of all active and future Transient audio events.
172/// Range: -1.0 (event decays shorter) to 1.0 (event decays longer). Default: 0.0 (no effect).
173/// Not all audio event types respond to this parameter.
174///
175///
176/// Adjusts the envelope release time of all active and future Continuous audio events.
177/// Range: -1.0 (event releases shorter) to 1.0 (event releases longer). Default: 0.0 (no effect).
178/// Not all audio event types respond to this parameter.
179///
180/// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameterid?language=objc)
181// NS_TYPED_ENUM
182pub type CHHapticDynamicParameterID = NSString;
183
184extern "C" {
185 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticintensitycontrol?language=objc)
186 pub static CHHapticDynamicParameterIDHapticIntensityControl:
187 &'static CHHapticDynamicParameterID;
188}
189
190extern "C" {
191 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticsharpnesscontrol?language=objc)
192 pub static CHHapticDynamicParameterIDHapticSharpnessControl:
193 &'static CHHapticDynamicParameterID;
194}
195
196extern "C" {
197 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticattacktimecontrol?language=objc)
198 pub static CHHapticDynamicParameterIDHapticAttackTimeControl:
199 &'static CHHapticDynamicParameterID;
200}
201
202extern "C" {
203 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticdecaytimecontrol?language=objc)
204 pub static CHHapticDynamicParameterIDHapticDecayTimeControl:
205 &'static CHHapticDynamicParameterID;
206}
207
208extern "C" {
209 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridhapticreleasetimecontrol?language=objc)
210 pub static CHHapticDynamicParameterIDHapticReleaseTimeControl:
211 &'static CHHapticDynamicParameterID;
212}
213
214extern "C" {
215 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiovolumecontrol?language=objc)
216 pub static CHHapticDynamicParameterIDAudioVolumeControl: &'static CHHapticDynamicParameterID;
217}
218
219extern "C" {
220 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiopancontrol?language=objc)
221 pub static CHHapticDynamicParameterIDAudioPanControl: &'static CHHapticDynamicParameterID;
222}
223
224extern "C" {
225 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiobrightnesscontrol?language=objc)
226 pub static CHHapticDynamicParameterIDAudioBrightnessControl:
227 &'static CHHapticDynamicParameterID;
228}
229
230extern "C" {
231 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiopitchcontrol?language=objc)
232 pub static CHHapticDynamicParameterIDAudioPitchControl: &'static CHHapticDynamicParameterID;
233}
234
235extern "C" {
236 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudioattacktimecontrol?language=objc)
237 pub static CHHapticDynamicParameterIDAudioAttackTimeControl:
238 &'static CHHapticDynamicParameterID;
239}
240
241extern "C" {
242 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudiodecaytimecontrol?language=objc)
243 pub static CHHapticDynamicParameterIDAudioDecayTimeControl: &'static CHHapticDynamicParameterID;
244}
245
246extern "C" {
247 /// [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameteridaudioreleasetimecontrol?language=objc)
248 pub static CHHapticDynamicParameterIDAudioReleaseTimeControl:
249 &'static CHHapticDynamicParameterID;
250}
251
252extern_class!(
253 /// A CHHapticEventParameter contains a CHHapticEventParameterID/value pair which helps determine the initial character
254 /// of a haptic or audio event.
255 ///
256 /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticeventparameter?language=objc)
257 #[unsafe(super(NSObject))]
258 #[derive(Debug, PartialEq, Eq, Hash)]
259 pub struct CHHapticEventParameter;
260);
261
262extern_conformance!(
263 unsafe impl NSObjectProtocol for CHHapticEventParameter {}
264);
265
266impl CHHapticEventParameter {
267 extern_methods!(
268 /// The ID of the event parameter to use.
269 #[unsafe(method(parameterID))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn parameterID(&self) -> Retained<CHHapticEventParameterID>;
272
273 /// The value of the event parameter.
274 #[unsafe(method(value))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn value(&self) -> c_float;
277
278 /// Setter for [`value`][Self::value].
279 #[unsafe(method(setValue:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn setValue(&self, value: c_float);
282
283 #[unsafe(method(init))]
284 #[unsafe(method_family = init)]
285 pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
286
287 #[unsafe(method(initWithParameterID:value:))]
288 #[unsafe(method_family = init)]
289 pub unsafe fn initWithParameterID_value(
290 this: Allocated<Self>,
291 parameter_id: &CHHapticEventParameterID,
292 value: c_float,
293 ) -> Retained<Self>;
294 );
295}
296
297/// Methods declared on superclass `NSObject`.
298impl CHHapticEventParameter {
299 extern_methods!(
300 #[unsafe(method(new))]
301 #[unsafe(method_family = new)]
302 pub unsafe fn new() -> Retained<Self>;
303 );
304}
305
306extern_class!(
307 /// A CHHapticDynamicParameter contains a CHHapticDynamicParameterID/value pair which will modify (modulate) the ongoing character
308 /// of a haptic or audio event.
309 ///
310 /// CHHapticDynamicParameters have a relative time property to allow specifying the time relationship between parameters in a pattern.
311 ///
312 /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdynamicparameter?language=objc)
313 #[unsafe(super(NSObject))]
314 #[derive(Debug, PartialEq, Eq, Hash)]
315 pub struct CHHapticDynamicParameter;
316);
317
318extern_conformance!(
319 unsafe impl NSObjectProtocol for CHHapticDynamicParameter {}
320);
321
322impl CHHapticDynamicParameter {
323 extern_methods!(
324 /// The ID of the dynamic parameter to use.
325 #[unsafe(method(parameterID))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn parameterID(&self) -> Retained<CHHapticDynamicParameterID>;
328
329 /// The value of the parameter.
330 #[unsafe(method(value))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn value(&self) -> c_float;
333
334 /// Setter for [`value`][Self::value].
335 #[unsafe(method(setValue:))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn setValue(&self, value: c_float);
338
339 /// The time at which the parameter should be applied, relative to the start time for the pattern.
340 #[unsafe(method(relativeTime))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn relativeTime(&self) -> NSTimeInterval;
343
344 /// Setter for [`relativeTime`][Self::relativeTime].
345 #[unsafe(method(setRelativeTime:))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);
348
349 #[unsafe(method(init))]
350 #[unsafe(method_family = init)]
351 pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
352
353 /// Initialize a CHHapticDynamicParameter with a parameter ID, value, and relative time.
354 ///
355 /// Parameter `parameterID`: The CHHapticDynamicParameterID for the desired parameter change.
356 ///
357 /// Parameter `value`: The value for that parameter.
358 ///
359 /// Parameter `time`: The time at which this parameter should be applied, relative to the start time of the pattern.
360 #[unsafe(method(initWithParameterID:value:relativeTime:))]
361 #[unsafe(method_family = init)]
362 pub unsafe fn initWithParameterID_value_relativeTime(
363 this: Allocated<Self>,
364 parameter_id: &CHHapticDynamicParameterID,
365 value: c_float,
366 time: NSTimeInterval,
367 ) -> Retained<Self>;
368 );
369}
370
371/// Methods declared on superclass `NSObject`.
372impl CHHapticDynamicParameter {
373 extern_methods!(
374 #[unsafe(method(new))]
375 #[unsafe(method_family = new)]
376 pub unsafe fn new() -> Retained<Self>;
377 );
378}
379
380extern_class!(
381 /// A CHHapticParameterCurveControlPoint contains a time/value pair for a single control point within a CHHapticParameterCurve.
382 ///
383 /// The relativeTime property specifies the amount of time elapsed since the start of the CHHapticParameterCurve before the
384 /// value is reached.
385 ///
386 /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparametercurvecontrolpoint?language=objc)
387 #[unsafe(super(NSObject))]
388 #[derive(Debug, PartialEq, Eq, Hash)]
389 pub struct CHHapticParameterCurveControlPoint;
390);
391
392extern_conformance!(
393 unsafe impl NSObjectProtocol for CHHapticParameterCurveControlPoint {}
394);
395
396impl CHHapticParameterCurveControlPoint {
397 extern_methods!(
398 #[unsafe(method(relativeTime))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn relativeTime(&self) -> NSTimeInterval;
401
402 /// Setter for [`relativeTime`][Self::relativeTime].
403 #[unsafe(method(setRelativeTime:))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);
406
407 #[unsafe(method(value))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn value(&self) -> c_float;
410
411 /// Setter for [`value`][Self::value].
412 #[unsafe(method(setValue:))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn setValue(&self, value: c_float);
415
416 #[unsafe(method(init))]
417 #[unsafe(method_family = init)]
418 pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
419
420 /// Initialize a CHHapticParameterCurveControlPoint with a relative time and value.
421 ///
422 /// Parameter `value`: The value of the associated parameter.
423 ///
424 /// Parameter `time`: The time at which the associated parameter will reach this value, relative to the start time of the parameter curve.
425 #[unsafe(method(initWithRelativeTime:value:))]
426 #[unsafe(method_family = init)]
427 pub unsafe fn initWithRelativeTime_value(
428 this: Allocated<Self>,
429 time: NSTimeInterval,
430 value: c_float,
431 ) -> Retained<Self>;
432 );
433}
434
435/// Methods declared on superclass `NSObject`.
436impl CHHapticParameterCurveControlPoint {
437 extern_methods!(
438 #[unsafe(method(new))]
439 #[unsafe(method_family = new)]
440 pub unsafe fn new() -> Retained<Self>;
441 );
442}
443
444extern_class!(
445 /// A CHHapticParameterCurve is a set of CHHapticParameterCurveControlPoints which describe the control (inflection) points
446 /// for the parameter values to be applied to the associated pattern.
447 ///
448 /// The CHHapticParameterCurve generates an interpolated value output which passed through each control point at its
449 /// associated relative time. These times will all be relative to the start time of the CHHapticParameterCurve within the
450 /// playing pattern.
451 ///
452 /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparametercurve?language=objc)
453 #[unsafe(super(NSObject))]
454 #[derive(Debug, PartialEq, Eq, Hash)]
455 pub struct CHHapticParameterCurve;
456);
457
458extern_conformance!(
459 unsafe impl NSObjectProtocol for CHHapticParameterCurve {}
460);
461
462impl CHHapticParameterCurve {
463 extern_methods!(
464 #[unsafe(method(parameterID))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn parameterID(&self) -> Retained<CHHapticDynamicParameterID>;
467
468 #[unsafe(method(relativeTime))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn relativeTime(&self) -> NSTimeInterval;
471
472 /// Setter for [`relativeTime`][Self::relativeTime].
473 #[unsafe(method(setRelativeTime:))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn setRelativeTime(&self, relative_time: NSTimeInterval);
476
477 #[unsafe(method(controlPoints))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn controlPoints(&self)
480 -> Retained<NSArray<CHHapticParameterCurveControlPoint>>;
481
482 #[unsafe(method(init))]
483 #[unsafe(method_family = init)]
484 pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
485
486 /// Initialize a CHHapticParameterCurve with a parameter ID, time, and an array of CHHapticParameterCurveControlPoint.
487 ///
488 /// Parameter `parameterID`: The CHHapticDynamicParameterID for the desired parameter.
489 ///
490 /// Parameter `controlPoints`: An array of CHHapticParameterCurveControlPoints.
491 ///
492 /// Parameter `relativeTime`: The time at which this parameter curve should start, relative to the start time of the CHHapticPattern to which this
493 /// parameter curve belongs.
494 #[unsafe(method(initWithParameterID:controlPoints:relativeTime:))]
495 #[unsafe(method_family = init)]
496 pub unsafe fn initWithParameterID_controlPoints_relativeTime(
497 this: Allocated<Self>,
498 parameter_id: &CHHapticDynamicParameterID,
499 control_points: &NSArray<CHHapticParameterCurveControlPoint>,
500 relative_time: NSTimeInterval,
501 ) -> Retained<Self>;
502 );
503}
504
505/// Methods declared on superclass `NSObject`.
506impl CHHapticParameterCurve {
507 extern_methods!(
508 #[unsafe(method(new))]
509 #[unsafe(method_family = new)]
510 pub unsafe fn new() -> Retained<Self>;
511 );
512}