objc2_avf_audio/generated/
AVAudioUnitMIDIInstrument.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::*;
9#[cfg(feature = "objc2-core-midi")]
10use objc2_core_midi::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// Base class for MIDI instruments.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitmidiinstrument?language=objc)
19    #[unsafe(super(AVAudioUnit, AVAudioNode, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
22    pub struct AVAudioUnitMIDIInstrument;
23);
24
25#[cfg(all(
26    feature = "AVAudioMixing",
27    feature = "AVAudioNode",
28    feature = "AVAudioUnit"
29))]
30extern_conformance!(
31    unsafe impl AVAudio3DMixing for AVAudioUnitMIDIInstrument {}
32);
33
34#[cfg(all(
35    feature = "AVAudioMixing",
36    feature = "AVAudioNode",
37    feature = "AVAudioUnit"
38))]
39extern_conformance!(
40    unsafe impl AVAudioMixing for AVAudioUnitMIDIInstrument {}
41);
42
43#[cfg(all(
44    feature = "AVAudioMixing",
45    feature = "AVAudioNode",
46    feature = "AVAudioUnit"
47))]
48extern_conformance!(
49    unsafe impl AVAudioStereoMixing for AVAudioUnitMIDIInstrument {}
50);
51
52#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
53extern_conformance!(
54    unsafe impl NSObjectProtocol for AVAudioUnitMIDIInstrument {}
55);
56
57#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
58impl AVAudioUnitMIDIInstrument {
59    extern_methods!(
60        #[cfg(feature = "objc2-audio-toolbox")]
61        #[cfg(not(target_os = "watchos"))]
62        /// Initialize the node with the component description for an AUv2 Audio Unit.
63        ///
64        /// - Parameter description: audio component description structure that describes the audio component of type kAudioUnitType_MusicDevice
65        /// or kAudioUnitType_RemoteInstrument.
66        ///
67        /// - note: To load AUv3 audio units (or any audio unit asynchronously), use the class
68        /// method ``AVAudioUnit/instantiateWithComponentDescription:options:completionHandler:`` instead.
69        #[unsafe(method(initWithAudioComponentDescription:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithAudioComponentDescription(
72            this: Allocated<Self>,
73            description: AudioComponentDescription,
74        ) -> Retained<Self>;
75
76        /// Sends a MIDI Note On event to the instrument
77        ///
78        /// - Parameters:
79        /// - note: the note number (key) to play. Range: 0 -> 127
80        /// - velocity: specifies the volume with which the note is played. Range: 0 -> 127
81        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
82        #[unsafe(method(startNote:withVelocity:onChannel:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn startNote_withVelocity_onChannel(&self, note: u8, velocity: u8, channel: u8);
85
86        /// Sends a MIDI Note Off event to the instrument
87        ///
88        /// - Parameters:
89        /// - note: the note number (key) to stop. Range: 0 -> 127
90        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
91        #[unsafe(method(stopNote:onChannel:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn stopNote_onChannel(&self, note: u8, channel: u8);
94
95        /// Sends a MIDI controller event to the instrument.
96        ///
97        /// - Parameters:
98        /// - controller: a standard MIDI controller number. Range: 0 -> 127
99        /// - value: value for the controller. Range: 0 -> 127
100        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
101        #[unsafe(method(sendController:withValue:onChannel:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn sendController_withValue_onChannel(
104            &self,
105            controller: u8,
106            value: u8,
107            channel: u8,
108        );
109
110        /// Sends a MIDI controller event to the instrument.
111        ///
112        /// - Parameters:
113        /// - controller: a standard MIDI controller number. Range: 0 -> 127
114        /// - value: value for the controller. Range: 0 -> 127
115        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
116        #[unsafe(method(sendPitchBend:onChannel:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn sendPitchBend_onChannel(&self, pitchbend: u16, channel: u8);
119
120        /// Sends MIDI channel pressure event to the instrument.
121        ///
122        /// - Parameters:
123        /// - pressure: value of the pressure. Range: 0 -> 127
124        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
125        #[unsafe(method(sendPressure:onChannel:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn sendPressure_onChannel(&self, pressure: u8, channel: u8);
128
129        /// Sends MIDI Polyphonic key pressure event to the instrument
130        ///
131        /// - Parameters:
132        /// - key: the key (note) number to which the pressure event applies. Range: 0 -> 127
133        /// - value: value of the pressure. Range: 0 -> 127
134        /// - channel: the channel number to which the event is sent. Range: 0 -> 15so
135        #[unsafe(method(sendPressureForKey:withValue:onChannel:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn sendPressureForKey_withValue_onChannel(
138            &self,
139            key: u8,
140            value: u8,
141            channel: u8,
142        );
143
144        /// Sends MIDI Program Change event to the instrument
145        ///
146        /// The instrument will be loaded from the bank that has been previous set by MIDI Bank Select
147        /// controller messages (0 and 31). If none has been set, bank 0 will be used.
148        /// - Parameters:
149        /// - program: the program number. Range: 0 -> 127
150        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
151        #[unsafe(method(sendProgramChange:onChannel:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn sendProgramChange_onChannel(&self, program: u8, channel: u8);
154
155        /// Sends a MIDI Program Change and Bank Select events to the instrument
156        ///
157        /// - Parameters:
158        /// - program: specifies the program (preset) number within the bank to load. Range: 0 -> 127
159        /// - bankMSB: specifies the most significant byte value for the bank to select. Range: 0 -> 127
160        /// - bankLSB: specifies the least significant byte value for the bank to select. Range: 0 -> 127
161        /// - channel: the channel number to which the event is sent. Range: 0 -> 15
162        #[unsafe(method(sendProgramChange:bankMSB:bankLSB:onChannel:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn sendProgramChange_bankMSB_bankLSB_onChannel(
165            &self,
166            program: u8,
167            bank_msb: u8,
168            bank_lsb: u8,
169            channel: u8,
170        );
171
172        /// Sends a MIDI event which contains two data bytes to the instrument.
173        ///
174        /// - Parameters:
175        /// - midiStatus: the STATUS value of the MIDI event
176        /// - data1: the first data byte of the MIDI event
177        /// - data2: the second data byte of the MIDI event.
178        #[unsafe(method(sendMIDIEvent:data1:data2:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn sendMIDIEvent_data1_data2(&self, midi_status: u8, data1: u8, data2: u8);
181
182        /// Sends a MIDI event which contains one data byte to the instrument.
183        ///
184        /// - Parameters:
185        /// - midiStatus: the STATUS value of the MIDI event
186        /// - data1: the first data byte of the MIDI event
187        #[unsafe(method(sendMIDIEvent:data1:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn sendMIDIEvent_data1(&self, midi_status: u8, data1: u8);
190
191        /// Sends a MIDI System Exclusive event to the instrument.
192        ///
193        /// - Parameters:
194        /// - midiData: a NSData object containing the complete SysEx data including start(F0) and termination(F7) bytes.
195        #[unsafe(method(sendMIDISysExEvent:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn sendMIDISysExEvent(&self, midi_data: &NSData);
198
199        #[cfg(feature = "objc2-core-midi")]
200        /// Sends a MIDI event list to the instrument.
201        ///
202        /// - Parameters:
203        /// - eventList: the MIDIEventList
204        ///
205        /// # Safety
206        ///
207        /// `event_list` must be a valid pointer.
208        #[unsafe(method(sendMIDIEventList:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn sendMIDIEventList(&self, event_list: NonNull<MIDIEventList>);
211    );
212}
213
214/// Methods declared on superclass `NSObject`.
215#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
216impl AVAudioUnitMIDIInstrument {
217    extern_methods!(
218        #[unsafe(method(init))]
219        #[unsafe(method_family = init)]
220        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
221
222        #[unsafe(method(new))]
223        #[unsafe(method_family = new)]
224        pub unsafe fn new() -> Retained<Self>;
225    );
226}