#ifndef _MIDI_H
#define _MIDI_H

#define MIDI_NOTE_ON 	0x90
#define MIDI_NOTE_OFF 	0x80

// 1010cccc 0nnnnnnn 0vvvvvvv
#define MIDI_POLY_TOUCH 	0xA0
// 1011cccc 0nnnnnnn 0vvvvvvv
#define MIDI_CONTROL_CHANGE	0xB0
// 1100cccc 0ppppppp
#define MIDI_PROGRAM_CHANGE	0xC0

#define MIDI_CHANNEL_TOUCH	0xD0

#define MIDI_PITCH_BEND	        0xE0

#define MIDI_DATA_MASK			0x7F
#define MIDI_STATUS_MASK		0xF0
#define MIDI_CHANNEL_MASK		0x0F

#define MIDI_BAUD_RATE			31250

#include "global.h"
#include "buffer.h"

void midiInit(void);
u08 midiNoteOnOut(u08 note, u08 vel, u08 channel);
u08 midiNoteOffOut(u08 note, u08 vel, u08 channel);
u08 midiControlChangeOut(u08 controller, u08 value, u08 channel);
u08 midiProgramChangeOut(u08 program, u08 channel);
u08 midiPolyTouchOut(u08 note, u08 pressure, u08 channel);
u08 midiChannelTouchOut(u08 pressure, u08 channel);
u08 midiPitchBendOut(u08 bendLSB, u08 bendMSB, u08 channel);

#endif
