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
//! 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_class!(
/// An AVAudioNode implemented by an audio unit.
///
/// An AVAudioUnit is an AVAudioNode implemented by an audio unit. Depending on the type of
/// the audio unit, audio is processed either in real-time or non real-time.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounit?language=objc)
#[unsafe(super(AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAudioNode")]
pub struct AVAudioUnit;
);
#[cfg(feature = "AVAudioNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioUnit {}
);
#[cfg(feature = "AVAudioNode")]
impl AVAudioUnit {
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-audio-toolbox"))]
#[cfg(not(target_os = "watchos"))]
/// Asynchronously create an instance of an audio unit component, wrapped in an AVAudioUnit.
///
/// Parameter `audioComponentDescription`: The component to instantiate.
///
/// Parameter `options`: Instantiation options.
///
/// Parameter `completionHandler`: Called in an arbitrary thread/queue context when instantiation is complete. The client
/// should retain the provided AVAudioUnit.
///
/// Components whose flags include kAudioComponentFlag_RequiresAsyncInstantiation must be
/// instantiated asynchronously, via this method if they are to be used with AVAudioEngine.
/// See the discussion of this flag in AudioToolbox/AudioComponent.h.
///
/// The returned AVAudioUnit instance normally will be of a subclass (AVAudioUnitEffect,
/// AVAudioUnitGenerator, AVAudioUnitMIDIInstrument, or AVAudioUnitTimeEffect), selected
/// according to the component's type.
#[unsafe(method(instantiateWithComponentDescription:options:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn instantiateWithComponentDescription_options_completionHandler(
audio_component_description: AudioComponentDescription,
options: AudioComponentInstantiationOptions,
completion_handler: &block2::DynBlock<dyn Fn(*mut AVAudioUnit, *mut NSError)>,
);
/// Load an audio unit preset.
///
/// Parameter `url`: NSURL of the .aupreset file.
///
/// Parameter `outError`: A pointer to a NSError object
///
/// If the .aupreset file cannot be successfully loaded, an error is returned.
#[unsafe(method(loadAudioUnitPresetAtURL:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn loadAudioUnitPresetAtURL_error(
&self,
url: &NSURL,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
/// AudioComponentDescription of the underlying audio unit.
#[unsafe(method(audioComponentDescription))]
#[unsafe(method_family = none)]
pub unsafe fn audioComponentDescription(&self) -> AudioComponentDescription;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
/// Reference to the underlying audio unit.
///
/// A reference to the underlying audio unit is provided so that parameters that are not
/// exposed by AVAudioUnit subclasses can be modified using the AudioUnit C API.
///
/// No operations that may conflict with state maintained by the engine should be performed
/// directly on the audio unit. These include changing initialization state, stream formats,
/// channel layouts or connections to other audio units.
#[unsafe(method(audioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn audioUnit(&self) -> AudioUnit;
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
/// An AUAudioUnit wrapping or underlying the implementation's AudioUnit.
///
/// This provides an AUAudioUnit which either wraps or underlies the implementation's
/// AudioUnit, depending on how that audio unit is packaged. Applications can interact with this
/// AUAudioUnit to control custom properties, select presets, change parameters, etc.
///
/// As with the audioUnit property, no operations that may conflict with state maintained by the
/// engine should be performed directly on the audio unit. These include changing initialization
/// state, stream formats, channel layouts or connections to other audio units.
#[unsafe(method(AUAudioUnit))]
#[unsafe(method_family = none)]
pub unsafe fn AUAudioUnit(&self) -> Retained<AUAudioUnit>;
/// Name of the audio unit.
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Retained<NSString>;
/// Manufacturer name of the audio unit.
#[unsafe(method(manufacturerName))]
#[unsafe(method_family = none)]
pub unsafe fn manufacturerName(&self) -> Retained<NSString>;
/// Version number of the audio unit.
#[unsafe(method(version))]
#[unsafe(method_family = none)]
pub unsafe fn version(&self) -> NSUInteger;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "AVAudioNode")]
impl AVAudioUnit {
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>;
);
}