FastLED 3.9.15
Loading...
Searching...
No Matches

◆ send() [2/2]

template<class Transport, class Settings, class Platform>
void MidiInterface< Transport, Settings, Platform >::send ( MidiType inType,
DataByte inData1,
DataByte inData2,
Channel inChannel )

Generate and send a MIDI message from the values given.

Parameters
inTypeThe message type (see type defines for reference)
inData1The first data byte.
inData2The second data byte (if the message contains only 1 data byte, set this one to 0).
inChannelThe output channel on which the message will be sent (values from 1 to 16). Note: you cannot send to OMNI.

This is an internal method, use it only if you need to send raw data from your code, at your own risks.

Definition at line 160 of file MIDI.hpp.

164{
165 if (inType <= PitchBend) // Channel messages
166 {
167 // Then test if channel is valid
170 inType < 0x80)
171 {
172 return; // Don't send anything
173 }
174 // Protection: remove MSBs on data
175 inData1 &= 0x7f;
176 inData2 &= 0x7f;
177
179
180 if (mTransport.beginTransmission(inType))
181 {
183 {
185 {
186 // New message, memorise and send header
189 }
190 }
191 else
192 {
193 // Don't care about running status, send the status byte.
194 mTransport.write(status);
195 }
196
197 // Then send data
198 mTransport.write(inData1);
200 {
201 mTransport.write(inData2);
202 }
203
204 mTransport.endTransmission();
206 }
207 }
208 else if (inType >= Clock && inType <= SystemReset)
209 {
210 sendRealTime(inType); // System Real-time and 1 byte.
211 }
212}
StatusByte getStatus(MidiType inType, Channel inChannel) const
Definition MIDI.hpp:681
Transport & mTransport
Definition MIDI.h:267
StatusByte mRunningStatus_TX
Definition MIDI.h:275
The main class for MIDI handling. It is templated over the type of serial port to provide abstraction...
Definition MIDI.h:55
void sendRealTime(MidiType inType)
Send a Real Time (one byte) message.
Definition MIDI.hpp:492
void UpdateLastSentTime()
Definition MIDI.hpp:1385

References AfterTouchChannel, Clock, getStatus(), MIDI_CHANNEL_OFF, MIDI_CHANNEL_OMNI, mRunningStatus_TX, mTransport, PitchBend, ProgramChange, sendRealTime(), SystemReset, and UpdateLastSentTime().

+ Here is the call graph for this function: