objc2_audio_toolbox/generated/AudioComponent.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiocomponentconfigurationinfo_validationresult?language=objc)
14pub const kAudioComponentConfigurationInfo_ValidationResult: &CStr =
15 unsafe { CStr::from_bytes_with_nul_unchecked(b"ValidationResult\0") };
16/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiocomponentvalidationparameter_timeout?language=objc)
17pub const kAudioComponentValidationParameter_TimeOut: &CStr =
18 unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeOut\0") };
19/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiocomponentvalidationparameter_forcevalidation?language=objc)
20pub const kAudioComponentValidationParameter_ForceValidation: &CStr =
21 unsafe { CStr::from_bytes_with_nul_unchecked(b"ForceValidation\0") };
22/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiocomponentvalidationparameter_loadoutofprocess?language=objc)
23pub const kAudioComponentValidationParameter_LoadOutOfProcess: &CStr =
24 unsafe { CStr::from_bytes_with_nul_unchecked(b"LoadOutOfProcess\0") };
25/// Flags found in AudioComponentDescription.componentFlags.
26///
27///
28/// When this bit in AudioComponentDescription's componentFlags is set, AudioComponentFindNext
29/// will only return this component when performing a specific, non-wildcard search for the
30/// component, i.e. with non-zero values of componentType, componentSubType, and
31/// componentManufacturer. This can be useful when privately registering a component.
32///
33///
34/// An AudioComponent sets this bit in its componentFlags to indicate to the system that the
35/// AudioComponent is safe to open in a sandboxed process.
36///
37///
38/// The system sets this flag automatically when registering components which implement a version 3
39/// Audio Unit.
40///
41///
42/// The system sets this flag automatically when registering components which require asynchronous
43/// instantiation via AudioComponentInstantiate (v3 audio units with views).
44///
45///
46/// The system sets this flag automatically when registering components which can be loaded into
47/// the current process. This is always true for V2 audio units; it depends on the packaging
48/// in the case of a V3 audio unit.
49///
50/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentflags?language=objc)
51// NS_OPTIONS
52#[repr(transparent)]
53#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
54pub struct AudioComponentFlags(pub u32);
55bitflags::bitflags! {
56 impl AudioComponentFlags: u32 {
57 #[doc(alias = "kAudioComponentFlag_Unsearchable")]
58 const Unsearchable = 1;
59 #[doc(alias = "kAudioComponentFlag_SandboxSafe")]
60 const SandboxSafe = 2;
61 #[doc(alias = "kAudioComponentFlag_IsV3AudioUnit")]
62 const IsV3AudioUnit = 4;
63 #[doc(alias = "kAudioComponentFlag_RequiresAsyncInstantiation")]
64 const RequiresAsyncInstantiation = 8;
65 #[doc(alias = "kAudioComponentFlag_CanLoadInProcess")]
66 const CanLoadInProcess = 0x10;
67 }
68}
69
70unsafe impl Encode for AudioComponentFlags {
71 const ENCODING: Encoding = u32::ENCODING;
72}
73
74unsafe impl RefEncode for AudioComponentFlags {
75 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
76}
77
78/// Options controlling component instantiation.
79///
80/// Most component instances are loaded into the calling process.
81///
82/// A version 3 audio unit, however, can be loaded into a separate extension service process,
83/// and this is the default behavior for these components. To be able to load one in-process
84/// requires that the developer package the audio unit in a bundle separate from the application
85/// extension, since an extension's main binary cannot be dynamically loaded into another
86/// process.
87///
88/// A macOS host may request in-process loading of such audio units using
89/// kAudioComponentInstantiation_LoadInProcess.
90///
91/// kAudioComponentFlag_IsV3AudioUnit specifies whether an audio unit is implemented using API
92/// version 3.
93///
94/// These options are just requests to the implementation. It may fail and fall back to the
95/// default.
96///
97/// Attempt to load the component into a separate extension process.
98///
99/// Attempt to load the component into the current process. Only available on macOS.
100///
101/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentinstantiationoptions?language=objc)
102// NS_OPTIONS
103#[repr(transparent)]
104#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
105pub struct AudioComponentInstantiationOptions(pub u32);
106bitflags::bitflags! {
107 impl AudioComponentInstantiationOptions: u32 {
108 #[doc(alias = "kAudioComponentInstantiation_LoadOutOfProcess")]
109 const LoadOutOfProcess = 1;
110 #[doc(alias = "kAudioComponentInstantiation_LoadInProcess")]
111 const LoadInProcess = 2;
112 #[doc(alias = "kAudioComponentInstantiation_LoadedRemotely")]
113 const LoadedRemotely = 1<<31;
114 }
115}
116
117unsafe impl Encode for AudioComponentInstantiationOptions {
118 const ENCODING: Encoding = u32::ENCODING;
119}
120
121unsafe impl RefEncode for AudioComponentInstantiationOptions {
122 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
123}
124
125/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentdescription?language=objc)
126#[repr(C)]
127#[derive(Clone, Copy, Debug, PartialEq)]
128pub struct AudioComponentDescription {
129 pub componentType: OSType,
130 pub componentSubType: OSType,
131 pub componentManufacturer: OSType,
132 pub componentFlags: u32,
133 pub componentFlagsMask: u32,
134}
135
136unsafe impl Encode for AudioComponentDescription {
137 const ENCODING: Encoding = Encoding::Struct(
138 "AudioComponentDescription",
139 &[
140 <OSType>::ENCODING,
141 <OSType>::ENCODING,
142 <OSType>::ENCODING,
143 <u32>::ENCODING,
144 <u32>::ENCODING,
145 ],
146 );
147}
148
149unsafe impl RefEncode for AudioComponentDescription {
150 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
151}
152
153/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/opaqueaudiocomponent?language=objc)
154#[repr(C)]
155#[derive(Debug)]
156pub struct OpaqueAudioComponent {
157 inner: [u8; 0],
158 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
159}
160
161unsafe impl RefEncode for OpaqueAudioComponent {
162 const ENCODING_REF: Encoding =
163 Encoding::Pointer(&Encoding::Struct("OpaqueAudioComponent", &[]));
164}
165
166/// The type used to represent a class of particular audio components
167///
168/// An audio component is usually found through a search and is then uniquely
169/// identified by the triple of an audio component's type, subtype and
170/// manufacturer.
171///
172/// It can have properties associated with it (such as a name, a version).
173///
174/// It is then used as a factory (like a class in an object-oriented programming
175/// language) from which to create instances. The instances are used to do the
176/// actual work.
177///
178/// For example: the AudioComponentDescription 'aufx'/'dely'/'appl' describes the
179/// delay audio unit effect from Apple, Inc. You can find this component by
180/// searching explicitly for the audio component that matches this pattern (this is
181/// an unique identifier - there is only one match to this triple ID). Then once
182/// found, instances of the Apple delay effect audio unit can be created from its
183/// audio component and used to apply that effect to an audio signal. A single
184/// component can create any number of component instances.
185///
186/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponent?language=objc)
187pub type AudioComponent = *mut OpaqueAudioComponent;
188
189/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/opaqueaudiocomponentinstance?language=objc)
190#[repr(C)]
191#[derive(Debug)]
192pub struct OpaqueAudioComponentInstance {
193 inner: [u8; 0],
194 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
195}
196
197unsafe impl RefEncode for OpaqueAudioComponentInstance {
198 const ENCODING_REF: Encoding =
199 Encoding::Pointer(&Encoding::Struct("OpaqueAudioComponentInstance", &[]));
200}
201
202/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentinstance?language=objc)
203pub type AudioComponentInstance = *mut OpaqueAudioComponentInstance;
204
205/// Generic prototype for an audio plugin method.
206///
207/// Every audio plugin will implement a collection of methods that match a particular
208/// selector. For example, the AudioUnitInitialize API call is implemented by a
209/// plugin implementing the kAudioUnitInitializeSelect selector. Any function implementing
210/// an audio plugin selector conforms to the basic pattern where the first argument
211/// is a pointer to the plugin instance structure, has 0 or more specific arguments,
212/// and returns an OSStatus.
213///
214/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentmethod?language=objc)
215pub type AudioComponentMethod =
216 Option<unsafe extern "C-unwind" fn(NonNull<c_void>, ...) -> OSStatus>;
217
218/// A structure used to represent an audio plugin's routines
219///
220/// the function used to open (or create) an audio plugin instance
221///
222/// the function used to close (or dispose) an audio plugin instance
223///
224/// this is used to return a function pointer for a given selector,
225/// or NULL if that selector is not implemented
226///
227/// must be NULL
228///
229/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentplugininterface?language=objc)
230#[repr(C)]
231#[allow(unpredictable_function_pointer_comparisons)]
232#[derive(Clone, Copy, Debug, PartialEq)]
233pub struct AudioComponentPlugInInterface {
234 pub Open: unsafe extern "C-unwind" fn(NonNull<c_void>, AudioComponentInstance) -> OSStatus,
235 pub Close: unsafe extern "C-unwind" fn(NonNull<c_void>) -> OSStatus,
236 pub Lookup: unsafe extern "C-unwind" fn(i16) -> AudioComponentMethod,
237 pub reserved: *mut c_void,
238}
239
240unsafe impl Encode for AudioComponentPlugInInterface {
241 const ENCODING: Encoding = Encoding::Struct("AudioComponentPlugInInterface", &[
242 <unsafe extern "C-unwind" fn(NonNull<c_void>,AudioComponentInstance,) -> OSStatus>::ENCODING,
243 <unsafe extern "C-unwind" fn(NonNull<c_void>,) -> OSStatus>::ENCODING,
244 <unsafe extern "C-unwind" fn(i16,) -> AudioComponentMethod>::ENCODING,
245 <*mut c_void>::ENCODING,
246 ]);
247}
248
249unsafe impl RefEncode for AudioComponentPlugInInterface {
250 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
251}
252
253/// A function that creates AudioComponentInstances.
254///
255/// Authors of AudioComponents may register them from bundles as described
256/// above in the discussion of this header file, or dynamically within a single
257/// process, using AudioComponentRegister.
258///
259///
260/// Parameter `inDesc`: The AudioComponentDescription specifying the component to be instantiated.
261///
262/// Returns: A pointer to a AudioComponentPlugInInterface structure.
263///
264/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentfactoryfunction?language=objc)
265pub type AudioComponentFactoryFunction = Option<
266 unsafe extern "C-unwind" fn(
267 NonNull<AudioComponentDescription>,
268 ) -> *mut AudioComponentPlugInInterface,
269>;
270
271extern "C-unwind" {
272 /// Finds an audio component.
273 ///
274 /// This function is used to find an audio component that is the closest match
275 /// to the provided values. Note that the list of available components may change
276 /// dynamically in situations involving inter-app audio on iOS, or version 3
277 /// audio unit extensions. See kAudioComponentRegistrationsChangedNotification.
278 ///
279 ///
280 /// Parameter `inComponent`: If NULL, then the search starts from the beginning until an audio
281 /// component is found that matches the description provided by inDesc.
282 /// If non-NULL, then the search starts (continues) from the previously
283 /// found audio component specified by inComponent, and will return the next
284 /// found audio component.
285 ///
286 /// Parameter `inDesc`: The type, subtype and manufacturer fields are used to specify the audio
287 /// component to search for. A value of 0 (zero) for any of these fields is
288 /// a wildcard, so the first match found is returned.
289 ///
290 /// Returns: An audio component that matches the search parameters, or NULL if none found.
291 ///
292 /// # Safety
293 ///
294 /// - `in_component` must be a valid pointer or null.
295 /// - `in_desc` must be a valid pointer.
296 pub fn AudioComponentFindNext(
297 in_component: AudioComponent,
298 in_desc: NonNull<AudioComponentDescription>,
299 ) -> AudioComponent;
300}
301
302extern "C-unwind" {
303 /// Counts audio components.
304 ///
305 /// Returns the number of AudioComponents that match the specified
306 /// AudioComponentDescription.
307 ///
308 /// Parameter `inDesc`: The type, subtype and manufacturer fields are used to specify the audio
309 /// components to count A value of 0 (zero) for any of these fields is a
310 /// wildcard, so will match any value for this field
311 ///
312 /// Returns: a UInt32. 0 (zero) means no audio components were found that matched the
313 /// search parameters.
314 ///
315 /// # Safety
316 ///
317 /// `in_desc` must be a valid pointer.
318 pub fn AudioComponentCount(in_desc: NonNull<AudioComponentDescription>) -> u32;
319}
320
321extern "C-unwind" {
322 /// Retrieves the name of an audio component.
323 ///
324 /// the name of an audio component
325 ///
326 /// Parameter `inComponent`: the audio component (must not be NULL)
327 ///
328 /// Parameter `outName`: a CFString that is the name of the audio component. This string should
329 /// be released by the caller.
330 ///
331 /// Returns: an OSStatus result code.
332 ///
333 /// # Safety
334 ///
335 /// - `in_component` must be a valid pointer.
336 /// - `out_name` must be a valid pointer.
337 #[cfg(feature = "objc2-core-foundation")]
338 pub fn AudioComponentCopyName(
339 in_component: AudioComponent,
340 out_name: NonNull<*const CFString>,
341 ) -> OSStatus;
342}
343
344extern "C-unwind" {
345 /// Retrieve an audio component's description.
346 ///
347 /// This will return the fully specified audio component description for the
348 /// provided audio component.
349 ///
350 /// Parameter `inComponent`: the audio component (must not be NULL)
351 ///
352 /// Parameter `outDesc`: the audio component description for the specified audio component
353 ///
354 /// Returns: an OSStatus result code.
355 ///
356 /// # Safety
357 ///
358 /// - `in_component` must be a valid pointer.
359 /// - `out_desc` must be a valid pointer.
360 pub fn AudioComponentGetDescription(
361 in_component: AudioComponent,
362 out_desc: NonNull<AudioComponentDescription>,
363 ) -> OSStatus;
364}
365
366extern "C-unwind" {
367 /// Retrieve an audio component's version.
368 ///
369 /// Parameter `inComponent`: the audio component (must not be NULL)
370 ///
371 /// Parameter `outVersion`: the audio component's version in the form of 0xMMMMmmDD (Major, Minor, Dot)
372 ///
373 /// Returns: an OSStatus result code.
374 ///
375 /// # Safety
376 ///
377 /// - `in_component` must be a valid pointer.
378 /// - `out_version` must be a valid pointer.
379 pub fn AudioComponentGetVersion(
380 in_component: AudioComponent,
381 out_version: NonNull<u32>,
382 ) -> OSStatus;
383}
384
385extern "C-unwind" {
386 /// Creates an audio component instance.
387 ///
388 /// This function creates an instance of a given audio component. The audio
389 /// component instance is the object that does all of the work, whereas the
390 /// audio component is the way an application finds and then creates this object
391 /// to do this work. For example, an audio unit is a type of audio component
392 /// instance, so to use an audio unit, one finds its audio component, and then
393 /// creates a new instance of that component. This instance is then used to
394 /// perform the audio tasks for which it was designed (process, mix, synthesise,
395 /// etc.).
396 ///
397 /// Parameter `inComponent`: the audio component (must not be NULL)
398 ///
399 /// Parameter `outInstance`: the audio component instance
400 ///
401 /// Returns: an OSStatus result code.
402 ///
403 /// # Safety
404 ///
405 /// - `in_component` must be a valid pointer.
406 /// - `out_instance` must be a valid pointer.
407 pub fn AudioComponentInstanceNew(
408 in_component: AudioComponent,
409 out_instance: NonNull<AudioComponentInstance>,
410 ) -> OSStatus;
411}
412
413extern "C-unwind" {
414 /// Creates an audio component instance, asynchronously.
415 ///
416 /// This is an asynchronous version of AudioComponentInstanceNew(). It must be
417 /// used to instantiate any component with kAudioComponentFlag_RequiresAsyncInstantiation
418 /// set in its component flags. It may be used for other components as well.
419 ///
420 /// Note: Do not block the main thread while waiting for the completion handler
421 /// to be called; this can deadlock.
422 ///
423 /// Parameter `inComponent`: the audio component
424 ///
425 /// Parameter `inOptions`: see AudioComponentInstantiationOptions
426 ///
427 /// Parameter `inCompletionHandler`: called in an arbitrary thread context when instantiation is complete.
428 ///
429 /// # Safety
430 ///
431 /// `in_component` must be a valid pointer.
432 #[cfg(feature = "block2")]
433 pub fn AudioComponentInstantiate(
434 in_component: AudioComponent,
435 in_options: AudioComponentInstantiationOptions,
436 in_completion_handler: &block2::DynBlock<dyn Fn(AudioComponentInstance, OSStatus)>,
437 );
438}
439
440extern "C-unwind" {
441 /// Disposes of an audio component instance.
442 ///
443 /// This function will dispose the audio component instance that was created
444 /// with the New call. It will deallocate any resources that the instance was using.
445 ///
446 /// Parameter `inInstance`: the audio component instance to dispose (must not be NULL)
447 ///
448 /// Returns: an OSStatus result code.
449 ///
450 /// # Safety
451 ///
452 /// `in_instance` must be a valid pointer.
453 pub fn AudioComponentInstanceDispose(in_instance: AudioComponentInstance) -> OSStatus;
454}
455
456extern "C-unwind" {
457 /// Retrieve the audio component from its instance
458 ///
459 /// Allows the application at any time to retrieve the audio component that is
460 /// the factory object of a given instance (i.e., the audio component that was
461 /// used to create the instance in the first place). This allows the application
462 /// to retrieve general information about a particular audio component (its
463 /// name, version, etc) when one just has an audio component instance to work
464 /// with
465 ///
466 /// Parameter `inInstance`: the audio component instance (must not be NULL, and instance must be valid - that is, not disposed)
467 ///
468 /// Returns: a valid audio component or NULL if no component was found.
469 ///
470 /// # Safety
471 ///
472 /// `in_instance` must be a valid pointer.
473 pub fn AudioComponentInstanceGetComponent(
474 in_instance: AudioComponentInstance,
475 ) -> AudioComponent;
476}
477
478/// Determines if an audio component instance implements a particular component
479/// API call as signified by the specified selector identifier token.
480///
481/// Parameter `inInstance`: the audio component instance
482///
483/// Parameter `inSelectorID`: a number to signify the audio component API (component selector) as appropriate for the instance's component type.
484///
485/// Returns: a boolean
486///
487/// # Safety
488///
489/// `in_instance` must be a valid pointer.
490#[inline]
491pub unsafe extern "C-unwind" fn AudioComponentInstanceCanDo(
492 in_instance: AudioComponentInstance,
493 in_selector_id: i16,
494) -> bool {
495 extern "C-unwind" {
496 fn AudioComponentInstanceCanDo(
497 in_instance: AudioComponentInstance,
498 in_selector_id: i16,
499 ) -> Boolean;
500 }
501 let ret = unsafe { AudioComponentInstanceCanDo(in_instance, in_selector_id) };
502 ret != 0
503}
504
505extern "C-unwind" {
506 /// Dynamically registers an AudioComponent within the current process
507 ///
508 /// AudioComponents are registered either when found in appropriate bundles in the filesystem,
509 /// or via this call. AudioComponents registered via this call are available only within
510 /// the current process.
511 ///
512 ///
513 /// Parameter `inDesc`: The AudioComponentDescription that describes the AudioComponent. Note that
514 /// the registrar needs to be sure to set the flag kAudioComponentFlag_SandboxSafe
515 /// in the componentFlags field of the AudioComponentDescription to indicate that
516 /// the AudioComponent can be loaded directly into a sandboxed process.
517 ///
518 /// Parameter `inName`: the AudioComponent's name
519 ///
520 /// Parameter `inVersion`: the AudioComponent's version
521 ///
522 /// Parameter `inFactory`: an AudioComponentFactoryFunction which will create instances of your
523 /// AudioComponent
524 ///
525 /// Returns: an AudioComponent object
526 ///
527 /// # Safety
528 ///
529 /// - `in_desc` must be a valid pointer.
530 /// - `in_factory` must be implemented correctly.
531 #[cfg(feature = "objc2-core-foundation")]
532 pub fn AudioComponentRegister(
533 in_desc: NonNull<AudioComponentDescription>,
534 in_name: &CFString,
535 in_version: u32,
536 in_factory: AudioComponentFactoryFunction,
537 ) -> AudioComponent;
538}
539
540extern "C-unwind" {
541 /// Fetches the basic configuration info about a given AudioComponent
542 ///
543 /// Currently, only AudioUnits can supply this information.
544 ///
545 /// Parameter `inComponent`: The AudioComponent whose info is being fetched.
546 ///
547 /// Parameter `outConfigurationInfo`: On exit, this is CFDictionaryRef that contains information describing the
548 /// capabilities of the AudioComponent. The specific information depends on the
549 /// type of AudioComponent. The keys for the dictionary are defined in
550 /// AudioUnitProperties.h (or other headers as appropriate for the component type).
551 ///
552 /// Returns: An OSStatus indicating success or failure.
553 ///
554 /// # Safety
555 ///
556 /// - `in_component` must be a valid pointer.
557 /// - `out_configuration_info` must be a valid pointer.
558 #[cfg(feature = "objc2-core-foundation")]
559 pub fn AudioComponentCopyConfigurationInfo(
560 in_component: AudioComponent,
561 out_configuration_info: NonNull<*const CFDictionary>,
562 ) -> OSStatus;
563}
564
565/// Constants for describing the result of validating an AudioComponent
566///
567/// The AudioComponent passed validation.
568///
569/// The AudioComponent failed validation.
570///
571/// The validation operation timed out before completing.
572///
573/// The AudioComponent failed validation during open operation as it is not authorized.
574///
575/// The AudioComponent failed validation during initialization as it is not authorized.
576///
577/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiocomponentvalidationresult?language=objc)
578// NS_ENUM
579#[repr(transparent)]
580#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
581pub struct AudioComponentValidationResult(pub u32);
582impl AudioComponentValidationResult {
583 #[doc(alias = "kAudioComponentValidationResult_Unknown")]
584 pub const Unknown: Self = Self(0);
585 #[doc(alias = "kAudioComponentValidationResult_Passed")]
586 pub const Passed: Self = Self(1);
587 #[doc(alias = "kAudioComponentValidationResult_Failed")]
588 pub const Failed: Self = Self(2);
589 #[doc(alias = "kAudioComponentValidationResult_TimedOut")]
590 pub const TimedOut: Self = Self(3);
591 #[doc(alias = "kAudioComponentValidationResult_UnauthorizedError_Open")]
592 pub const UnauthorizedError_Open: Self = Self(4);
593 #[doc(alias = "kAudioComponentValidationResult_UnauthorizedError_Init")]
594 pub const UnauthorizedError_Init: Self = Self(5);
595}
596
597unsafe impl Encode for AudioComponentValidationResult {
598 const ENCODING: Encoding = u32::ENCODING;
599}
600
601unsafe impl RefEncode for AudioComponentValidationResult {
602 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
603}
604
605extern "C-unwind" {
606 /// # Safety
607 ///
608 /// - `in_component` must be a valid pointer.
609 /// - `in_validation_parameters` generics must be of the correct type.
610 /// - `out_validation_result` must be a valid pointer.
611 #[cfg(feature = "objc2-core-foundation")]
612 pub fn AudioComponentValidate(
613 in_component: AudioComponent,
614 in_validation_parameters: Option<&CFDictionary>,
615 out_validation_result: NonNull<AudioComponentValidationResult>,
616 ) -> OSStatus;
617}
618
619extern "C-unwind" {
620 /// Tests a specified AudioComponent for API and behavioral conformance
621 /// asynchronously, returning detailed validation results.
622 ///
623 /// Currently, only AudioUnits can can be validated. The `inCompletionHandler` callback
624 /// has two parameters, an `AudioComponentValidationResult` with result of the validation,
625 /// and a `CFDictionaryRef` which contains the details of this result.
626 /// This dictionary may contain the following entries:
627 /// "Output"
628 /// An array of strings, with the same content as if the AU was validated on auval.
629 /// "Result"
630 /// An `AudioComponentValidationResult` with the result of the validation
631 /// process. The same as what's in the `AudioComponentValidationResult`
632 /// in the `inCompletionHandler` and what `AudioComponentValidate`
633 /// currently returns.
634 /// "Tests"
635 /// An array in which each value is a dictionary and may contain:
636 /// "Name"
637 /// A descriptive name of the test.
638 /// "Result"
639 /// An `AudioComponentValidationResult` with the result of the
640 /// specific test.
641 /// "Output"
642 /// An array of strings with output generated by the test.
643 /// "WasCached"
644 /// `YES` if the returned result was cached from previous runs.
645 ///
646 /// Parameter `inComponent`: The AudioComponent to validate.
647 ///
648 /// Parameter `inValidationParameters`: A CFDictionaryRef that contains parameters for the validation operation.
649 /// Passing NULL for this argument tells the system to use the default
650 /// parameters.
651 ///
652 /// Parameter `inCompletionHandler`: Completion callback. See discussion section.
653 ///
654 /// Returns: an OSStatus result code.
655 ///
656 /// # Safety
657 ///
658 /// - `in_component` must be a valid pointer.
659 /// - `in_validation_parameters` generics must be of the correct type.
660 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
661 pub fn AudioComponentValidateWithResults(
662 in_component: AudioComponent,
663 in_validation_parameters: Option<&CFDictionary>,
664 in_completion_handler: &block2::DynBlock<
665 dyn Fn(AudioComponentValidationResult, NonNull<CFDictionary>),
666 >,
667 ) -> OSStatus;
668}