objc2_phase/generated/PHASESoundEventNodes.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::*;
8#[cfg(feature = "objc2-core-audio-types")]
9use objc2_core_audio_types::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14/// *************************************************************************************************
15///
16///
17///
18/// Options controlling buffer scheduling.
19///
20/// The buffer plays following any previously scheduled buffer(s).
21///
22/// The buffer loops indefinitely.
23///
24/// The buffer interrupts any buffer already playing.
25///
26/// The buffer interrupts any buffer already playing, at its loop point.
27///
28/// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepushstreambufferoptions?language=objc)
29// NS_OPTIONS
30#[repr(transparent)]
31#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
32pub struct PHASEPushStreamBufferOptions(pub NSUInteger);
33bitflags::bitflags! {
34 impl PHASEPushStreamBufferOptions: NSUInteger {
35 #[doc(alias = "PHASEPushStreamBufferDefault")]
36 const Default = 1<<0;
37 #[doc(alias = "PHASEPushStreamBufferLoops")]
38 const Loops = 1<<1;
39 #[doc(alias = "PHASEPushStreamBufferInterrupts")]
40 const Interrupts = 1<<2;
41 #[doc(alias = "PHASEPushStreamBufferInterruptsAtLoop")]
42 const InterruptsAtLoop = 1<<3;
43 }
44}
45
46unsafe impl Encode for PHASEPushStreamBufferOptions {
47 const ENCODING: Encoding = NSUInteger::ENCODING;
48}
49
50unsafe impl RefEncode for PHASEPushStreamBufferOptions {
51 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54/// Specifies when the completion handler must be invoked.
55///
56/// The buffer data has been rendered by the player.
57/// This does not account for any signal processing latencies downstream of the player in the engine.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepushstreamcompletioncallbackcondition?language=objc)
60// NS_ENUM
61#[repr(transparent)]
62#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
63pub struct PHASEPushStreamCompletionCallbackCondition(pub NSInteger);
64impl PHASEPushStreamCompletionCallbackCondition {
65 #[doc(alias = "PHASEPushStreamCompletionDataRendered")]
66 pub const DataRendered: Self = Self(0);
67}
68
69unsafe impl Encode for PHASEPushStreamCompletionCallbackCondition {
70 const ENCODING: Encoding = NSInteger::ENCODING;
71}
72
73unsafe impl RefEncode for PHASEPushStreamCompletionCallbackCondition {
74 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
75}
76
77extern_class!(
78 /// *************************************************************************************************
79 ///
80 ///
81 ///
82 /// The base class for a sound event node definition.
83 ///
84 /// Sound event nodes are a hierarchical collection of objects that either generate or control playback of audio content in PHASE.
85 /// Generator nodes produce audio. They are always leaf nodes in a node hierarchy. These include samplers and stream nodes.
86 /// Control nodes set the logic for how generator nodes are selected, mixed and parameterized before downstream mixer processing.
87 /// Control nodes are always parent nodes, and can be organized into hierarchies for complex sound design scenarios.
88 ///
89 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasesoundeventnodedefinition?language=objc)
90 #[unsafe(super(PHASEDefinition, NSObject))]
91 #[derive(Debug, PartialEq, Eq, Hash)]
92 #[cfg(feature = "PHASEDefinition")]
93 pub struct PHASESoundEventNodeDefinition;
94);
95
96#[cfg(feature = "PHASEDefinition")]
97extern_conformance!(
98 unsafe impl NSObjectProtocol for PHASESoundEventNodeDefinition {}
99);
100
101#[cfg(feature = "PHASEDefinition")]
102impl PHASESoundEventNodeDefinition {
103 extern_methods!(
104 #[unsafe(method(init))]
105 #[unsafe(method_family = init)]
106 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108 #[unsafe(method(new))]
109 #[unsafe(method_family = new)]
110 pub unsafe fn new() -> Retained<Self>;
111
112 /// The children of this node definition.
113 #[unsafe(method(children))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn children(&self) -> Retained<NSArray<PHASESoundEventNodeDefinition>>;
116 );
117}
118
119extern_class!(
120 /// *************************************************************************************************
121 ///
122 ///
123 ///
124 /// An object for defining a generator node when building a sound event.
125 ///
126 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasegeneratornodedefinition?language=objc)
127 #[unsafe(super(PHASESoundEventNodeDefinition, PHASEDefinition, NSObject))]
128 #[derive(Debug, PartialEq, Eq, Hash)]
129 #[cfg(feature = "PHASEDefinition")]
130 pub struct PHASEGeneratorNodeDefinition;
131);
132
133#[cfg(feature = "PHASEDefinition")]
134extern_conformance!(
135 unsafe impl NSObjectProtocol for PHASEGeneratorNodeDefinition {}
136);
137
138#[cfg(feature = "PHASEDefinition")]
139impl PHASEGeneratorNodeDefinition {
140 extern_methods!(
141 #[unsafe(method(init))]
142 #[unsafe(method_family = init)]
143 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144
145 #[unsafe(method(new))]
146 #[unsafe(method_family = new)]
147 pub unsafe fn new() -> Retained<Self>;
148
149 #[cfg(feature = "PHASETypes")]
150 /// Set the generator's calibration mode and level.
151 ///
152 /// Parameter `calibrationMode`: The calibration mode.
153 ///
154 /// Parameter `level`: The level.
155 ///
156 /// Note: The level, including its underlying unit and range, are dependent on the calibration mode.
157 #[unsafe(method(setCalibrationMode:level:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setCalibrationMode_level(
160 &self,
161 calibration_mode: PHASECalibrationMode,
162 level: c_double,
163 );
164
165 #[cfg(feature = "PHASETypes")]
166 /// The generator's calibration mode. The default value is PHASECalibrationModeNone.
167 #[unsafe(method(calibrationMode))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn calibrationMode(&self) -> PHASECalibrationMode;
170
171 /// The generator's level. The default value is 1.
172 ///
173 /// Note: The level's underlying unit and range are dependent on the calibrationMode.
174 #[unsafe(method(level))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn level(&self) -> c_double;
177
178 /// Linear rate scalar.
179 ///
180 /// Note: Values are clamped to the range [0.25, 4]. Default value is 1.
181 #[unsafe(method(rate))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn rate(&self) -> c_double;
184
185 /// Setter for [`rate`][Self::rate].
186 #[unsafe(method(setRate:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn setRate(&self, rate: c_double);
189
190 #[cfg(feature = "PHASEGroup")]
191 /// The PHASEGroup object this generator should be associated with for gain and rate control.
192 #[unsafe(method(group))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn group(&self) -> Option<Retained<PHASEGroup>>;
195
196 #[cfg(feature = "PHASEGroup")]
197 /// Setter for [`group`][Self::group].
198 ///
199 /// This is a [weak property][objc2::topics::weak_property].
200 #[unsafe(method(setGroup:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn setGroup(&self, group: Option<&PHASEGroup>);
203
204 #[cfg(feature = "PHASEMetaParameter")]
205 /// Optionally attach a metaparameter definition here to enable dynamic control of the gain during playback.
206 #[unsafe(method(gainMetaParameterDefinition))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn gainMetaParameterDefinition(
209 &self,
210 ) -> Option<Retained<PHASENumberMetaParameterDefinition>>;
211
212 #[cfg(feature = "PHASEMetaParameter")]
213 /// Setter for [`gainMetaParameterDefinition`][Self::gainMetaParameterDefinition].
214 #[unsafe(method(setGainMetaParameterDefinition:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn setGainMetaParameterDefinition(
217 &self,
218 gain_meta_parameter_definition: Option<&PHASENumberMetaParameterDefinition>,
219 );
220
221 #[cfg(feature = "PHASEMetaParameter")]
222 /// Optionally attach a metaparameter definition here to enable dynamic control of the rate during playback.
223 #[unsafe(method(rateMetaParameterDefinition))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn rateMetaParameterDefinition(
226 &self,
227 ) -> Option<Retained<PHASENumberMetaParameterDefinition>>;
228
229 #[cfg(feature = "PHASEMetaParameter")]
230 /// Setter for [`rateMetaParameterDefinition`][Self::rateMetaParameterDefinition].
231 #[unsafe(method(setRateMetaParameterDefinition:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setRateMetaParameterDefinition(
234 &self,
235 rate_meta_parameter_definition: Option<&PHASENumberMetaParameterDefinition>,
236 );
237
238 #[cfg(feature = "PHASEMixer")]
239 /// The readonly property that returns the PHASEMixerDefinition this generator was created with and assigned to.
240 #[unsafe(method(mixerDefinition))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn mixerDefinition(&self) -> Retained<PHASEMixerDefinition>;
243 );
244}
245
246extern_class!(
247 /// *************************************************************************************************
248 ///
249 ///
250 ///
251 /// Sampler node definition.
252 ///
253 /// Sampler nodes play back registered sound assets.
254 ///
255 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasesamplernodedefinition?language=objc)
256 #[unsafe(super(
257 PHASEGeneratorNodeDefinition,
258 PHASESoundEventNodeDefinition,
259 PHASEDefinition,
260 NSObject
261 ))]
262 #[derive(Debug, PartialEq, Eq, Hash)]
263 #[cfg(feature = "PHASEDefinition")]
264 pub struct PHASESamplerNodeDefinition;
265);
266
267#[cfg(feature = "PHASEDefinition")]
268extern_conformance!(
269 unsafe impl NSObjectProtocol for PHASESamplerNodeDefinition {}
270);
271
272#[cfg(feature = "PHASEDefinition")]
273impl PHASESamplerNodeDefinition {
274 extern_methods!(
275 #[unsafe(method(init))]
276 #[unsafe(method_family = init)]
277 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
278
279 #[unsafe(method(new))]
280 #[unsafe(method_family = new)]
281 pub unsafe fn new() -> Retained<Self>;
282
283 #[cfg(feature = "PHASEMixer")]
284 /// Create a sampler node definition
285 ///
286 /// Parameter `soundAssetIdentifier`: The identifier of the registered sound asset this sampler will play
287 ///
288 /// Parameter `mixerDefinition`: The mixer definition this sampler will be assigned to
289 ///
290 /// Parameter `identifier`: An optional custom identifier to give to this object
291 ///
292 /// Returns: A new PHASESamplerNodeDefinition object
293 #[unsafe(method(initWithSoundAssetIdentifier:mixerDefinition:identifier:))]
294 #[unsafe(method_family = init)]
295 pub unsafe fn initWithSoundAssetIdentifier_mixerDefinition_identifier(
296 this: Allocated<Self>,
297 sound_asset_identifier: &NSString,
298 mixer_definition: &PHASEMixerDefinition,
299 identifier: &NSString,
300 ) -> Retained<Self>;
301
302 #[cfg(feature = "PHASEMixer")]
303 /// Create a sampler node definition
304 ///
305 /// Parameter `soundAssetIdentifier`: The identifier of the registered sound asset this sampler will play
306 ///
307 /// Parameter `mixerDefinition`: The mixer definition this sampler will be assigned to
308 ///
309 /// Returns: A new PHASESamplerNodeDefinition object
310 #[unsafe(method(initWithSoundAssetIdentifier:mixerDefinition:))]
311 #[unsafe(method_family = init)]
312 pub unsafe fn initWithSoundAssetIdentifier_mixerDefinition(
313 this: Allocated<Self>,
314 sound_asset_identifier: &NSString,
315 mixer_definition: &PHASEMixerDefinition,
316 ) -> Retained<Self>;
317
318 /// The identifier that uniquely represents the registered sound asset this sampler will play.
319 #[unsafe(method(assetIdentifier))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn assetIdentifier(&self) -> Retained<NSString>;
322
323 #[cfg(feature = "PHASETypes")]
324 /// The cull option for the sampler.
325 ///
326 /// The default value is PHASECullOptionTerminate.
327 #[unsafe(method(cullOption))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn cullOption(&self) -> PHASECullOption;
330
331 #[cfg(feature = "PHASETypes")]
332 /// Setter for [`cullOption`][Self::cullOption].
333 #[unsafe(method(setCullOption:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn setCullOption(&self, cull_option: PHASECullOption);
336
337 #[cfg(feature = "PHASETypes")]
338 /// The playback mode for the sampler.
339 ///
340 /// If the playback mode is set to PHASEPlaybackModeOneShot, you need to make sure the the audio data in the registered sound asset associated with this sampler
341 /// begins and ends at zero crossings. Otherwise, you'll hear a click when beginning playback and / or ending playback.
342 /// If the playback mode is set to PHASEPlaybackModeLooping, you need to make sure the audio data in the registered sound asset associated with this sampler
343 /// loops smoothly from the end sample to the start sample. Please verify this during authoring. Failing to do so will result in audible clicks at loop boundaries.
344 /// The default value is PHASEPlaybackModeOneShot.
345 #[unsafe(method(playbackMode))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn playbackMode(&self) -> PHASEPlaybackMode;
348
349 #[cfg(feature = "PHASETypes")]
350 /// Setter for [`playbackMode`][Self::playbackMode].
351 #[unsafe(method(setPlaybackMode:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn setPlaybackMode(&self, playback_mode: PHASEPlaybackMode);
354 );
355}
356
357extern_class!(
358 /// *************************************************************************************************
359 ///
360 ///
361 ///
362 /// An object for defining a container sound event node when building a sound event.
363 ///
364 /// A container node plays back all its children at once.
365 ///
366 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasecontainernodedefinition?language=objc)
367 #[unsafe(super(PHASESoundEventNodeDefinition, PHASEDefinition, NSObject))]
368 #[derive(Debug, PartialEq, Eq, Hash)]
369 #[cfg(feature = "PHASEDefinition")]
370 pub struct PHASEContainerNodeDefinition;
371);
372
373#[cfg(feature = "PHASEDefinition")]
374extern_conformance!(
375 unsafe impl NSObjectProtocol for PHASEContainerNodeDefinition {}
376);
377
378#[cfg(feature = "PHASEDefinition")]
379impl PHASEContainerNodeDefinition {
380 extern_methods!(
381 /// Create a container node definition
382 ///
383 /// Returns: A new PHASEContainerNodeDefinition object
384 #[unsafe(method(init))]
385 #[unsafe(method_family = init)]
386 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
387
388 /// Create a container node definition
389 ///
390 /// Returns: A new PHASEContainerNodeDefinition object
391 #[unsafe(method(new))]
392 #[unsafe(method_family = new)]
393 pub unsafe fn new() -> Retained<Self>;
394
395 /// Create a container node definition
396 ///
397 /// Parameter `identifier`: An optional custom identifier to give to this object
398 ///
399 /// Returns: A new PHASEContainerNodeDefinition object
400 #[unsafe(method(initWithIdentifier:))]
401 #[unsafe(method_family = init)]
402 pub unsafe fn initWithIdentifier(
403 this: Allocated<Self>,
404 identifier: &NSString,
405 ) -> Retained<Self>;
406
407 /// Add a subtree to this node
408 ///
409 /// Parameter `subtree`: Add a subtree of PHASESoundEventNodeDefinition nodes beneath this node.
410 #[unsafe(method(addSubtree:))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn addSubtree(&self, subtree: &PHASESoundEventNodeDefinition);
413 );
414}
415
416extern_class!(
417 /// *************************************************************************************************
418 ///
419 ///
420 ///
421 /// An object for defining a blend sound event node when building a sound event.
422 ///
423 /// A blend node blends between its children based on a numeric parameter.
424 ///
425 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseblendnodedefinition?language=objc)
426 #[unsafe(super(PHASESoundEventNodeDefinition, PHASEDefinition, NSObject))]
427 #[derive(Debug, PartialEq, Eq, Hash)]
428 #[cfg(feature = "PHASEDefinition")]
429 pub struct PHASEBlendNodeDefinition;
430);
431
432#[cfg(feature = "PHASEDefinition")]
433extern_conformance!(
434 unsafe impl NSObjectProtocol for PHASEBlendNodeDefinition {}
435);
436
437#[cfg(feature = "PHASEDefinition")]
438impl PHASEBlendNodeDefinition {
439 extern_methods!(
440 #[unsafe(method(init))]
441 #[unsafe(method_family = init)]
442 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
443
444 #[unsafe(method(new))]
445 #[unsafe(method_family = new)]
446 pub unsafe fn new() -> Retained<Self>;
447
448 #[cfg(feature = "PHASEMetaParameter")]
449 /// Create a blend node definition
450 ///
451 /// Parameter `blendMetaParameterDefinition`: A metaparameter definition that wil be used to control the parameter of the blend node at runtime.
452 ///
453 /// Parameter `identifier`: An optional custom identifier to give to this object
454 ///
455 /// Returns: A new PHASEBlendNodeDefinition object
456 #[unsafe(method(initWithBlendMetaParameterDefinition:identifier:))]
457 #[unsafe(method_family = init)]
458 pub unsafe fn initWithBlendMetaParameterDefinition_identifier(
459 this: Allocated<Self>,
460 blend_meta_parameter_definition: &PHASENumberMetaParameterDefinition,
461 identifier: &NSString,
462 ) -> Retained<Self>;
463
464 #[cfg(feature = "PHASEMetaParameter")]
465 /// Create a blend node definition
466 ///
467 /// Parameter `blendMetaParameterDefinition`: A metaparameter definition that wil be used to control the parameter of the blend node at runtime.
468 ///
469 /// Returns: A new PHASEBlendNodeDefinition object
470 #[unsafe(method(initWithBlendMetaParameterDefinition:))]
471 #[unsafe(method_family = init)]
472 pub unsafe fn initWithBlendMetaParameterDefinition(
473 this: Allocated<Self>,
474 blend_meta_parameter_definition: &PHASENumberMetaParameterDefinition,
475 ) -> Retained<Self>;
476
477 #[cfg(feature = "PHASEMixer")]
478 /// Create a blend node definition
479 ///
480 /// Parameter `spatialMixerDefinition`: A PHASESpatialMixerDefinition that will bind the blend parameter to the distance between the source and listener.
481 ///
482 /// Parameter `identifier`: An optional custom identifier to give to this object
483 ///
484 /// Returns: A new PHASEBlendNodeDefinition object
485 #[unsafe(method(initDistanceBlendWithSpatialMixerDefinition:identifier:))]
486 #[unsafe(method_family = init)]
487 pub unsafe fn initDistanceBlendWithSpatialMixerDefinition_identifier(
488 this: Allocated<Self>,
489 spatial_mixer_definition: &PHASESpatialMixerDefinition,
490 identifier: &NSString,
491 ) -> Retained<Self>;
492
493 #[cfg(feature = "PHASEMixer")]
494 /// Create a blend node definition
495 ///
496 /// Parameter `spatialMixerDefinition`: A PHASESpatialMixerDefinition that will bind the blend parameter to the distance between the source and listener.
497 ///
498 /// Returns: A new PHASEBlendNodeDefinition object
499 #[unsafe(method(initDistanceBlendWithSpatialMixerDefinition:))]
500 #[unsafe(method_family = init)]
501 pub unsafe fn initDistanceBlendWithSpatialMixerDefinition(
502 this: Allocated<Self>,
503 spatial_mixer_definition: &PHASESpatialMixerDefinition,
504 ) -> Retained<Self>;
505
506 #[cfg(feature = "PHASEMetaParameter")]
507 /// The readonly property that returns the PHASENumberMetaParameterDefinition this blend node was created with and assigned to.
508 #[unsafe(method(blendParameterDefinition))]
509 #[unsafe(method_family = none)]
510 pub unsafe fn blendParameterDefinition(
511 &self,
512 ) -> Option<Retained<PHASENumberMetaParameterDefinition>>;
513
514 #[cfg(feature = "PHASEMixer")]
515 /// The readonly property that returns the PHASESpatialMixerDefinition this blend node was created with and assigned to.
516 #[unsafe(method(spatialMixerDefinitionForDistance))]
517 #[unsafe(method_family = none)]
518 pub unsafe fn spatialMixerDefinitionForDistance(
519 &self,
520 ) -> Option<Retained<PHASESpatialMixerDefinition>>;
521
522 #[cfg(feature = "PHASETypes")]
523 /// Create a blend range that is active for all values below a given threshold.
524 ///
525 /// Parameter `value`: The value for which the range will be active if the blend node's input value is below this threshold.
526 ///
527 /// Parameter `fullGainAtValue`: This value defines a threshold for which a fade curve will be applied to the gain, when the input value is between "value" and "fullGainAtValue".
528 ///
529 /// Parameter `fadeCurveType`: A curve type that defines which kind of fade curve to apply.
530 ///
531 /// Parameter `subtree`: A PHASESoundEventNodeDefinition subtree that will be active for this range.
532 #[unsafe(method(addRangeForInputValuesBelow:fullGainAtValue:fadeCurveType:subtree:))]
533 #[unsafe(method_family = none)]
534 pub unsafe fn addRangeForInputValuesBelow_fullGainAtValue_fadeCurveType_subtree(
535 &self,
536 value: c_double,
537 full_gain_at_value: c_double,
538 fade_curve_type: PHASECurveType,
539 subtree: &PHASESoundEventNodeDefinition,
540 );
541
542 #[cfg(feature = "PHASETypes")]
543 /// Create a blend range that is active for all input values between lowValue and highValue
544 ///
545 /// Parameter `lowValue`: The lower bound for which this range is active.
546 ///
547 /// Parameter `highValue`: The upper bound for which this range is active.
548 ///
549 /// Parameter `fullGainAtLowValue`: The threshold for which a fade curve defined by lowFadeCurveType will be applied to the gain when the input value is between lowValue and fullGainAtLowValue
550 ///
551 /// Parameter `fullGainAtHighValue`: The threshold for which a fade curve defined by highFadeCurveType will be applied to the gain when the input value is between highValue and fullGainAtHighValue
552 ///
553 /// Parameter `lowFadeCurveType`: A curve type that defines which kind of fade curve to apply for the low fade range.
554 ///
555 /// Parameter `highFadeCurveType`: A curve type that defines which kind of fade curve to apply for the high fade range..
556 ///
557 /// Parameter `subtree`: A PHASESoundEventNodeDefinition subtree that will be active for this range.
558 #[unsafe(method(addRangeForInputValuesBetween:highValue:fullGainAtLowValue:fullGainAtHighValue:lowFadeCurveType:highFadeCurveType:subtree:))]
559 #[unsafe(method_family = none)]
560 pub unsafe fn addRangeForInputValuesBetween_highValue_fullGainAtLowValue_fullGainAtHighValue_lowFadeCurveType_highFadeCurveType_subtree(
561 &self,
562 low_value: c_double,
563 high_value: c_double,
564 full_gain_at_low_value: c_double,
565 full_gain_at_high_value: c_double,
566 low_fade_curve_type: PHASECurveType,
567 high_fade_curve_type: PHASECurveType,
568 subtree: &PHASESoundEventNodeDefinition,
569 );
570
571 #[cfg(feature = "PHASETypes")]
572 /// Create a blend range that is active for all values above a given threshold.
573 ///
574 /// Parameter `value`: The value for which the range will be active if the blend node's input value is above this threshold.
575 ///
576 /// Parameter `fullGainAtValue`: This value defines a threshold for which a fade curve will be applied to the gain, when the input value is between "value" and "fullGainAtValue".
577 ///
578 /// Parameter `fadeCurveType`: A curve type that defines which kind of fade curve to apply.
579 ///
580 /// Parameter `subtree`: A PHASESoundEventNodeDefinition subtree that will be active for this range.
581 #[unsafe(method(addRangeForInputValuesAbove:fullGainAtValue:fadeCurveType:subtree:))]
582 #[unsafe(method_family = none)]
583 pub unsafe fn addRangeForInputValuesAbove_fullGainAtValue_fadeCurveType_subtree(
584 &self,
585 value: c_double,
586 full_gain_at_value: c_double,
587 fade_curve_type: PHASECurveType,
588 subtree: &PHASESoundEventNodeDefinition,
589 );
590
591 #[cfg(feature = "PHASEEnvelope")]
592 /// Create a blend range defined by a PHASEEnvelope object.
593 ///
594 /// Parameter `envelope`: The PHASEEnvelope object that defines the output gain for a range.
595 ///
596 /// Parameter `subtree`: A PHASESoundEventNodeDefinition subtree that will be active for this range.
597 #[unsafe(method(addRangeWithEnvelope:subtree:))]
598 #[unsafe(method_family = none)]
599 pub unsafe fn addRangeWithEnvelope_subtree(
600 &self,
601 envelope: &PHASEEnvelope,
602 subtree: &PHASESoundEventNodeDefinition,
603 );
604 );
605}
606
607extern_class!(
608 /// *************************************************************************************************
609 ///
610 ///
611 ///
612 /// An object for defining a switch sound event node when building a sound event.
613 ///
614 /// A switch node switches between its children based on a string parameter.
615 ///
616 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaseswitchnodedefinition?language=objc)
617 #[unsafe(super(PHASESoundEventNodeDefinition, PHASEDefinition, NSObject))]
618 #[derive(Debug, PartialEq, Eq, Hash)]
619 #[cfg(feature = "PHASEDefinition")]
620 pub struct PHASESwitchNodeDefinition;
621);
622
623#[cfg(feature = "PHASEDefinition")]
624extern_conformance!(
625 unsafe impl NSObjectProtocol for PHASESwitchNodeDefinition {}
626);
627
628#[cfg(feature = "PHASEDefinition")]
629impl PHASESwitchNodeDefinition {
630 extern_methods!(
631 #[unsafe(method(init))]
632 #[unsafe(method_family = init)]
633 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
634
635 #[unsafe(method(new))]
636 #[unsafe(method_family = new)]
637 pub unsafe fn new() -> Retained<Self>;
638
639 #[cfg(feature = "PHASEMetaParameter")]
640 /// Create a switch node definition
641 ///
642 /// Parameter `switchMetaParameterDefinition`: A metaparameter definition that wil be used to control the parameter of the switch node at runtime.
643 ///
644 /// Parameter `identifier`: An optional custom identifier to give to this object
645 ///
646 /// Returns: A new PHASESwitchNodeDefinition object
647 #[unsafe(method(initWithSwitchMetaParameterDefinition:identifier:))]
648 #[unsafe(method_family = init)]
649 pub unsafe fn initWithSwitchMetaParameterDefinition_identifier(
650 this: Allocated<Self>,
651 switch_meta_parameter_definition: &PHASEStringMetaParameterDefinition,
652 identifier: &NSString,
653 ) -> Retained<Self>;
654
655 #[cfg(feature = "PHASEMetaParameter")]
656 /// Create a switch node definition
657 ///
658 /// Parameter `switchMetaParameterDefinition`: A metaparameter definition that wil be used to control the parameter of the switch node at runtime.
659 ///
660 /// Returns: A new PHASESwitchNodeDefinition object
661 #[unsafe(method(initWithSwitchMetaParameterDefinition:))]
662 #[unsafe(method_family = init)]
663 pub unsafe fn initWithSwitchMetaParameterDefinition(
664 this: Allocated<Self>,
665 switch_meta_parameter_definition: &PHASEStringMetaParameterDefinition,
666 ) -> Retained<Self>;
667
668 /// Add a subtree to a switch node
669 ///
670 /// Parameter `subtree`: A PHASESoundEventNodeDefinition that will be a child node of this switch node
671 ///
672 /// Parameter `switchValue`: A string value that the metaparameter will use to activate this subtree
673 #[unsafe(method(addSubtree:switchValue:))]
674 #[unsafe(method_family = none)]
675 pub unsafe fn addSubtree_switchValue(
676 &self,
677 subtree: &PHASESoundEventNodeDefinition,
678 switch_value: &NSString,
679 );
680
681 #[cfg(feature = "PHASEMetaParameter")]
682 /// The readonly property that returns the PHASEMixerDefinition this sampler was created with and assigned to.
683 #[unsafe(method(switchMetaParameterDefinition))]
684 #[unsafe(method_family = none)]
685 pub unsafe fn switchMetaParameterDefinition(
686 &self,
687 ) -> Retained<PHASEStringMetaParameterDefinition>;
688 );
689}
690
691extern_class!(
692 /// *************************************************************************************************
693 ///
694 ///
695 ///
696 /// An object for defining a random sound event node when building a sound event.
697 ///
698 /// A random node selects one of its children based on a weighted random choice.
699 ///
700 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phaserandomnodedefinition?language=objc)
701 #[unsafe(super(PHASESoundEventNodeDefinition, PHASEDefinition, NSObject))]
702 #[derive(Debug, PartialEq, Eq, Hash)]
703 #[cfg(feature = "PHASEDefinition")]
704 pub struct PHASERandomNodeDefinition;
705);
706
707#[cfg(feature = "PHASEDefinition")]
708extern_conformance!(
709 unsafe impl NSObjectProtocol for PHASERandomNodeDefinition {}
710);
711
712#[cfg(feature = "PHASEDefinition")]
713impl PHASERandomNodeDefinition {
714 extern_methods!(
715 /// Create a random node definition
716 ///
717 /// Returns: A new PHASERandomNodeDefinition object
718 #[unsafe(method(init))]
719 #[unsafe(method_family = init)]
720 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
721
722 /// Create a random node definition
723 ///
724 /// Parameter `identifier`: An optional custom identifier to give to this object
725 ///
726 /// Returns: A new PHASERandomNodeDefinition object
727 #[unsafe(method(initWithIdentifier:))]
728 #[unsafe(method_family = init)]
729 pub unsafe fn initWithIdentifier(
730 this: Allocated<Self>,
731 identifier: &NSString,
732 ) -> Retained<Self>;
733
734 /// Add a subtree to a random node
735 ///
736 /// Parameter `subtree`: A PHASESoundEventNodeDefinition that will be a child node of this random node
737 ///
738 /// Parameter `weight`: The probability weight of this subtree. Higher numbers compared to other subtree weights will increase the likelihood of being
739 /// chosen. This value must be greater than or equal to 1, and is clamped otherwise.
740 #[unsafe(method(addSubtree:weight:))]
741 #[unsafe(method_family = none)]
742 pub unsafe fn addSubtree_weight(
743 &self,
744 subtree: &PHASESoundEventNodeDefinition,
745 weight: &NSNumber,
746 );
747
748 /// Subtrees will not be repeated until after this random node is activated uniqueSelectionQueueLength number of times.
749 #[unsafe(method(uniqueSelectionQueueLength))]
750 #[unsafe(method_family = none)]
751 pub unsafe fn uniqueSelectionQueueLength(&self) -> NSInteger;
752
753 /// Setter for [`uniqueSelectionQueueLength`][Self::uniqueSelectionQueueLength].
754 #[unsafe(method(setUniqueSelectionQueueLength:))]
755 #[unsafe(method_family = none)]
756 pub unsafe fn setUniqueSelectionQueueLength(
757 &self,
758 unique_selection_queue_length: NSInteger,
759 );
760 );
761}
762
763/// Methods declared on superclass `PHASESoundEventNodeDefinition`.
764#[cfg(feature = "PHASEDefinition")]
765impl PHASERandomNodeDefinition {
766 extern_methods!(
767 #[unsafe(method(new))]
768 #[unsafe(method_family = new)]
769 pub unsafe fn new() -> Retained<Self>;
770 );
771}
772
773extern_class!(
774 /// *************************************************************************************************
775 ///
776 ///
777 ///
778 /// The base class for stream nodes, exposing common elements.
779 ///
780 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasestreamnode?language=objc)
781 #[unsafe(super(NSObject))]
782 #[derive(Debug, PartialEq, Eq, Hash)]
783 pub struct PHASEStreamNode;
784);
785
786extern_conformance!(
787 unsafe impl NSObjectProtocol for PHASEStreamNode {}
788);
789
790impl PHASEStreamNode {
791 extern_methods!(
792 #[unsafe(method(init))]
793 #[unsafe(method_family = init)]
794 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
795
796 #[unsafe(method(new))]
797 #[unsafe(method_family = new)]
798 pub unsafe fn new() -> Retained<Self>;
799
800 #[cfg(feature = "PHASEMetaParameter")]
801 /// If specified during construction, the metaparameter for controlling gain will be available here
802 #[unsafe(method(gainMetaParameter))]
803 #[unsafe(method_family = none)]
804 pub unsafe fn gainMetaParameter(&self) -> Option<Retained<PHASENumberMetaParameter>>;
805
806 #[cfg(feature = "PHASEMetaParameter")]
807 /// If specified during construction, the metaparameter for controlling rate/pitch will be available here
808 #[unsafe(method(rateMetaParameter))]
809 #[unsafe(method_family = none)]
810 pub unsafe fn rateMetaParameter(&self) -> Option<Retained<PHASENumberMetaParameter>>;
811
812 #[cfg(feature = "PHASEMixer")]
813 /// The readonly property that returns the PHASEMixer this stream was created with and assigned to.
814 #[unsafe(method(mixer))]
815 #[unsafe(method_family = none)]
816 pub unsafe fn mixer(&self) -> Retained<PHASEMixer>;
817
818 #[cfg(feature = "objc2-avf-audio")]
819 /// The readonly property that returns the AVAudioFormat that this stream was initialized with.
820 #[unsafe(method(format))]
821 #[unsafe(method_family = none)]
822 pub unsafe fn format(&self) -> Retained<AVAudioFormat>;
823 );
824}
825
826extern_class!(
827 /// *************************************************************************************************
828 ///
829 ///
830 ///
831 /// An object for defining a push stream sound event node when building a sound event.
832 ///
833 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepushstreamnodedefinition?language=objc)
834 #[unsafe(super(
835 PHASEGeneratorNodeDefinition,
836 PHASESoundEventNodeDefinition,
837 PHASEDefinition,
838 NSObject
839 ))]
840 #[derive(Debug, PartialEq, Eq, Hash)]
841 #[cfg(feature = "PHASEDefinition")]
842 pub struct PHASEPushStreamNodeDefinition;
843);
844
845#[cfg(feature = "PHASEDefinition")]
846extern_conformance!(
847 unsafe impl NSObjectProtocol for PHASEPushStreamNodeDefinition {}
848);
849
850#[cfg(feature = "PHASEDefinition")]
851impl PHASEPushStreamNodeDefinition {
852 extern_methods!(
853 #[unsafe(method(init))]
854 #[unsafe(method_family = init)]
855 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
856
857 #[unsafe(method(new))]
858 #[unsafe(method_family = new)]
859 pub unsafe fn new() -> Retained<Self>;
860
861 #[cfg(all(feature = "PHASEMixer", feature = "objc2-avf-audio"))]
862 /// Create a push stream node definition
863 ///
864 /// Parameter `mixerDefinition`: The mixer definition this stream will be assigned to
865 ///
866 /// Parameter `format`: The AVAudioFormat object that will define the attributes of the audio this node will accept.
867 /// Only Core Audio's standard deinterleaved 32-bit floating-point formats are supported.
868 ///
869 /// Parameter `identifier`: An optional custom identifier to give to this object
870 ///
871 /// Returns: A new PHASEPushStreamNodeDefinition object
872 #[unsafe(method(initWithMixerDefinition:format:identifier:))]
873 #[unsafe(method_family = init)]
874 pub unsafe fn initWithMixerDefinition_format_identifier(
875 this: Allocated<Self>,
876 mixer_definition: &PHASEMixerDefinition,
877 format: &AVAudioFormat,
878 identifier: &NSString,
879 ) -> Retained<Self>;
880
881 #[cfg(all(feature = "PHASEMixer", feature = "objc2-avf-audio"))]
882 /// Create a push stream node definition
883 ///
884 /// Parameter `mixerDefinition`: The mixer definition this stream will be assigned to
885 ///
886 /// Parameter `format`: The AVAudioFormat object that will define the attributes of the audio this node will accept.
887 /// Only Core Audio's standard deinterleaved 32-bit floating-point formats are supported.
888 ///
889 /// Returns: A new PHASEPushStreamNodeDefinition object
890 #[unsafe(method(initWithMixerDefinition:format:))]
891 #[unsafe(method_family = init)]
892 pub unsafe fn initWithMixerDefinition_format(
893 this: Allocated<Self>,
894 mixer_definition: &PHASEMixerDefinition,
895 format: &AVAudioFormat,
896 ) -> Retained<Self>;
897
898 #[cfg(feature = "objc2-avf-audio")]
899 /// The readonly property that returns the AVAudioFormat that this stream was initialized with
900 #[unsafe(method(format))]
901 #[unsafe(method_family = none)]
902 pub unsafe fn format(&self) -> Retained<AVAudioFormat>;
903
904 /// Determines whether or not the engine should normalize the stream. The default value is NO.
905 ///
906 /// In general, clients are advised to normalize the input. Normalization is required to properly calibrate the output level.
907 /// If you set this value to NO, it's advised that you do custom normalization of the audio data prior to passing the buffers to PHASE.
908 #[unsafe(method(normalize))]
909 #[unsafe(method_family = none)]
910 pub unsafe fn normalize(&self) -> bool;
911
912 /// Setter for [`normalize`][Self::normalize].
913 #[unsafe(method(setNormalize:))]
914 #[unsafe(method_family = none)]
915 pub unsafe fn setNormalize(&self, normalize: bool);
916 );
917}
918
919extern_class!(
920 /// *************************************************************************************************
921 ///
922 ///
923 ///
924 /// An object for addessing an instance of a stream in an executing sound event
925 ///
926 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepushstreamnode?language=objc)
927 #[unsafe(super(PHASEStreamNode, NSObject))]
928 #[derive(Debug, PartialEq, Eq, Hash)]
929 pub struct PHASEPushStreamNode;
930);
931
932extern_conformance!(
933 unsafe impl NSObjectProtocol for PHASEPushStreamNode {}
934);
935
936impl PHASEPushStreamNode {
937 extern_methods!(
938 #[unsafe(method(init))]
939 #[unsafe(method_family = init)]
940 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
941
942 #[unsafe(method(new))]
943 #[unsafe(method_family = new)]
944 pub unsafe fn new() -> Retained<Self>;
945
946 #[cfg(feature = "PHASEMetaParameter")]
947 /// If specified during construction, the metaparameter for controlling gain will be available here
948 #[unsafe(method(gainMetaParameter))]
949 #[unsafe(method_family = none)]
950 pub unsafe fn gainMetaParameter(&self) -> Option<Retained<PHASENumberMetaParameter>>;
951
952 #[cfg(feature = "PHASEMetaParameter")]
953 /// If specified during construction, the metaparameter for controlling rate/pitch will be available here
954 #[unsafe(method(rateMetaParameter))]
955 #[unsafe(method_family = none)]
956 pub unsafe fn rateMetaParameter(&self) -> Option<Retained<PHASENumberMetaParameter>>;
957
958 #[cfg(feature = "PHASEMixer")]
959 /// The readonly property that returns the PHASEMixer this stream was created with and assigned to.
960 #[unsafe(method(mixer))]
961 #[unsafe(method_family = none)]
962 pub unsafe fn mixer(&self) -> Retained<PHASEMixer>;
963
964 #[cfg(feature = "objc2-avf-audio")]
965 /// The readonly property that returns the AVAudioFormat that this stream was initialized with.
966 #[unsafe(method(format))]
967 #[unsafe(method_family = none)]
968 pub unsafe fn format(&self) -> Retained<AVAudioFormat>;
969
970 #[cfg(feature = "objc2-avf-audio")]
971 /// Schedule a buffer for playback.
972 ///
973 /// Parameter `buffer`: The buffer with PCM audio data.
974 ///
975 /// Schedules the buffer to be played following any previously scheduled buffer(s).
976 /// The buffer format must be same as format specified during player instantiation
977 #[unsafe(method(scheduleBuffer:))]
978 #[unsafe(method_family = none)]
979 pub unsafe fn scheduleBuffer(&self, buffer: &AVAudioPCMBuffer);
980
981 #[cfg(all(feature = "block2", feature = "objc2-avf-audio"))]
982 /// Schedule a buffer for playback.
983 ///
984 /// Schedules the buffer to be played following any previously scheduled buffer(s).
985 /// The buffer format must be same as format specified during player instantiation
986 ///
987 /// Parameter `buffer`: The buffer with PCM audio data.
988 ///
989 /// Parameter `completionCallbackType`: Option to specify when the completion handler must be called.
990 ///
991 /// Parameter `completionHandler`: The completionHandler to be called as per the specified completion callback type
992 /// or when the player is stopped, at which point the buffer can be recycled.
993 #[unsafe(method(scheduleBuffer:completionCallbackType:completionHandler:))]
994 #[unsafe(method_family = none)]
995 pub unsafe fn scheduleBuffer_completionCallbackType_completionHandler(
996 &self,
997 buffer: &AVAudioPCMBuffer,
998 completion_callback_type: PHASEPushStreamCompletionCallbackCondition,
999 completion_handler: &block2::DynBlock<
1000 dyn Fn(PHASEPushStreamCompletionCallbackCondition),
1001 >,
1002 );
1003
1004 #[cfg(feature = "objc2-avf-audio")]
1005 /// Schedule a buffer for playback at a given time.
1006 ///
1007 /// The buffer format must be same as format specified during player instantiation
1008 ///
1009 /// Parameter `buffer`: The buffer with PCM audio data.
1010 ///
1011 /// Parameter `when`: The time at which to play the buffer.
1012 ///
1013 /// Parameter `options`: Options for looping, interrupting other buffers, etc.
1014 #[unsafe(method(scheduleBuffer:atTime:options:))]
1015 #[unsafe(method_family = none)]
1016 pub unsafe fn scheduleBuffer_atTime_options(
1017 &self,
1018 buffer: &AVAudioPCMBuffer,
1019 when: Option<&AVAudioTime>,
1020 options: PHASEPushStreamBufferOptions,
1021 );
1022
1023 #[cfg(all(feature = "block2", feature = "objc2-avf-audio"))]
1024 /// Schedule a buffer for playback at a given time.
1025 ///
1026 /// The buffer format must be same as format specified during player instantiation
1027 ///
1028 /// Parameter `buffer`: The buffer with PCM audio data.
1029 ///
1030 /// Parameter `when`: The time at which to play the buffer.
1031 ///
1032 /// Parameter `options`: Options for looping, interrupting other buffers, etc.
1033 ///
1034 /// Parameter `completionCallbackType`: Option to specify when the completion handler must be called.
1035 ///
1036 /// Parameter `completionHandler`: The completionHandler to be called as per the callback type specified or when
1037 /// the player is stopped, at which point the buffer can be recycled.
1038 #[unsafe(method(scheduleBuffer:atTime:options:completionCallbackType:completionHandler:))]
1039 #[unsafe(method_family = none)]
1040 pub unsafe fn scheduleBuffer_atTime_options_completionCallbackType_completionHandler(
1041 &self,
1042 buffer: &AVAudioPCMBuffer,
1043 when: Option<&AVAudioTime>,
1044 options: PHASEPushStreamBufferOptions,
1045 completion_callback_type: PHASEPushStreamCompletionCallbackCondition,
1046 completion_handler: &block2::DynBlock<
1047 dyn Fn(PHASEPushStreamCompletionCallbackCondition),
1048 >,
1049 );
1050 );
1051}
1052
1053/// Block to supply audio data to PHASEPullStreamNode
1054///
1055/// Parameter `isSilence`: The client may use this flag to indicate that the buffer it vends contains only silence.
1056/// The receiver of the buffer can then use the flag as a hint as to whether the buffer needs
1057/// to be processed or not.
1058/// Note that because the flag is only a hint, when setting the silence flag, the originator of
1059/// a buffer must also ensure that it contains silence (zeroes).
1060///
1061/// Parameter `timestamp`: The HAL time at which the audio data will be rendered. If there is a sample rate conversion
1062/// or time compression/expansion downstream, the sample time will not be valid.
1063///
1064/// Parameter `frameCount`: The number of sample frames of audio data requested.
1065///
1066/// Parameter `outputData`: The output data.
1067///
1068/// The caller must supply valid buffers in outputData's mBuffers' mData and mDataByteSize.
1069/// mDataByteSize must be consistent with frameCount. This block may provide output in those
1070/// specified buffers, or it may replace the mData pointers with pointers to memory which it
1071/// owns and guarantees will remain valid until the next render cycle.
1072///
1073/// Returns: An OSStatus result code. If an error is returned, the audio data should be assumed to be
1074/// invalid.
1075///
1076/// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepullstreamrenderblock?language=objc)
1077#[cfg(all(
1078 feature = "block2",
1079 feature = "objc2-avf-audio",
1080 feature = "objc2-core-audio-types"
1081))]
1082pub type PHASEPullStreamRenderBlock = *mut block2::DynBlock<
1083 dyn Fn(
1084 NonNull<Bool>,
1085 NonNull<AudioTimeStamp>,
1086 AVAudioFrameCount,
1087 NonNull<AudioBufferList>,
1088 ) -> OSStatus,
1089>;
1090
1091extern_class!(
1092 /// *************************************************************************************************
1093 ///
1094 ///
1095 ///
1096 /// An object for defining a pull stream sound event node when building a sound event.
1097 ///
1098 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepullstreamnodedefinition?language=objc)
1099 #[unsafe(super(
1100 PHASEGeneratorNodeDefinition,
1101 PHASESoundEventNodeDefinition,
1102 PHASEDefinition,
1103 NSObject
1104 ))]
1105 #[derive(Debug, PartialEq, Eq, Hash)]
1106 #[cfg(feature = "PHASEDefinition")]
1107 pub struct PHASEPullStreamNodeDefinition;
1108);
1109
1110#[cfg(feature = "PHASEDefinition")]
1111extern_conformance!(
1112 unsafe impl NSObjectProtocol for PHASEPullStreamNodeDefinition {}
1113);
1114
1115#[cfg(feature = "PHASEDefinition")]
1116impl PHASEPullStreamNodeDefinition {
1117 extern_methods!(
1118 #[unsafe(method(init))]
1119 #[unsafe(method_family = init)]
1120 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1121
1122 #[unsafe(method(new))]
1123 #[unsafe(method_family = new)]
1124 pub unsafe fn new() -> Retained<Self>;
1125
1126 #[cfg(all(feature = "PHASEMixer", feature = "objc2-avf-audio"))]
1127 /// Create a pull stream node definition
1128 ///
1129 /// Parameter `mixerDefinition`: The mixer definition this stream will be assigned to
1130 ///
1131 /// Parameter `format`: The AVAudioFormat object that will define the attributes of the audio this node will accept.
1132 /// Only Core Audio's standard deinterleaved 32-bit floating-point formats are supported.
1133 ///
1134 /// Parameter `identifier`: An optional custom identifier to give to this object
1135 ///
1136 /// Returns: A new PHASEPullStreamNodeDefinition object
1137 #[unsafe(method(initWithMixerDefinition:format:identifier:))]
1138 #[unsafe(method_family = init)]
1139 pub unsafe fn initWithMixerDefinition_format_identifier(
1140 this: Allocated<Self>,
1141 mixer_definition: &PHASEMixerDefinition,
1142 format: &AVAudioFormat,
1143 identifier: &NSString,
1144 ) -> Retained<Self>;
1145
1146 #[cfg(all(feature = "PHASEMixer", feature = "objc2-avf-audio"))]
1147 /// Create a pull stream node definition
1148 ///
1149 /// Parameter `mixerDefinition`: The mixer definition this stream will be assigned to
1150 ///
1151 /// Parameter `format`: The AVAudioFormat object that will define the attributes of the audio this node will accept.
1152 /// Only Core Audio's standard deinterleaved 32-bit floating-point formats are supported.
1153 ///
1154 /// Returns: A new PHASEPullStreamNodeDefinition object
1155 #[unsafe(method(initWithMixerDefinition:format:))]
1156 #[unsafe(method_family = init)]
1157 pub unsafe fn initWithMixerDefinition_format(
1158 this: Allocated<Self>,
1159 mixer_definition: &PHASEMixerDefinition,
1160 format: &AVAudioFormat,
1161 ) -> Retained<Self>;
1162
1163 #[cfg(feature = "objc2-avf-audio")]
1164 /// The readonly property that returns the AVAudioFormat that this stream was initialized with
1165 #[unsafe(method(format))]
1166 #[unsafe(method_family = none)]
1167 pub unsafe fn format(&self) -> Retained<AVAudioFormat>;
1168
1169 /// Determines whether or not the engine should normalize the stream. The default value is NO.
1170 ///
1171 /// In general, clients are advised to normalize the input. Normalization is required to properly calibrate the output level.
1172 /// If you set this value to NO, it's advised that you do custom normalization of the audio data prior to passing the buffers to PHASE.
1173 #[unsafe(method(normalize))]
1174 #[unsafe(method_family = none)]
1175 pub unsafe fn normalize(&self) -> bool;
1176
1177 /// Setter for [`normalize`][Self::normalize].
1178 #[unsafe(method(setNormalize:))]
1179 #[unsafe(method_family = none)]
1180 pub unsafe fn setNormalize(&self, normalize: bool);
1181 );
1182}
1183
1184extern_class!(
1185 /// *************************************************************************************************
1186 ///
1187 ///
1188 ///
1189 /// An object for addessing an instance of a stream in an executing sound event
1190 ///
1191 /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasepullstreamnode?language=objc)
1192 #[unsafe(super(PHASEStreamNode, NSObject))]
1193 #[derive(Debug, PartialEq, Eq, Hash)]
1194 pub struct PHASEPullStreamNode;
1195);
1196
1197extern_conformance!(
1198 unsafe impl NSObjectProtocol for PHASEPullStreamNode {}
1199);
1200
1201impl PHASEPullStreamNode {
1202 extern_methods!(
1203 #[unsafe(method(init))]
1204 #[unsafe(method_family = init)]
1205 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1206
1207 #[unsafe(method(new))]
1208 #[unsafe(method_family = new)]
1209 pub unsafe fn new() -> Retained<Self>;
1210
1211 #[cfg(all(
1212 feature = "block2",
1213 feature = "objc2-avf-audio",
1214 feature = "objc2-core-audio-types"
1215 ))]
1216 /// A property to set the render block callback that will render the samplesIW
1217 ///
1218 /// The renderBlock must be set before the PHASESoundEvent is prepared or started. The callback will be called from a high priority realtime thread.
1219 /// Your implementation must be performant and not perform any realtime unsafe operations such as lock mutexes or allocate memory.
1220 ///
1221 /// # Safety
1222 ///
1223 /// - The returned block's argument 1 must be a valid pointer.
1224 /// - The returned block's argument 2 must be a valid pointer.
1225 /// - The returned block's argument 4 must be a valid pointer.
1226 #[unsafe(method(renderBlock))]
1227 #[unsafe(method_family = none)]
1228 pub unsafe fn renderBlock(&self) -> PHASEPullStreamRenderBlock;
1229
1230 #[cfg(all(
1231 feature = "block2",
1232 feature = "objc2-avf-audio",
1233 feature = "objc2-core-audio-types"
1234 ))]
1235 /// Setter for [`renderBlock`][Self::renderBlock].
1236 ///
1237 /// # Safety
1238 ///
1239 /// `render_block` must be a valid pointer.
1240 #[unsafe(method(setRenderBlock:))]
1241 #[unsafe(method_family = none)]
1242 pub unsafe fn setRenderBlock(&self, render_block: PHASEPullStreamRenderBlock);
1243 );
1244}