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
21extern_conformance!(
22 unsafe impl NSCoding for SCNAudioSource {}
23);
24
25extern_conformance!(
26 unsafe impl NSCopying for SCNAudioSource {}
27);
28
29unsafe impl CopyingHelper for SCNAudioSource {
30 type Result = Self;
31}
32
33extern_conformance!(
34 unsafe impl NSObjectProtocol for SCNAudioSource {}
35);
36
37extern_conformance!(
38 unsafe impl NSSecureCoding for SCNAudioSource {}
39);
40
41impl SCNAudioSource {
42 extern_methods!(
43 #[unsafe(method(initWithFileNamed:))]
45 #[unsafe(method_family = init)]
46 pub unsafe fn initWithFileNamed(
47 this: Allocated<Self>,
48 name: &NSString,
49 ) -> Option<Retained<Self>>;
50
51 #[unsafe(method(initWithURL:))]
53 #[unsafe(method_family = init)]
54 pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
55
56 #[unsafe(method(audioSourceNamed:))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn audioSourceNamed(file_name: &NSString) -> Option<Retained<Self>>;
60
61 #[unsafe(method(isPositional))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn isPositional(&self) -> bool;
69
70 #[unsafe(method(setPositional:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn setPositional(&self, positional: bool);
74
75 #[unsafe(method(volume))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn volume(&self) -> c_float;
79
80 #[unsafe(method(setVolume:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn setVolume(&self, volume: c_float);
84
85 #[unsafe(method(rate))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn rate(&self) -> c_float;
89
90 #[unsafe(method(setRate:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn setRate(&self, rate: c_float);
94
95 #[unsafe(method(reverbBlend))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn reverbBlend(&self) -> c_float;
99
100 #[unsafe(method(setReverbBlend:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn setReverbBlend(&self, reverb_blend: c_float);
104
105 #[unsafe(method(loops))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn loops(&self) -> bool;
109
110 #[unsafe(method(setLoops:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn setLoops(&self, loops: bool);
114
115 #[unsafe(method(shouldStream))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn shouldStream(&self) -> bool;
119
120 #[unsafe(method(setShouldStream:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn setShouldStream(&self, should_stream: bool);
124
125 #[unsafe(method(load))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn load(&self);
131 );
132}
133
134impl SCNAudioSource {
136 extern_methods!(
137 #[unsafe(method(init))]
138 #[unsafe(method_family = init)]
139 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
140
141 #[unsafe(method(new))]
142 #[unsafe(method_family = new)]
143 pub unsafe fn new() -> Retained<Self>;
144 );
145}
146
147extern_class!(
148 #[unsafe(super(NSObject))]
150 #[derive(Debug, PartialEq, Eq, Hash)]
151 pub struct SCNAudioPlayer;
152);
153
154extern_conformance!(
155 unsafe impl NSObjectProtocol for SCNAudioPlayer {}
156);
157
158impl SCNAudioPlayer {
159 extern_methods!(
160 #[unsafe(method(init))]
161 #[unsafe(method_family = init)]
162 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163
164 #[unsafe(method(initWithSource:))]
166 #[unsafe(method_family = init)]
167 pub unsafe fn initWithSource(
168 this: Allocated<Self>,
169 source: &SCNAudioSource,
170 ) -> Retained<Self>;
171
172 #[cfg(feature = "objc2-avf-audio")]
173 #[unsafe(method(initWithAVAudioNode:))]
175 #[unsafe(method_family = init)]
176 pub unsafe fn initWithAVAudioNode(
177 this: Allocated<Self>,
178 audio_node: &AVAudioNode,
179 ) -> Retained<Self>;
180
181 #[unsafe(method(audioPlayerWithSource:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn audioPlayerWithSource(source: &SCNAudioSource) -> Retained<Self>;
185
186 #[cfg(feature = "objc2-avf-audio")]
187 #[unsafe(method(audioPlayerWithAVAudioNode:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn audioPlayerWithAVAudioNode(audio_node: &AVAudioNode) -> Retained<Self>;
191
192 #[cfg(feature = "block2")]
193 #[unsafe(method(willStartPlayback))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn willStartPlayback(&self) -> *mut block2::DynBlock<dyn Fn()>;
197
198 #[cfg(feature = "block2")]
199 #[unsafe(method(setWillStartPlayback:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn setWillStartPlayback(
205 &self,
206 will_start_playback: Option<&block2::DynBlock<dyn Fn()>>,
207 );
208
209 #[cfg(feature = "block2")]
210 #[unsafe(method(didFinishPlayback))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn didFinishPlayback(&self) -> *mut block2::DynBlock<dyn Fn()>;
214
215 #[cfg(feature = "block2")]
216 #[unsafe(method(setDidFinishPlayback:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setDidFinishPlayback(
222 &self,
223 did_finish_playback: Option<&block2::DynBlock<dyn Fn()>>,
224 );
225
226 #[cfg(feature = "objc2-avf-audio")]
227 #[unsafe(method(audioNode))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn audioNode(&self) -> Option<Retained<AVAudioNode>>;
231
232 #[unsafe(method(audioSource))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn audioSource(&self) -> Option<Retained<SCNAudioSource>>;
236 );
237}
238
239impl SCNAudioPlayer {
241 extern_methods!(
242 #[unsafe(method(new))]
243 #[unsafe(method_family = new)]
244 pub unsafe fn new() -> Retained<Self>;
245 );
246}
247
248#[cfg(feature = "SCNNode")]
250impl SCNNode {
251 extern_methods!(
252 #[unsafe(method(addAudioPlayer:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn addAudioPlayer(&self, player: &SCNAudioPlayer);
256
257 #[unsafe(method(removeAllAudioPlayers))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn removeAllAudioPlayers(&self);
261
262 #[unsafe(method(removeAudioPlayer:))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn removeAudioPlayer(&self, player: &SCNAudioPlayer);
266
267 #[unsafe(method(audioPlayers))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn audioPlayers(&self) -> Retained<NSArray<SCNAudioPlayer>>;
271 );
272}