objc2_phase/generated/
PHASESource.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 PHASESource represents where sound originates within the simulated acoustic scene.
16    ///
17    /// PHASE supports both point sources and volumetric sources.
18    /// A point source simulates the sound from a point in space.
19    /// A volumetric source simulates the sound from a shape.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/phase/phasesource?language=objc)
22    #[unsafe(super(PHASEObject, NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    #[cfg(feature = "PHASEObject")]
25    pub struct PHASESource;
26);
27
28#[cfg(feature = "PHASEObject")]
29extern_conformance!(
30    unsafe impl NSCopying for PHASESource {}
31);
32
33#[cfg(feature = "PHASEObject")]
34unsafe impl CopyingHelper for PHASESource {
35    type Result = Self;
36}
37
38#[cfg(feature = "PHASEObject")]
39extern_conformance!(
40    unsafe impl NSObjectProtocol for PHASESource {}
41);
42
43#[cfg(feature = "PHASEObject")]
44impl PHASESource {
45    extern_methods!(
46        #[unsafe(method(init))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
49
50        #[unsafe(method(new))]
51        #[unsafe(method_family = new)]
52        pub unsafe fn new() -> Retained<Self>;
53
54        #[cfg(feature = "PHASEEngine")]
55        /// Initialize a new point source.
56        #[unsafe(method(initWithEngine:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithEngine(this: Allocated<Self>, engine: &PHASEEngine)
59            -> Retained<Self>;
60
61        #[cfg(all(feature = "PHASEEngine", feature = "PHASEShape"))]
62        /// Initialize a new volumetric source with shapes.
63        ///
64        /// Parameter `shapes`: The shape(s) of the source within the world
65        ///
66        /// The shapes array cannot be empty, otherwise an exception is thrown.
67        ///
68        /// Note: This function is thread-safe.
69        /// Clients can safely run this function to create multiple sources from multiple threads, if required.
70        #[unsafe(method(initWithEngine:shapes:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithEngine_shapes(
73            this: Allocated<Self>,
74            engine: &PHASEEngine,
75            shapes: &NSArray<PHASEShape>,
76        ) -> Retained<Self>;
77
78        /// Linear gain scalar.
79        ///
80        /// Note: Values are clamped to the range [0, 1]. Default value is 1.
81        #[unsafe(method(gain))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn gain(&self) -> c_double;
84
85        /// Setter for [`gain`][Self::gain].
86        #[unsafe(method(setGain:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setGain(&self, gain: c_double);
89
90        #[cfg(feature = "PHASEShape")]
91        /// Array of shapes associated with this source.
92        #[unsafe(method(shapes))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn shapes(&self) -> Retained<NSArray<PHASEShape>>;
95    );
96}