objc2_avf_audio/generated/AVAudioUnitComponent.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-audio-toolbox")]
7#[cfg(not(target_os = "watchos"))]
8use objc2_audio_toolbox::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern "C" {
14 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypeoutput?language=objc)
15 pub static AVAudioUnitTypeOutput: &'static NSString;
16}
17
18extern "C" {
19 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypemusicdevice?language=objc)
20 pub static AVAudioUnitTypeMusicDevice: &'static NSString;
21}
22
23extern "C" {
24 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypemusiceffect?language=objc)
25 pub static AVAudioUnitTypeMusicEffect: &'static NSString;
26}
27
28extern "C" {
29 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypeformatconverter?language=objc)
30 pub static AVAudioUnitTypeFormatConverter: &'static NSString;
31}
32
33extern "C" {
34 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypeeffect?language=objc)
35 pub static AVAudioUnitTypeEffect: &'static NSString;
36}
37
38extern "C" {
39 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypemixer?language=objc)
40 pub static AVAudioUnitTypeMixer: &'static NSString;
41}
42
43extern "C" {
44 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypepanner?language=objc)
45 pub static AVAudioUnitTypePanner: &'static NSString;
46}
47
48extern "C" {
49 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypegenerator?language=objc)
50 pub static AVAudioUnitTypeGenerator: &'static NSString;
51}
52
53extern "C" {
54 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypeofflineeffect?language=objc)
55 pub static AVAudioUnitTypeOfflineEffect: &'static NSString;
56}
57
58extern "C" {
59 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounittypemidiprocessor?language=objc)
60 pub static AVAudioUnitTypeMIDIProcessor: &'static NSString;
61}
62
63extern "C" {
64 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitmanufacturernameapple?language=objc)
65 pub static AVAudioUnitManufacturerNameApple: &'static NSString;
66}
67
68extern_class!(
69 /// Provides details about an audio unit such as type, subtype, manufacturer, location etc. User
70 /// tags can be added to the AVAudioUnitComponent which can be queried later for display.
71 ///
72 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponent?language=objc)
73 #[unsafe(super(NSObject))]
74 #[derive(Debug, PartialEq, Eq, Hash)]
75 pub struct AVAudioUnitComponent;
76);
77
78extern_conformance!(
79 unsafe impl NSObjectProtocol for AVAudioUnitComponent {}
80);
81
82impl AVAudioUnitComponent {
83 extern_methods!(
84 /// the name of an audio component
85 #[unsafe(method(name))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn name(&self) -> Retained<NSString>;
88
89 /// standard audio component types returned as strings
90 #[unsafe(method(typeName))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn typeName(&self) -> Retained<NSString>;
93
94 /// localized string of typeName for display
95 #[unsafe(method(localizedTypeName))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn localizedTypeName(&self) -> Retained<NSString>;
98
99 /// the manufacturer name, extracted from the manufacturer key defined in Info.plist dictionary
100 #[unsafe(method(manufacturerName))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn manufacturerName(&self) -> Retained<NSString>;
103
104 /// version number comprised of a hexadecimal number with major, minor, dot-release format: 0xMMMMmmDD
105 #[unsafe(method(version))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn version(&self) -> NSUInteger;
108
109 /// version number as string
110 #[unsafe(method(versionString))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn versionString(&self) -> Retained<NSString>;
113
114 /// URL representing location of component
115 #[deprecated]
116 #[unsafe(method(componentURL))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn componentURL(&self) -> Option<Retained<NSURL>>;
119
120 /// NSArray of NSNumbers each of which corresponds to one of the constants in Mach-O Architecture in NSBundle Class Reference
121 #[unsafe(method(availableArchitectures))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn availableArchitectures(&self) -> Retained<NSArray<NSNumber>>;
124
125 /// On OSX, YES if the AudioComponent can be loaded into a sandboxed process otherwise NO.
126 /// On iOS, this is always YES.
127 #[unsafe(method(isSandboxSafe))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn isSandboxSafe(&self) -> bool;
130
131 /// YES if AudioComponent has midi input, otherwise NO
132 #[unsafe(method(hasMIDIInput))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn hasMIDIInput(&self) -> bool;
135
136 /// YES if AudioComponent has midi output, otherwise NO
137 #[unsafe(method(hasMIDIOutput))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn hasMIDIOutput(&self) -> bool;
140
141 #[cfg(feature = "objc2-audio-toolbox")]
142 #[cfg(not(target_os = "watchos"))]
143 /// the audioComponent that can be used in AudioComponent APIs.
144 #[unsafe(method(audioComponent))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn audioComponent(&self) -> AudioComponent;
147
148 /// User tags represent the tags from the current user.
149 #[unsafe(method(userTagNames))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn userTagNames(&self) -> Retained<NSArray<NSString>>;
152
153 /// Setter for [`userTagNames`][Self::userTagNames].
154 #[unsafe(method(setUserTagNames:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setUserTagNames(&self, user_tag_names: &NSArray<NSString>);
157
158 /// represent the tags from the current user and the system tags defined by AudioComponent.
159 #[unsafe(method(allTagNames))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn allTagNames(&self) -> Retained<NSArray<NSString>>;
162
163 #[cfg(feature = "objc2-audio-toolbox")]
164 #[cfg(not(target_os = "watchos"))]
165 /// description of the audio component that can be used in AudioComponent APIs.
166 #[unsafe(method(audioComponentDescription))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn audioComponentDescription(&self) -> AudioComponentDescription;
169
170 /// A URL that will specify the location of an icon file that can be used when presenting UI
171 /// for this audio component.
172 #[unsafe(method(iconURL))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn iconURL(&self) -> Option<Retained<NSURL>>;
175
176 /// YES if the AudioComponent has passed the AU validation tests, otherwise NO
177 #[unsafe(method(passesAUVal))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn passesAUVal(&self) -> bool;
180
181 /// YES if the AudioComponent provides custom view, otherwise NO
182 #[unsafe(method(hasCustomView))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn hasCustomView(&self) -> bool;
185
186 /// A NSDictionary that contains information describing the capabilities of the AudioComponent.
187 /// The specific information depends on the type and the keys are defined in AudioUnitProperties.h
188 #[unsafe(method(configurationDictionary))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn configurationDictionary(&self)
191 -> Retained<NSDictionary<NSString, AnyObject>>;
192
193 /// returns YES if the AudioComponent supports the input/output channel configuration
194 #[unsafe(method(supportsNumberInputChannels:outputChannels:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn supportsNumberInputChannels_outputChannels(
197 &self,
198 num_input_channels: NSInteger,
199 num_output_channels: NSInteger,
200 ) -> bool;
201 );
202}
203
204/// Methods declared on superclass `NSObject`.
205impl AVAudioUnitComponent {
206 extern_methods!(
207 #[unsafe(method(init))]
208 #[unsafe(method_family = init)]
209 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210
211 #[unsafe(method(new))]
212 #[unsafe(method_family = new)]
213 pub unsafe fn new() -> Retained<Self>;
214 );
215}
216
217extern "C" {
218 /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponenttagsdidchangenotification?language=objc)
219 pub static AVAudioUnitComponentTagsDidChangeNotification: &'static NSString;
220}
221
222extern_class!(
223 /// A singleton object that provides an easy way to find audio components that are
224 /// registered with the system.
225 ///
226 /// AVAudioUnitComponentManager provides methods to search and query various information about the
227 /// audio components without opening them.
228 ///
229 /// Currently audio components that are audio units can only be searched.
230 ///
231 /// The class also supports predefined system tags and arbitrary user tags. Each audio unit can be
232 /// tagged as part of its definition. Refer to AudioComponent.h for more details. AudioUnit Hosts
233 /// such as Logic or GarageBand can present groupings of audio units based on the tags.
234 ///
235 /// Searching for audio units can be done in various ways
236 /// - using a NSPredicate that contains search strings for tags or descriptions
237 /// - using a block to match on custom criteria
238 /// - using an AudioComponentDescription
239 ///
240 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponentmanager?language=objc)
241 #[unsafe(super(NSObject))]
242 #[derive(Debug, PartialEq, Eq, Hash)]
243 pub struct AVAudioUnitComponentManager;
244);
245
246extern_conformance!(
247 unsafe impl NSObjectProtocol for AVAudioUnitComponentManager {}
248);
249
250impl AVAudioUnitComponentManager {
251 extern_methods!(
252 /// returns all tags associated with the current user as well as all system tags defined by
253 /// the audio unit(s).
254 #[unsafe(method(tagNames))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn tagNames(&self) -> Retained<NSArray<NSString>>;
257
258 /// returns the localized standard system tags defined by the audio unit(s).
259 #[unsafe(method(standardLocalizedTagNames))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn standardLocalizedTagNames(&self) -> Retained<NSArray<NSString>>;
262
263 #[unsafe(method(sharedAudioUnitComponentManager))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn sharedAudioUnitComponentManager() -> Retained<Self>;
266
267 /// returns an array of AVAudioUnitComponent objects that match the search predicate.
268 ///
269 /// AudioComponent's information or tags can be used to build a search criteria.
270 /// For example, "typeName CONTAINS 'Effect'" or tags IN {'Sampler', 'MIDI'}"
271 #[unsafe(method(componentsMatchingPredicate:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn componentsMatchingPredicate(
274 &self,
275 predicate: &NSPredicate,
276 ) -> Retained<NSArray<AVAudioUnitComponent>>;
277
278 #[cfg(feature = "block2")]
279 /// returns an array of AVAudioUnitComponent objects that pass the user provided block method.
280 ///
281 /// For each AudioComponent found by the manager, the block method will be called. If the return
282 /// value is YES then the AudioComponent is added to the resulting array else it will excluded.
283 /// This gives more control to the block provider to filter out the components returned.
284 #[unsafe(method(componentsPassingTest:))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn componentsPassingTest(
287 &self,
288 test_handler: &block2::DynBlock<
289 dyn Fn(NonNull<AVAudioUnitComponent>, NonNull<Bool>) -> Bool,
290 >,
291 ) -> Retained<NSArray<AVAudioUnitComponent>>;
292
293 #[cfg(feature = "objc2-audio-toolbox")]
294 #[cfg(not(target_os = "watchos"))]
295 /// returns an array of AVAudioUnitComponent objects that match the description.
296 ///
297 /// This method provides a mechanism to search for AudioComponents using AudioComponentDescription
298 /// structure. The type, subtype and manufacturer fields are used to search for audio units. A
299 /// value of 0 for any of these fields is a wildcard and returns the first match found.
300 #[unsafe(method(componentsMatchingDescription:))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn componentsMatchingDescription(
303 &self,
304 desc: AudioComponentDescription,
305 ) -> Retained<NSArray<AVAudioUnitComponent>>;
306 );
307}
308
309/// Methods declared on superclass `NSObject`.
310impl AVAudioUnitComponentManager {
311 extern_methods!(
312 #[unsafe(method(init))]
313 #[unsafe(method_family = init)]
314 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
315
316 #[unsafe(method(new))]
317 #[unsafe(method_family = new)]
318 pub unsafe fn new() -> Retained<Self>;
319 );
320}
321
322extern "C" {
323 /// A notification generated when AVAudioUnitComponentManager updates its list of components.
324 ///
325 /// Register for this notification on the shared AVAudioUnitComponentManager instance,
326 /// as follows:
327 ///
328 /// ```text
329 /// [[NSNotificationCenter defaultCenter] addObserver: myObject
330 /// selector:
331 /// sel!(registrationsChanged:)
332 /// name: AVAudioUnitComponentManagerRegistrationsChangedNotification
333 /// object: [AVAudioUnitComponentManager sharedAudioUnitComponentManager]];
334 /// ```
335 ///
336 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponentmanagerregistrationschangednotification?language=objc)
337 pub static AVAudioUnitComponentManagerRegistrationsChangedNotification:
338 &'static NSNotificationName;
339}