Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef MIDI_DEVICE_H
00025 #define MIDI_DEVICE_H
00026
00046 #include "midi_function_types.h"
00047 #include "bytequeue/bytequeue.h"
00048 #define MIDI_INPUT_QUEUE_LENGTH 192
00049
00050 typedef enum {
00051 IDLE,
00052 ONE_BYTE_MESSAGE = 1,
00053 TWO_BYTE_MESSAGE = 2,
00054 THREE_BYTE_MESSAGE = 3,
00055 SYSEX_MESSAGE} input_state_t;
00056
00057 typedef void (* midi_no_byte_func_t)(MidiDevice * device);
00058
00069 struct _midi_device {
00070
00071 midi_var_byte_func_t send_func;
00072
00073
00074
00075 midi_three_byte_func_t input_cc_callback;
00076 midi_three_byte_func_t input_noteon_callback;
00077 midi_three_byte_func_t input_noteoff_callback;
00078 midi_three_byte_func_t input_aftertouch_callback;
00079 midi_three_byte_func_t input_pitchbend_callback;
00080 midi_three_byte_func_t input_songposition_callback;
00081
00082 midi_two_byte_func_t input_progchange_callback;
00083 midi_two_byte_func_t input_chanpressure_callback;
00084 midi_two_byte_func_t input_songselect_callback;
00085 midi_two_byte_func_t input_tc_quaterframe_callback;
00086
00087 midi_one_byte_func_t input_realtime_callback;
00088 midi_one_byte_func_t input_tunerequest_callback;
00089
00090
00091 midi_var_byte_func_t input_sysex_callback;
00092
00093
00094 midi_var_byte_func_t input_fallthrough_callback;
00095
00096 midi_var_byte_func_t input_catchall_callback;
00097
00098
00099 midi_no_byte_func_t pre_input_process_callback;
00100
00101
00102 uint8_t input_buffer[3];
00103 input_state_t input_state;
00104 uint16_t input_count;
00105
00106
00107 uint8_t input_queue_data[MIDI_INPUT_QUEUE_LENGTH];
00108 byteQueue_t input_queue;
00109 };
00110
00123 void midi_device_input(MidiDevice * device, uint8_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2);
00124
00135 void midi_device_set_send_func(MidiDevice * device, midi_var_byte_func_t send_func);
00136
00146 void midi_device_set_pre_input_process_func(MidiDevice * device, midi_no_byte_func_t pre_process_func);
00147
00150 #endif