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        ///
155        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
156        #[unsafe(method(setUserTagNames:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setUserTagNames(&self, user_tag_names: &NSArray<NSString>);
159
160        /// represent the tags from the current user and the system tags defined by AudioComponent.
161        #[unsafe(method(allTagNames))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn allTagNames(&self) -> Retained<NSArray<NSString>>;
164
165        #[cfg(feature = "objc2-audio-toolbox")]
166        #[cfg(not(target_os = "watchos"))]
167        /// description of the audio component that can be used in AudioComponent APIs.
168        #[unsafe(method(audioComponentDescription))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn audioComponentDescription(&self) -> AudioComponentDescription;
171
172        /// A URL that will specify the location of an icon file that can be used when presenting UI
173        /// for this audio component.
174        #[unsafe(method(iconURL))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn iconURL(&self) -> Option<Retained<NSURL>>;
177
178        /// YES if the AudioComponent has passed the AU validation tests, otherwise NO
179        #[unsafe(method(passesAUVal))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn passesAUVal(&self) -> bool;
182
183        /// YES if the AudioComponent provides custom view, otherwise NO
184        #[unsafe(method(hasCustomView))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn hasCustomView(&self) -> bool;
187
188        /// A NSDictionary that contains information describing the capabilities of the AudioComponent.
189        /// The specific information depends on the type and the keys are defined in AudioUnitProperties.h
190        #[unsafe(method(configurationDictionary))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn configurationDictionary(&self)
193            -> Retained<NSDictionary<NSString, AnyObject>>;
194
195        /// returns YES if the AudioComponent supports the input/output channel configuration
196        #[unsafe(method(supportsNumberInputChannels:outputChannels:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn supportsNumberInputChannels_outputChannels(
199            &self,
200            num_input_channels: NSInteger,
201            num_output_channels: NSInteger,
202        ) -> bool;
203    );
204}
205
206/// Methods declared on superclass `NSObject`.
207impl AVAudioUnitComponent {
208    extern_methods!(
209        #[unsafe(method(init))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
212
213        #[unsafe(method(new))]
214        #[unsafe(method_family = new)]
215        pub unsafe fn new() -> Retained<Self>;
216    );
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponenttagsdidchangenotification?language=objc)
221    pub static AVAudioUnitComponentTagsDidChangeNotification: &'static NSString;
222}
223
224extern_class!(
225    /// A singleton object that provides an easy way to find audio components that are
226    /// registered with the system.
227    ///
228    /// AVAudioUnitComponentManager provides methods to search and query various information about the
229    /// audio components without opening them.
230    ///
231    /// Currently audio components that are audio units can only be searched.
232    ///
233    /// The class also supports predefined system tags and arbitrary user tags. Each audio unit can be
234    /// tagged as part of its definition. Refer to AudioComponent.h for more details. AudioUnit Hosts
235    /// such as Logic or GarageBand can present groupings of audio units based on the tags.
236    ///
237    /// Searching for audio units can be done in various ways
238    /// - using a NSPredicate that contains search strings for tags or descriptions
239    /// - using a block to match on custom criteria
240    /// - using an AudioComponentDescription
241    ///
242    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponentmanager?language=objc)
243    #[unsafe(super(NSObject))]
244    #[derive(Debug, PartialEq, Eq, Hash)]
245    pub struct AVAudioUnitComponentManager;
246);
247
248extern_conformance!(
249    unsafe impl NSObjectProtocol for AVAudioUnitComponentManager {}
250);
251
252impl AVAudioUnitComponentManager {
253    extern_methods!(
254        /// returns all tags associated with the current user as well as all system tags defined by
255        /// the audio unit(s).
256        #[unsafe(method(tagNames))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn tagNames(&self) -> Retained<NSArray<NSString>>;
259
260        /// returns the localized standard system tags defined by the audio unit(s).
261        #[unsafe(method(standardLocalizedTagNames))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn standardLocalizedTagNames(&self) -> Retained<NSArray<NSString>>;
264
265        #[unsafe(method(sharedAudioUnitComponentManager))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn sharedAudioUnitComponentManager() -> Retained<Self>;
268
269        /// returns an array of AVAudioUnitComponent objects that match the search predicate.
270        ///
271        /// AudioComponent's information or tags can be used to build a search criteria.
272        /// For example, "typeName CONTAINS 'Effect'" or tags IN {'Sampler', 'MIDI'}"
273        #[unsafe(method(componentsMatchingPredicate:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn componentsMatchingPredicate(
276            &self,
277            predicate: &NSPredicate,
278        ) -> Retained<NSArray<AVAudioUnitComponent>>;
279
280        #[cfg(feature = "block2")]
281        /// returns an array of AVAudioUnitComponent objects that pass the user provided block method.
282        ///
283        /// For each AudioComponent found by the manager, the block method will be called. If the return
284        /// value is YES then the AudioComponent is added to the resulting array else it will excluded.
285        /// This gives more control to the block provider to filter out the components returned.
286        #[unsafe(method(componentsPassingTest:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn componentsPassingTest(
289            &self,
290            test_handler: &block2::DynBlock<
291                dyn Fn(NonNull<AVAudioUnitComponent>, NonNull<Bool>) -> Bool,
292            >,
293        ) -> Retained<NSArray<AVAudioUnitComponent>>;
294
295        #[cfg(feature = "objc2-audio-toolbox")]
296        #[cfg(not(target_os = "watchos"))]
297        /// returns an array of AVAudioUnitComponent objects that match the description.
298        ///
299        /// This method provides a mechanism to search for AudioComponents using AudioComponentDescription
300        /// structure. The type, subtype and manufacturer fields are used to search for audio units. A
301        /// value of 0 for any of these fields is a wildcard and returns the first match found.
302        #[unsafe(method(componentsMatchingDescription:))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn componentsMatchingDescription(
305            &self,
306            desc: AudioComponentDescription,
307        ) -> Retained<NSArray<AVAudioUnitComponent>>;
308    );
309}
310
311/// Methods declared on superclass `NSObject`.
312impl AVAudioUnitComponentManager {
313    extern_methods!(
314        #[unsafe(method(init))]
315        #[unsafe(method_family = init)]
316        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
317
318        #[unsafe(method(new))]
319        #[unsafe(method_family = new)]
320        pub unsafe fn new() -> Retained<Self>;
321    );
322}
323
324extern "C" {
325    /// A notification generated when AVAudioUnitComponentManager updates its list of components.
326    ///
327    /// Register for this notification on the shared AVAudioUnitComponentManager instance,
328    /// as follows:
329    ///
330    /// ```text
331    /// [[NSNotificationCenter defaultCenter] addObserver: myObject
332    /// selector:
333    /// sel!(registrationsChanged:)
334    /// name:        AVAudioUnitComponentManagerRegistrationsChangedNotification
335    /// object:      [AVAudioUnitComponentManager sharedAudioUnitComponentManager]];
336    /// ```
337    ///
338    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitcomponentmanagerregistrationschangednotification?language=objc)
339    pub static AVAudioUnitComponentManagerRegistrationsChangedNotification:
340        &'static NSNotificationName;
341}