Defines | Enumerations | Functions

midi.h File Reference

The main midi functions. More...

#include "midi_device.h"
#include "midi_function_types.h"

Go to the source code of this file.

Defines

#define SYSEX_BEGIN   0xF0
#define SYSEX_END   0xF7
#define MIDI_STATUSMASK   0x80
#define MIDI_CHANMASK   0x0F
#define MIDI_CC   0xB0
#define MIDI_NOTEON   0x90
#define MIDI_NOTEOFF   0x80
#define MIDI_AFTERTOUCH   0xA0
#define MIDI_PITCHBEND   0xE0
#define MIDI_PROGCHANGE   0xC0
#define MIDI_CHANPRESSURE   0xD0
#define MIDI_CLOCK   0xF8
#define MIDI_TICK   0xF9
#define MIDI_START   0xFA
#define MIDI_CONTINUE   0xFB
#define MIDI_STOP   0xFC
#define MIDI_ACTIVESENSE   0xFE
#define MIDI_RESET   0xFF
#define MIDI_TC_QUATERFRAME   0xF1
#define MIDI_SONGPOSITION   0xF2
#define MIDI_SONGSELECT   0xF3
#define MIDI_TUNEREQUEST   0xF6
#define SYSEX_EDUMANUFID   0x7D

Enumerations

enum  midi_packet_length_t { UNDEFINED = 0, ONE = 1, TWO = 2, THREE = 3 }

Functions

void midi_device_init (MidiDevice *device)
 Initialize a device.
void midi_device_process (MidiDevice *device)
 Process input data.
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.
void midi_send_noteon (MidiDevice *device, uint8_t chan, uint8_t num, uint8_t vel)
 Send a note on message via the given device.
void midi_send_noteoff (MidiDevice *device, uint8_t chan, uint8_t num, uint8_t vel)
 Send a note off message via the given device.
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.
void midi_send_pitchbend (MidiDevice *device, uint8_t chan, int16_t amt)
 Send a pitch bend message via the given device.
void midi_send_programchange (MidiDevice *device, uint8_t chan, uint8_t num)
 Send a program change message via the given device.
void midi_send_channelpressure (MidiDevice *device, uint8_t chan, uint8_t amt)
 Send a channel pressure message via the given device.
void midi_send_clock (MidiDevice *device)
 Send a clock message via the given device.
void midi_send_tick (MidiDevice *device)
 Send a tick message via the given device.
void midi_send_start (MidiDevice *device)
 Send a start message via the given device.
void midi_send_continue (MidiDevice *device)
 Send a continue message via the given device.
void midi_send_stop (MidiDevice *device)
 Send a stop message via the given device.
void midi_send_activesense (MidiDevice *device)
 Send an active sense message via the given device.
void midi_send_reset (MidiDevice *device)
 Send a reset message via the given device.
void midi_send_tcquaterframe (MidiDevice *device, uint8_t time)
 Send a tc quarter frame message via the given device.
void midi_send_songposition (MidiDevice *device, uint16_t pos)
 Send a song position message via the given device.
void midi_send_songselect (MidiDevice *device, uint8_t song)
 Send a song select message via the given device.
void midi_send_tunerequest (MidiDevice *device)
 Send a tune request message via the given device.
void midi_send_byte (MidiDevice *device, uint8_t b)
 Send a byte via the given device.
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.
void midi_register_cc_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register a control change message (cc) callback.
void midi_register_noteon_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register a note on callback.
void midi_register_noteoff_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register a note off callback.
void midi_register_aftertouch_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register an after touch callback.
void midi_register_pitchbend_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register a pitch bend callback.
void midi_register_songposition_callback (MidiDevice *device, midi_three_byte_func_t func)
 Register a song position callback.
void midi_register_progchange_callback (MidiDevice *device, midi_two_byte_func_t func)
 Register a program change callback.
void midi_register_chanpressure_callback (MidiDevice *device, midi_two_byte_func_t func)
 Register a channel pressure callback.
void midi_register_songselect_callback (MidiDevice *device, midi_two_byte_func_t func)
 Register a song select callback.
void midi_register_tc_quarterframe_callback (MidiDevice *device, midi_two_byte_func_t func)
 Register a tc quarter frame callback.
void midi_register_realtime_callback (MidiDevice *device, midi_one_byte_func_t func)
 Register a realtime callback.
void midi_register_tunerequest_callback (MidiDevice *device, midi_one_byte_func_t func)
 Register a tune request callback.
void midi_register_sysex_callback (MidiDevice *device, midi_var_byte_func_t func)
 Register a sysex callback.
void midi_register_fallthrough_callback (MidiDevice *device, midi_var_byte_func_t func)
 Register fall through callback.
void midi_register_catchall_callback (MidiDevice *device, midi_var_byte_func_t func)
 Register a catch all callback.
bool midi_is_statusbyte (uint8_t theByte)
 Test to see if the byte given is a status byte.
bool midi_is_realtime (uint8_t theByte)
 Test to see if the byte given is a realtime message.
midi_packet_length_t midi_packet_length (uint8_t status)
 Find the length of the packet associated with the status byte given.

Detailed Description

The main midi functions.

This file includes all of the functions you need to set up and process a midi device, send midi, and register midi callbacks.