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