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")]
37unsafe impl NSCoding for SKAudioNode {}
38
39#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
40#[cfg(target_os = "macos")]
41unsafe impl NSCopying for SKAudioNode {}
42
43#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
44#[cfg(target_os = "macos")]
45unsafe impl CopyingHelper for SKAudioNode {
46    type Result = Self;
47}
48
49#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
50#[cfg(target_os = "macos")]
51unsafe impl NSObjectProtocol for SKAudioNode {}
52
53#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
54#[cfg(target_os = "macos")]
55unsafe impl NSSecureCoding for SKAudioNode {}
56
57#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
58#[cfg(target_os = "macos")]
59impl SKAudioNode {
60    extern_methods!(
61        #[cfg(feature = "objc2-avf-audio")]
62        /// Creates a SpriteKit scene graph audio node from the given AVAudioNode.
63        ///
64        /// See: AVAudioNode
65        #[unsafe(method(initWithAVAudioNode:))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn initWithAVAudioNode(
68            this: Allocated<Self>,
69            node: Option<&AVAudioNode>,
70        ) -> Retained<Self>;
71
72        #[unsafe(method(initWithCoder:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithCoder(
75            this: Allocated<Self>,
76            a_decoder: &NSCoder,
77        ) -> Option<Retained<Self>>;
78
79        /// Convenience initializer that creates an AVAudioNode from the named audio asset in the main bundle.
80        ///
81        /// See: initWithAVAudioNode
82        #[unsafe(method(initWithFileNamed:))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn initWithFileNamed(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
85
86        /// Convenience initializer that creates an AVAudioNode from the URL that contain a audio asset.
87        ///
88        /// See: initWithAVAudioNode
89        #[unsafe(method(initWithURL:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
92
93        #[cfg(feature = "objc2-avf-audio")]
94        /// Sets or gets the current AVAudioNode used by this instance.
95        #[unsafe(method(avAudioNode))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn avAudioNode(&self) -> Option<Retained<AVAudioNode>>;
98
99        #[cfg(feature = "objc2-avf-audio")]
100        /// Setter for [`avAudioNode`][Self::avAudioNode].
101        #[unsafe(method(setAvAudioNode:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setAvAudioNode(&self, av_audio_node: Option<&AVAudioNode>);
104
105        /// Specifies whether the node is to automatically play sound when added to a scene.
106        /// If autoplaysLooped is NO, the node and its sound must be explicitly scheduled and played using
107        /// the scene's engine.
108        ///
109        /// If YES, the node will automatically play sound when added to a scene.
110        ///
111        /// Defaults to YES.
112        ///
113        /// See: SKView.paused
114        #[unsafe(method(autoplayLooped))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn autoplayLooped(&self) -> bool;
117
118        /// Setter for [`autoplayLooped`][Self::autoplayLooped].
119        #[unsafe(method(setAutoplayLooped:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setAutoplayLooped(&self, autoplay_looped: bool);
122
123        /// Marks the audio source as positional so that the audio mix considers relative position and velocity
124        /// with regards to the scene's current listener node.
125        ///
126        ///
127        /// See: AVAudio3DMixing
128        ///
129        /// See: SKScene.listener
130        #[unsafe(method(isPositional))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn isPositional(&self) -> bool;
133
134        /// Setter for [`isPositional`][Self::isPositional].
135        #[unsafe(method(setPositional:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setPositional(&self, positional: bool);
138    );
139}
140
141/// Methods declared on superclass `SKNode`.
142#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
143#[cfg(target_os = "macos")]
144impl SKAudioNode {
145    extern_methods!(
146        #[unsafe(method(init))]
147        #[unsafe(method_family = init)]
148        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
149
150        #[unsafe(method(node))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
153
154        #[unsafe(method(nodeWithFileNamed:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn nodeWithFileNamed(
157            filename: &NSString,
158            mtm: MainThreadMarker,
159        ) -> Option<Retained<Self>>;
160
161        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
164            filename: &NSString,
165            classes: &NSSet<AnyClass>,
166            mtm: MainThreadMarker,
167        ) -> Result<Retained<Self>, Retained<NSError>>;
168    );
169}
170
171/// Methods declared on superclass `NSObject`.
172#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
173#[cfg(target_os = "macos")]
174impl SKAudioNode {
175    extern_methods!(
176        #[unsafe(method(new))]
177        #[unsafe(method_family = new)]
178        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
179    );
180}
181
182/// SKAudioNode.
183/// Actions that are to be used with audio nodes.
184#[cfg(feature = "SKAction")]
185impl SKAction {
186    extern_methods!(
187        #[unsafe(method(stereoPanTo:duration:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn stereoPanTo_duration(
190            v: c_float,
191            duration: NSTimeInterval,
192        ) -> Retained<SKAction>;
193
194        #[unsafe(method(stereoPanBy:duration:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn stereoPanBy_duration(
197            v: c_float,
198            duration: NSTimeInterval,
199        ) -> Retained<SKAction>;
200
201        #[unsafe(method(changeReverbTo:duration:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn changeReverbTo_duration(
204            v: c_float,
205            duration: NSTimeInterval,
206        ) -> Retained<SKAction>;
207
208        #[unsafe(method(changeReverbBy:duration:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn changeReverbBy_duration(
211            v: c_float,
212            duration: NSTimeInterval,
213        ) -> Retained<SKAction>;
214
215        #[unsafe(method(changeObstructionTo:duration:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn changeObstructionTo_duration(
218            v: c_float,
219            duration: NSTimeInterval,
220        ) -> Retained<SKAction>;
221
222        #[unsafe(method(changeObstructionBy:duration:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn changeObstructionBy_duration(
225            v: c_float,
226            duration: NSTimeInterval,
227        ) -> Retained<SKAction>;
228
229        #[unsafe(method(changeOcclusionTo:duration:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn changeOcclusionTo_duration(
232            v: c_float,
233            duration: NSTimeInterval,
234        ) -> Retained<SKAction>;
235
236        #[unsafe(method(changeOcclusionBy:duration:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn changeOcclusionBy_duration(
239            v: c_float,
240            duration: NSTimeInterval,
241        ) -> Retained<SKAction>;
242    );
243}