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