objc2_scene_kit/generated/
SCNAudioSource.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-avf-audio")]
7use objc2_avf_audio::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct SCNAudioSource;
19);
20
21unsafe impl NSCoding for SCNAudioSource {}
22
23unsafe impl NSCopying for SCNAudioSource {}
24
25unsafe impl CopyingHelper for SCNAudioSource {
26 type Result = Self;
27}
28
29unsafe impl NSObjectProtocol for SCNAudioSource {}
30
31unsafe impl NSSecureCoding for SCNAudioSource {}
32
33impl SCNAudioSource {
34 extern_methods!(
35 #[unsafe(method(initWithFileNamed:))]
37 #[unsafe(method_family = init)]
38 pub unsafe fn initWithFileNamed(
39 this: Allocated<Self>,
40 name: &NSString,
41 ) -> Option<Retained<Self>>;
42
43 #[unsafe(method(initWithURL:))]
45 #[unsafe(method_family = init)]
46 pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
47
48 #[unsafe(method(audioSourceNamed:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn audioSourceNamed(file_name: &NSString) -> Option<Retained<Self>>;
52
53 #[unsafe(method(isPositional))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn isPositional(&self) -> bool;
61
62 #[unsafe(method(setPositional:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn setPositional(&self, positional: bool);
66
67 #[unsafe(method(volume))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn volume(&self) -> c_float;
71
72 #[unsafe(method(setVolume:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setVolume(&self, volume: c_float);
76
77 #[unsafe(method(rate))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn rate(&self) -> c_float;
81
82 #[unsafe(method(setRate:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn setRate(&self, rate: c_float);
86
87 #[unsafe(method(reverbBlend))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn reverbBlend(&self) -> c_float;
91
92 #[unsafe(method(setReverbBlend:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn setReverbBlend(&self, reverb_blend: c_float);
96
97 #[unsafe(method(loops))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn loops(&self) -> bool;
101
102 #[unsafe(method(setLoops:))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn setLoops(&self, loops: bool);
106
107 #[unsafe(method(shouldStream))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn shouldStream(&self) -> bool;
111
112 #[unsafe(method(setShouldStream:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn setShouldStream(&self, should_stream: bool);
116
117 #[unsafe(method(load))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn load(&self);
123 );
124}
125
126impl SCNAudioSource {
128 extern_methods!(
129 #[unsafe(method(init))]
130 #[unsafe(method_family = init)]
131 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
132
133 #[unsafe(method(new))]
134 #[unsafe(method_family = new)]
135 pub unsafe fn new() -> Retained<Self>;
136 );
137}
138
139extern_class!(
140 #[unsafe(super(NSObject))]
142 #[derive(Debug, PartialEq, Eq, Hash)]
143 pub struct SCNAudioPlayer;
144);
145
146unsafe impl NSObjectProtocol for SCNAudioPlayer {}
147
148impl SCNAudioPlayer {
149 extern_methods!(
150 #[unsafe(method(init))]
151 #[unsafe(method_family = init)]
152 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154 #[unsafe(method(initWithSource:))]
156 #[unsafe(method_family = init)]
157 pub unsafe fn initWithSource(
158 this: Allocated<Self>,
159 source: &SCNAudioSource,
160 ) -> Retained<Self>;
161
162 #[cfg(feature = "objc2-avf-audio")]
163 #[unsafe(method(initWithAVAudioNode:))]
165 #[unsafe(method_family = init)]
166 pub unsafe fn initWithAVAudioNode(
167 this: Allocated<Self>,
168 audio_node: &AVAudioNode,
169 ) -> Retained<Self>;
170
171 #[unsafe(method(audioPlayerWithSource:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn audioPlayerWithSource(source: &SCNAudioSource) -> Retained<Self>;
175
176 #[cfg(feature = "objc2-avf-audio")]
177 #[unsafe(method(audioPlayerWithAVAudioNode:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn audioPlayerWithAVAudioNode(audio_node: &AVAudioNode) -> Retained<Self>;
181
182 #[cfg(feature = "block2")]
183 #[unsafe(method(willStartPlayback))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn willStartPlayback(&self) -> *mut block2::Block<dyn Fn()>;
187
188 #[cfg(feature = "block2")]
189 #[unsafe(method(setWillStartPlayback:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn setWillStartPlayback(
193 &self,
194 will_start_playback: Option<&block2::Block<dyn Fn()>>,
195 );
196
197 #[cfg(feature = "block2")]
198 #[unsafe(method(didFinishPlayback))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn didFinishPlayback(&self) -> *mut block2::Block<dyn Fn()>;
202
203 #[cfg(feature = "block2")]
204 #[unsafe(method(setDidFinishPlayback:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn setDidFinishPlayback(
208 &self,
209 did_finish_playback: Option<&block2::Block<dyn Fn()>>,
210 );
211
212 #[cfg(feature = "objc2-avf-audio")]
213 #[unsafe(method(audioNode))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn audioNode(&self) -> Option<Retained<AVAudioNode>>;
217
218 #[unsafe(method(audioSource))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn audioSource(&self) -> Option<Retained<SCNAudioSource>>;
222 );
223}
224
225impl SCNAudioPlayer {
227 extern_methods!(
228 #[unsafe(method(new))]
229 #[unsafe(method_family = new)]
230 pub unsafe fn new() -> Retained<Self>;
231 );
232}
233
234#[cfg(feature = "SCNNode")]
236impl SCNNode {
237 extern_methods!(
238 #[unsafe(method(addAudioPlayer:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn addAudioPlayer(&self, player: &SCNAudioPlayer);
242
243 #[unsafe(method(removeAllAudioPlayers))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn removeAllAudioPlayers(&self);
247
248 #[unsafe(method(removeAudioPlayer:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn removeAudioPlayer(&self, player: &SCNAudioPlayer);
252
253 #[unsafe(method(audioPlayers))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn audioPlayers(&self) -> Retained<NSArray<SCNAudioPlayer>>;
257 );
258}