objc2_sprite_kit/generated/
SKAudioNode.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-avf-audio")]
10use objc2_avf_audio::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// A SpriteKit scene graph audio node that provides a way to link audio graphs to a SpriteKit scene.
17    /// The currently presented scene is responsible for mixing the audio from nodes in the scene.
18    ///
19    /// Positional sounds will use their relative location and velocity to the scene's listener to apply distance
20    /// attenuation, doppler shift and pan.
21    ///
22    ///
23    /// See: AVAudio3DMixing
24    ///
25    /// See: SKScene.listener
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skaudionode?language=objc)
28    #[unsafe(super(SKNode, NSResponder, NSObject))]
29    #[derive(Debug, PartialEq, Eq, Hash)]
30    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
31    #[cfg(target_os = "macos")]
32    pub struct SKAudioNode;
33);
34
35#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
36#[cfg(target_os = "macos")]
37extern_conformance!(
38    unsafe impl NSCoding for SKAudioNode {}
39);
40
41#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
42#[cfg(target_os = "macos")]
43extern_conformance!(
44    unsafe impl NSCopying for SKAudioNode {}
45);
46
47#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
48#[cfg(target_os = "macos")]
49unsafe impl CopyingHelper for SKAudioNode {
50    type Result = Self;
51}
52
53#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
54#[cfg(target_os = "macos")]
55extern_conformance!(
56    unsafe impl NSObjectProtocol for SKAudioNode {}
57);
58
59#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
60#[cfg(target_os = "macos")]
61extern_conformance!(
62    unsafe impl NSSecureCoding for SKAudioNode {}
63);
64
65#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
66#[cfg(target_os = "macos")]
67impl SKAudioNode {
68    extern_methods!(
69        #[cfg(feature = "objc2-avf-audio")]
70        /// Creates a SpriteKit scene graph audio node from the given AVAudioNode.
71        ///
72        /// See: AVAudioNode
73        #[unsafe(method(initWithAVAudioNode:))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn initWithAVAudioNode(
76            this: Allocated<Self>,
77            node: Option<&AVAudioNode>,
78        ) -> Retained<Self>;
79
80        /// # Safety
81        ///
82        /// `a_decoder` possibly has further requirements.
83        #[unsafe(method(initWithCoder:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithCoder(
86            this: Allocated<Self>,
87            a_decoder: &NSCoder,
88        ) -> Option<Retained<Self>>;
89
90        /// Convenience initializer that creates an AVAudioNode from the named audio asset in the main bundle.
91        ///
92        /// See: initWithAVAudioNode
93        #[unsafe(method(initWithFileNamed:))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn initWithFileNamed(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
96
97        /// Convenience initializer that creates an AVAudioNode from the URL that contain a audio asset.
98        ///
99        /// See: initWithAVAudioNode
100        #[unsafe(method(initWithURL:))]
101        #[unsafe(method_family = init)]
102        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
103
104        #[cfg(feature = "objc2-avf-audio")]
105        /// Sets or gets the current AVAudioNode used by this instance.
106        #[unsafe(method(avAudioNode))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn avAudioNode(&self) -> Option<Retained<AVAudioNode>>;
109
110        #[cfg(feature = "objc2-avf-audio")]
111        /// Setter for [`avAudioNode`][Self::avAudioNode].
112        #[unsafe(method(setAvAudioNode:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setAvAudioNode(&self, av_audio_node: Option<&AVAudioNode>);
115
116        /// Specifies whether the node is to automatically play sound when added to a scene.
117        /// If autoplaysLooped is NO, the node and its sound must be explicitly scheduled and played using
118        /// the scene's engine.
119        ///
120        /// If YES, the node will automatically play sound when added to a scene.
121        ///
122        /// Defaults to YES.
123        ///
124        /// See: SKView.paused
125        #[unsafe(method(autoplayLooped))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn autoplayLooped(&self) -> bool;
128
129        /// Setter for [`autoplayLooped`][Self::autoplayLooped].
130        #[unsafe(method(setAutoplayLooped:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setAutoplayLooped(&self, autoplay_looped: bool);
133
134        /// Marks the audio source as positional so that the audio mix considers relative position and velocity
135        /// with regards to the scene's current listener node.
136        ///
137        ///
138        /// See: AVAudio3DMixing
139        ///
140        /// See: SKScene.listener
141        #[unsafe(method(isPositional))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn isPositional(&self) -> bool;
144
145        /// Setter for [`isPositional`][Self::isPositional].
146        #[unsafe(method(setPositional:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setPositional(&self, positional: bool);
149    );
150}
151
152/// Methods declared on superclass `SKNode`.
153#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
154#[cfg(target_os = "macos")]
155impl SKAudioNode {
156    extern_methods!(
157        #[unsafe(method(init))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160
161        #[unsafe(method(node))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
164
165        #[unsafe(method(nodeWithFileNamed:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn nodeWithFileNamed(
168            filename: &NSString,
169            mtm: MainThreadMarker,
170        ) -> Option<Retained<Self>>;
171
172        /// # Safety
173        ///
174        /// `classes` generic probably has further requirements.
175        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
178            filename: &NSString,
179            classes: &NSSet<AnyClass>,
180            mtm: MainThreadMarker,
181        ) -> Result<Retained<Self>, Retained<NSError>>;
182    );
183}
184
185/// Methods declared on superclass `NSObject`.
186#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
187#[cfg(target_os = "macos")]
188impl SKAudioNode {
189    extern_methods!(
190        #[unsafe(method(new))]
191        #[unsafe(method_family = new)]
192        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
193    );
194}
195
196/// SKAudioNode.
197///
198/// Actions that are to be used with audio nodes.
199#[cfg(feature = "SKAction")]
200impl SKAction {
201    extern_methods!(
202        #[unsafe(method(stereoPanTo:duration:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn stereoPanTo_duration(
205            v: c_float,
206            duration: NSTimeInterval,
207        ) -> Retained<SKAction>;
208
209        #[unsafe(method(stereoPanBy:duration:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn stereoPanBy_duration(
212            v: c_float,
213            duration: NSTimeInterval,
214        ) -> Retained<SKAction>;
215
216        #[unsafe(method(changeReverbTo:duration:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn changeReverbTo_duration(
219            v: c_float,
220            duration: NSTimeInterval,
221        ) -> Retained<SKAction>;
222
223        #[unsafe(method(changeReverbBy:duration:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn changeReverbBy_duration(
226            v: c_float,
227            duration: NSTimeInterval,
228        ) -> Retained<SKAction>;
229
230        #[unsafe(method(changeObstructionTo:duration:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn changeObstructionTo_duration(
233            v: c_float,
234            duration: NSTimeInterval,
235        ) -> Retained<SKAction>;
236
237        #[unsafe(method(changeObstructionBy:duration:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn changeObstructionBy_duration(
240            v: c_float,
241            duration: NSTimeInterval,
242        ) -> Retained<SKAction>;
243
244        #[unsafe(method(changeOcclusionTo:duration:))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn changeOcclusionTo_duration(
247            v: c_float,
248            duration: NSTimeInterval,
249        ) -> Retained<SKAction>;
250
251        #[unsafe(method(changeOcclusionBy:duration:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn changeOcclusionBy_duration(
254            v: c_float,
255            duration: NSTimeInterval,
256        ) -> Retained<SKAction>;
257    );
258}