- running status detection
[midifile] / src / midi.h
index 4ad08a4..96fefa8 100644 (file)
@@ -3,9 +3,27 @@
 
 #include <stdio.h>
 
-struct midi;
-struct midi_track;
-struct midi_event;
+struct midi {
+       int bpm;
+
+       int num_tracks;
+       struct midi_track *tracks;
+};
+
+struct midi_track {
+       char *name;
+       struct midi_event *head, *tail;
+       int num_ev;
+};
+
+struct midi_event {
+       long dt;
+       int type;
+       int channel;
+       int arg[2];
+
+       struct midi_event *next;
+};
 
 #define MIDI_NOTE_OFF                  8
 #define MIDI_NOTE_ON                   9
@@ -15,6 +33,9 @@ struct midi_event;
 #define MIDI_CHAN_AFTERTOUCH   13
 #define MIDI_PITCH_BEND                        14
 
+#define MIDI_NOTE_NUM(ev)      ((ev)->arg[0])
+#define MIDI_NOTE_VEL(ev)      ((ev)->arg[1])
+
 #ifdef __cplusplus
 extern "C" {
 #endif