qmk_firmware-mirror/docs/internals/send_functions.md

13 KiB

group send_functions

These are the functions you use to send midi data through a device.

Summary

Members Descriptions
public void midi_send_cc(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t val) Send a control change message (cc) via the given device.
public void midi_send_noteon(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t vel) Send a note on message via the given device.
public void midi_send_noteoff(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t vel) Send a note off message via the given device.
public void midi_send_aftertouch(MidiDevice * device,uint8_t chan,uint8_t note_num,uint8_t amt) Send an after touch message via the given device.
public void midi_send_pitchbend(MidiDevice * device,uint8_t chan,int16_t amt) Send a pitch bend message via the given device.
public void midi_send_programchange(MidiDevice * device,uint8_t chan,uint8_t num) Send a program change message via the given device.
public void midi_send_channelpressure(MidiDevice * device,uint8_t chan,uint8_t amt) Send a channel pressure message via the given device.
public void midi_send_clock(MidiDevice * device) Send a clock message via the given device.
public void midi_send_tick(MidiDevice * device) Send a tick message via the given device.
public void midi_send_start(MidiDevice * device) Send a start message via the given device.
public void midi_send_continue(MidiDevice * device) Send a continue message via the given device.
public void midi_send_stop(MidiDevice * device) Send a stop message via the given device.
public void midi_send_activesense(MidiDevice * device) Send an active sense message via the given device.
public void midi_send_reset(MidiDevice * device) Send a reset message via the given device.
public void midi_send_tcquarterframe(MidiDevice * device,uint8_t time) Send a tc quarter frame message via the given device.
public void midi_send_songposition(MidiDevice * device,uint16_t pos) Send a song position message via the given device.
public void midi_send_songselect(MidiDevice * device,uint8_t song) Send a song select message via the given device.
public void midi_send_tunerequest(MidiDevice * device) Send a tune request message via the given device.
public void midi_send_byte(MidiDevice * device,uint8_t b) Send a byte via the given device.
public void midi_send_data(MidiDevice * device,uint16_t count,uint8_t byte0,uint8_t byte1,uint8_t byte2) Send up to 3 bytes of data.
public void midi_send_array(MidiDevice * device,uint16_t count,uint8_t * array) Send an array of formatted midi data.

Members

public void midi_send_cc(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t val)

Send a control change message (cc) via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • num the cc num

  • val the value of that cc num

public void midi_send_noteon(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t vel)

Send a note on message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • num the note number

  • vel the note velocity

public void midi_send_noteoff(MidiDevice * device,uint8_t chan,uint8_t num,uint8_t vel)

Send a note off message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • num the note number

  • vel the note velocity

public void midi_send_aftertouch(MidiDevice * device,uint8_t chan,uint8_t note_num,uint8_t amt)

Send an after touch message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • note_num the note number

  • amt the after touch amount

public void midi_send_pitchbend(MidiDevice * device,uint8_t chan,int16_t amt)

Send a pitch bend message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • amt the bend amount range: -8192..8191, 0 means no bend

public void midi_send_programchange(MidiDevice * device,uint8_t chan,uint8_t num)

Send a program change message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • num the program to change to

public void midi_send_channelpressure(MidiDevice * device,uint8_t chan,uint8_t amt)

Send a channel pressure message via the given device.

Parameters

  • device the device to use for sending

  • chan the channel to send on, 0-15

  • amt the amount of channel pressure

public void midi_send_clock(MidiDevice * device)

Send a clock message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_tick(MidiDevice * device)

Send a tick message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_start(MidiDevice * device)

Send a start message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_continue(MidiDevice * device)

Send a continue message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_stop(MidiDevice * device)

Send a stop message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_activesense(MidiDevice * device)

Send an active sense message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_reset(MidiDevice * device)

Send a reset message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_tcquarterframe(MidiDevice * device,uint8_t time)

Send a tc quarter frame message via the given device.

Parameters

  • device the device to use for sending

  • time the time of this quarter frame, range 0..16383

public void midi_send_songposition(MidiDevice * device,uint16_t pos)

Send a song position message via the given device.

Parameters

  • device the device to use for sending

  • pos the song position

public void midi_send_songselect(MidiDevice * device,uint8_t song)

Send a song select message via the given device.

Parameters

  • device the device to use for sending

  • song the song to select

public void midi_send_tunerequest(MidiDevice * device)

Send a tune request message via the given device.

Parameters

  • device the device to use for sending

public void midi_send_byte(MidiDevice * device,uint8_t b)

Send a byte via the given device.

This is a generic method for sending data via the given midi device. This would be useful for sending sysex data or messages that are not implemented in this API, if there are any. Please contact the author if you find some so we can add them.

Parameters

  • device the device to use for sending

  • b the byte to send

public void midi_send_data(MidiDevice * device,uint16_t count,uint8_t byte0,uint8_t byte1,uint8_t byte2)

Send up to 3 bytes of data.

% 4 is applied to count so that you can use this to pass sysex through

Parameters

  • device the device to use for sending

  • count the count of bytes to send, %4 is applied

  • byte0 the first byte

  • byte1 the second byte, ignored if cnt % 4 != 2

  • byte2 the third byte, ignored if cnt % 4 != 3

public void midi_send_array(MidiDevice * device,uint16_t count,uint8_t * array)

Send an array of formatted midi data.

Can be used for sysex.

Parameters

  • device the device to use for sending

  • count the count of bytes to send

  • array the array of bytes