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