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