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