objc2_phase/generated/PHASEDucker.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
10extern_class!(
11 /// *************************************************************************************************
12 ///
13 ///
14 ///
15 /// A PHASEDucker is used to describe ducking behavior across different groups.
16 ///
17 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseducker?language=objc)
18 #[unsafe(super(NSObject))]
19 #[derive(Debug, PartialEq, Eq, Hash)]
20 pub struct PHASEDucker;
21);
22
23extern_conformance!(
24 unsafe impl NSObjectProtocol for PHASEDucker {}
25);
26
27impl PHASEDucker {
28 extern_methods!(
29 #[unsafe(method(init))]
30 #[unsafe(method_family = init)]
31 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
32
33 #[unsafe(method(new))]
34 #[unsafe(method_family = new)]
35 pub unsafe fn new() -> Retained<Self>;
36
37 #[cfg(all(
38 feature = "PHASEEngine",
39 feature = "PHASEGroup",
40 feature = "PHASETypes"
41 ))]
42 /// Whenever a generator node from any source group plays, all the generator nodes in the target groups will be
43 /// ducked by the given gain using the given attack and release times.
44 ///
45 /// Note: The ducker is initialially inactive. The client must call activate() to make it active.
46 /// Once a ducker is active, it will listen for generator nodes to start playback in source groups. Once triggered, it will duck its target groups.
47 /// Deactivating a ducker will make it stop listening. Furthermore, it will enter the release phase if it has been previously triggered.
48 /// Dealloc'ing a ducker will force the ducker into its release phase if it is actively ducking and remove it from the system when it finishes.
49 ///
50 /// Parameter `engine`: The engine to register this ducker with.
51 ///
52 /// Parameter `sourceGroups`: The source groups that will trigger the ducker when a sound in one of the source groups starts playback.
53 ///
54 /// Parameter `targetGroups`: The target groups that will be ducked when a sound in one of the source groups triggers the ducker.
55 ///
56 /// Parameter `gain`: The linear gain scalar to apply when the ducker is engaged. 0 means full attenuation. 1 is no attenuation. Values are clamped to the range [0, 1].
57 ///
58 /// Parameter `attackTime`: The time for the attenuation gain to ramp into effect.
59 /// This value is scaled by unitsPerSecond internally, so can be provided at the client's native time scale.
60 ///
61 /// Parameter `releaseTime`: The time for the ducked sounds to ramp back to their original level.
62 /// This value is scaled by unitsPerSecond internally, so can be provided at the client's native time scale.
63 ///
64 /// Parameter `attackCurve`: The type of curve function to use during the attack phase of gain reduction.
65 ///
66 /// Parameter `releaseCurve`: The type of curve function to use during the release phase of gain reduction.
67 #[unsafe(method(initWithEngine:sourceGroups:targetGroups:gain:attackTime:releaseTime:attackCurve:releaseCurve:))]
68 #[unsafe(method_family = init)]
69 pub unsafe fn initWithEngine_sourceGroups_targetGroups_gain_attackTime_releaseTime_attackCurve_releaseCurve(
70 this: Allocated<Self>,
71 engine: &PHASEEngine,
72 source_groups: &NSSet<PHASEGroup>,
73 target_groups: &NSSet<PHASEGroup>,
74 gain: c_double,
75 attack_time: c_double,
76 release_time: c_double,
77 attack_curve: PHASECurveType,
78 release_curve: PHASECurveType,
79 ) -> Retained<Self>;
80
81 /// Activates the ducker
82 #[unsafe(method(activate))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn activate(&self);
85
86 /// Deactivates the ducker
87 #[unsafe(method(deactivate))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn deactivate(&self);
90
91 #[cfg(feature = "PHASEGroup")]
92 /// The source groups that will trigger the ducker when a sound in one of the source groups starts playback.
93 #[unsafe(method(sourceGroups))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn sourceGroups(&self) -> Retained<NSSet<PHASEGroup>>;
96
97 #[cfg(feature = "PHASEGroup")]
98 /// The target groups that will be ducked when a sound in one of the source groups triggers the ducker.
99 #[unsafe(method(targetGroups))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn targetGroups(&self) -> Retained<NSSet<PHASEGroup>>;
102
103 /// YES if the ducker is active; otherwise, NO.
104 #[unsafe(method(isActive))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn isActive(&self) -> bool;
107
108 /// Linear gain scalar.
109 ///
110 /// Note: Values are clamped to the range [0, 1]. Default value is 1.
111 #[unsafe(method(gain))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn gain(&self) -> c_double;
114
115 /// The time for the attenuation gain to ramp into effect.
116 ///
117 /// Note: The attack time is scaled by unitsPerSecond internally, so can be provided at the client's native time scale.
118 #[unsafe(method(attackTime))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn attackTime(&self) -> c_double;
121
122 /// The time for the ducked sounds to ramp back to their original level.
123 ///
124 /// Note: The release time is scaled by unitsPerSecond internally, so can be provided at the client's native time scale.
125 #[unsafe(method(releaseTime))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn releaseTime(&self) -> c_double;
128
129 #[cfg(feature = "PHASETypes")]
130 /// The type of curve function to use during the attack phase of gain reduction.
131 #[unsafe(method(attackCurve))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn attackCurve(&self) -> PHASECurveType;
134
135 #[cfg(feature = "PHASETypes")]
136 /// The type of curve function to use during the release phase of gain reduction.
137 #[unsafe(method(releaseCurve))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn releaseCurve(&self) -> PHASECurveType;
140
141 /// The identifier that uniquely represents this ducker.
142 #[unsafe(method(identifier))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn identifier(&self) -> Retained<NSString>;
145 );
146}