objc2_phase/generated/PHASEEngine.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::*;
6#[cfg(feature = "objc2-avf-audio")]
7use objc2_avf_audio::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13 /// *************************************************************************************************
14 ///
15 ///
16 ///
17 /// PHASE engine instance.
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseengine?language=objc)
20 #[unsafe(super(NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 pub struct PHASEEngine;
23);
24
25extern_conformance!(
26 unsafe impl NSObjectProtocol for PHASEEngine {}
27);
28
29impl PHASEEngine {
30 extern_methods!(
31 #[unsafe(method(init))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35 #[unsafe(method(new))]
36 #[unsafe(method_family = new)]
37 pub unsafe fn new() -> Retained<Self>;
38
39 #[cfg(feature = "PHASETypes")]
40 /// Initialize a new engine with an update mode.
41 ///
42 /// Parameter `updateMode`: Defines how the engine will be updated.
43 #[unsafe(method(initWithUpdateMode:))]
44 #[unsafe(method_family = init)]
45 pub unsafe fn initWithUpdateMode(
46 this: Allocated<Self>,
47 update_mode: PHASEUpdateMode,
48 ) -> Retained<Self>;
49
50 #[cfg(feature = "PHASETypes")]
51 /// Initialize a new engine with an update mode.
52 ///
53 /// Parameter `updateMode`: Defines how the engine will be updated.
54 ///
55 /// Parameter `renderingMode`: Defines where the engine applies rendering. See PHASERenderingMode for more info.
56 #[unsafe(method(initWithUpdateMode:renderingMode:))]
57 #[unsafe(method_family = init)]
58 pub unsafe fn initWithUpdateMode_renderingMode(
59 this: Allocated<Self>,
60 update_mode: PHASEUpdateMode,
61 rendering_mode: PHASERenderingMode,
62 ) -> Retained<Self>;
63
64 /// Start or resume the engine.
65 ///
66 /// Returns: YES for success.
67 #[unsafe(method(startAndReturnError:_))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn startAndReturnError(&self) -> Result<(), Retained<NSError>>;
70
71 /// Pause the engine.
72 #[unsafe(method(pause))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn pause(&self);
75
76 /// Stop the engine.
77 #[unsafe(method(stop))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn stop(&self);
80
81 /// Manually update the engine instance on the calling thread.
82 ///
83 /// This will kick off all of the API commands called since the last call to update,
84 /// update any systems and objects that need to be kept current, and call any registered handlers.
85 ///
86 /// Note: This function has no effect if the engine's update mode is PHASEUpdateModeAutomatic.
87 #[unsafe(method(update))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn update(&self);
90
91 #[cfg(feature = "PHASETypes")]
92 /// When set to a value other than PHASESpatializationModeAutomatic,
93 /// overrides the default output spatializer and uses the specified one instead.
94 #[unsafe(method(outputSpatializationMode))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn outputSpatializationMode(&self) -> PHASESpatializationMode;
97
98 #[cfg(feature = "PHASETypes")]
99 /// Setter for [`outputSpatializationMode`][Self::outputSpatializationMode].
100 #[unsafe(method(setOutputSpatializationMode:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setOutputSpatializationMode(
103 &self,
104 output_spatialization_mode: PHASESpatializationMode,
105 );
106
107 #[cfg(feature = "PHASETypes")]
108 /// The engine's current rendering state.
109 #[unsafe(method(renderingState))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn renderingState(&self) -> PHASERenderingState;
112
113 #[cfg(feature = "PHASEObject")]
114 /// The root object of the engine's scene graph.
115 ///
116 /// Attach objects to the engine's rootObject or one of its children to make them active within the engine's scene graph.
117 /// This will ensure they take part in the simulation.
118 ///
119 /// Note: The rootObject is created and owned by the engine.
120 /// The rootObject may not be set as the child of another object. This will cause an error to be thrown.
121 /// The rootObject's transform may not be changed. This will cause an error to be thrown.
122 /// The rootObject may not be copied. This will cause an error to be thrown.
123 #[unsafe(method(rootObject))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn rootObject(&self) -> Retained<PHASEObject>;
126
127 #[cfg(feature = "PHASEMedium")]
128 /// The default medium in the engine.
129 ///
130 /// The default value is PHASEMediumPresetAir.
131 #[unsafe(method(defaultMedium))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn defaultMedium(&self) -> Retained<PHASEMedium>;
134
135 #[cfg(feature = "PHASEMedium")]
136 /// Setter for [`defaultMedium`][Self::defaultMedium].
137 #[unsafe(method(setDefaultMedium:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn setDefaultMedium(&self, default_medium: &PHASEMedium);
140
141 #[cfg(feature = "PHASETypes")]
142 /// The default reverb preset in the engine.
143 ///
144 /// The default value is PHASEReverbPresetNone.
145 #[unsafe(method(defaultReverbPreset))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn defaultReverbPreset(&self) -> PHASEReverbPreset;
148
149 #[cfg(feature = "PHASETypes")]
150 /// Setter for [`defaultReverbPreset`][Self::defaultReverbPreset].
151 #[unsafe(method(setDefaultReverbPreset:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn setDefaultReverbPreset(&self, default_reverb_preset: PHASEReverbPreset);
154
155 /// The number of units in a second.
156 ///
157 /// The unitsPerSecond is used internally to scale time/duration values passed to the API.
158 /// This allows clients to pass time/duration values in their own native time scale.
159 ///
160 /// Note: Values are clamped to the range (0, inf]. Default value is 1.
161 #[unsafe(method(unitsPerSecond))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn unitsPerSecond(&self) -> c_double;
164
165 /// Setter for [`unitsPerSecond`][Self::unitsPerSecond].
166 #[unsafe(method(setUnitsPerSecond:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn setUnitsPerSecond(&self, units_per_second: c_double);
169
170 /// The number of units in a meter.
171 ///
172 /// The unitsPerMeter is used internally to scale metric values passed to the API.
173 /// This allows clients to pass metric values in their own native spatial scale.
174 ///
175 /// Note: Values are clamped to the range (0, inf]. Default value is 1.
176 #[unsafe(method(unitsPerMeter))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn unitsPerMeter(&self) -> c_double;
179
180 /// Setter for [`unitsPerMeter`][Self::unitsPerMeter].
181 #[unsafe(method(setUnitsPerMeter:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn setUnitsPerMeter(&self, units_per_meter: c_double);
184
185 #[cfg(feature = "PHASEAssetRegistry")]
186 /// A registry for assets available to the engine
187 #[unsafe(method(assetRegistry))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn assetRegistry(&self) -> Retained<PHASEAssetRegistry>;
190
191 #[cfg(feature = "PHASESoundEvent")]
192 /// An array of the active sound event objects in the system
193 ///
194 /// Returns a dictionary of the sound events at the time it is retrieved. This includes all sound events that are registered with the engine, including those that are preparing, playing, paused or stopping.
195 #[unsafe(method(soundEvents))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn soundEvents(&self) -> Retained<NSArray<PHASESoundEvent>>;
198
199 #[cfg(feature = "PHASEGroup")]
200 /// A dictionary of the groups in the system
201 ///
202 /// Returns a dictionary of the groups at the time it is retrieved.
203 #[unsafe(method(groups))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn groups(&self) -> Retained<NSDictionary<NSString, PHASEGroup>>;
206
207 #[cfg(feature = "PHASEDucker")]
208 /// An array of the ducker objects in the system
209 ///
210 /// Returns a dictionary of the ducker objects at the time it is retrieved.
211 #[unsafe(method(duckers))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn duckers(&self) -> Retained<NSArray<PHASEDucker>>;
214
215 #[cfg(feature = "PHASEGroupPreset")]
216 /// The active group mixer preset in the system
217 ///
218 /// Returns nil if there are no active group presets in the engine. Activate or Deactivate the preset via [PHASEGroupPreset activate] and [PHASEGroupPreset deactivate]
219 #[unsafe(method(activeGroupPreset))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn activeGroupPreset(&self) -> Option<Retained<PHASEGroupPreset>>;
222
223 #[cfg(feature = "objc2-avf-audio")]
224 /// Obtain the time for which the engine most recently rendered.
225 ///
226 /// Will return nil if the engine is not running
227 #[unsafe(method(lastRenderTime))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn lastRenderTime(&self) -> Option<Retained<AVAudioTime>>;
230 );
231}