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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
//! 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::*;
#[cfg(feature = "objc2-core-midi")]
use objc2_core_midi::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Base class for MIDI instruments.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudiounitmidiinstrument?language=objc)
#[unsafe(super(AVAudioUnit, AVAudioNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
pub struct AVAudioUnitMIDIInstrument;
);
#[cfg(all(
feature = "AVAudioMixing",
feature = "AVAudioNode",
feature = "AVAudioUnit"
))]
extern_conformance!(
unsafe impl AVAudio3DMixing for AVAudioUnitMIDIInstrument {}
);
#[cfg(all(
feature = "AVAudioMixing",
feature = "AVAudioNode",
feature = "AVAudioUnit"
))]
extern_conformance!(
unsafe impl AVAudioMixing for AVAudioUnitMIDIInstrument {}
);
#[cfg(all(
feature = "AVAudioMixing",
feature = "AVAudioNode",
feature = "AVAudioUnit"
))]
extern_conformance!(
unsafe impl AVAudioStereoMixing for AVAudioUnitMIDIInstrument {}
);
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
extern_conformance!(
unsafe impl NSObjectProtocol for AVAudioUnitMIDIInstrument {}
);
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
impl AVAudioUnitMIDIInstrument {
extern_methods!(
#[cfg(feature = "objc2-audio-toolbox")]
#[cfg(not(target_os = "watchos"))]
/// Initialize the node with the component description for an AUv2 Audio Unit.
///
/// - Parameter description: audio component description structure that describes the audio component of type kAudioUnitType_MusicDevice
/// or kAudioUnitType_RemoteInstrument.
///
/// - note: To load AUv3 audio units (or any audio unit asynchronously), use the class
/// method ``AVAudioUnit/instantiateWithComponentDescription:options:completionHandler:`` instead.
#[unsafe(method(initWithAudioComponentDescription:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithAudioComponentDescription(
this: Allocated<Self>,
description: AudioComponentDescription,
) -> Retained<Self>;
/// Sends a MIDI Note On event to the instrument
///
/// - Parameters:
/// - note: the note number (key) to play. Range: 0 -> 127
/// - velocity: specifies the volume with which the note is played. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(startNote:withVelocity:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn startNote_withVelocity_onChannel(&self, note: u8, velocity: u8, channel: u8);
/// Sends a MIDI Note Off event to the instrument
///
/// - Parameters:
/// - note: the note number (key) to stop. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(stopNote:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn stopNote_onChannel(&self, note: u8, channel: u8);
/// Sends a MIDI controller event to the instrument.
///
/// - Parameters:
/// - controller: a standard MIDI controller number. Range: 0 -> 127
/// - value: value for the controller. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(sendController:withValue:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendController_withValue_onChannel(
&self,
controller: u8,
value: u8,
channel: u8,
);
/// Sends a MIDI controller event to the instrument.
///
/// - Parameters:
/// - controller: a standard MIDI controller number. Range: 0 -> 127
/// - value: value for the controller. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(sendPitchBend:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendPitchBend_onChannel(&self, pitchbend: u16, channel: u8);
/// Sends MIDI channel pressure event to the instrument.
///
/// - Parameters:
/// - pressure: value of the pressure. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(sendPressure:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendPressure_onChannel(&self, pressure: u8, channel: u8);
/// Sends MIDI Polyphonic key pressure event to the instrument
///
/// - Parameters:
/// - key: the key (note) number to which the pressure event applies. Range: 0 -> 127
/// - value: value of the pressure. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15so
#[unsafe(method(sendPressureForKey:withValue:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendPressureForKey_withValue_onChannel(
&self,
key: u8,
value: u8,
channel: u8,
);
/// Sends MIDI Program Change event to the instrument
///
/// The instrument will be loaded from the bank that has been previous set by MIDI Bank Select
/// controller messages (0 and 31). If none has been set, bank 0 will be used.
/// - Parameters:
/// - program: the program number. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(sendProgramChange:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendProgramChange_onChannel(&self, program: u8, channel: u8);
/// Sends a MIDI Program Change and Bank Select events to the instrument
///
/// - Parameters:
/// - program: specifies the program (preset) number within the bank to load. Range: 0 -> 127
/// - bankMSB: specifies the most significant byte value for the bank to select. Range: 0 -> 127
/// - bankLSB: specifies the least significant byte value for the bank to select. Range: 0 -> 127
/// - channel: the channel number to which the event is sent. Range: 0 -> 15
#[unsafe(method(sendProgramChange:bankMSB:bankLSB:onChannel:))]
#[unsafe(method_family = none)]
pub unsafe fn sendProgramChange_bankMSB_bankLSB_onChannel(
&self,
program: u8,
bank_msb: u8,
bank_lsb: u8,
channel: u8,
);
/// Sends a MIDI event which contains two data bytes to the instrument.
///
/// - Parameters:
/// - midiStatus: the STATUS value of the MIDI event
/// - data1: the first data byte of the MIDI event
/// - data2: the second data byte of the MIDI event.
#[unsafe(method(sendMIDIEvent:data1:data2:))]
#[unsafe(method_family = none)]
pub unsafe fn sendMIDIEvent_data1_data2(&self, midi_status: u8, data1: u8, data2: u8);
/// Sends a MIDI event which contains one data byte to the instrument.
///
/// - Parameters:
/// - midiStatus: the STATUS value of the MIDI event
/// - data1: the first data byte of the MIDI event
#[unsafe(method(sendMIDIEvent:data1:))]
#[unsafe(method_family = none)]
pub unsafe fn sendMIDIEvent_data1(&self, midi_status: u8, data1: u8);
/// Sends a MIDI System Exclusive event to the instrument.
///
/// - Parameters:
/// - midiData: a NSData object containing the complete SysEx data including start(F0) and termination(F7) bytes.
#[unsafe(method(sendMIDISysExEvent:))]
#[unsafe(method_family = none)]
pub unsafe fn sendMIDISysExEvent(&self, midi_data: &NSData);
#[cfg(feature = "objc2-core-midi")]
/// Sends a MIDI event list to the instrument.
///
/// - Parameters:
/// - eventList: the MIDIEventList
///
/// # Safety
///
/// `event_list` must be a valid pointer.
#[unsafe(method(sendMIDIEventList:))]
#[unsafe(method_family = none)]
pub unsafe fn sendMIDIEventList(&self, event_list: NonNull<MIDIEventList>);
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "AVAudioNode", feature = "AVAudioUnit"))]
impl AVAudioUnitMIDIInstrument {
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>;
);
}