Audacity  2.2.0
ImportMIDI.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ImportMIDI.h
6 
7  Dominic Mazzoni
8 
9 *******************************************************************//*******************************************************************/
16 
17 
18 #ifndef _IMPORT_MIDI_
19 #define _IMPORT_MIDI_
20 
21 #include "../Audacity.h"
22 
23 #if defined(USE_MIDI)
24 
25 class wxString;
26 class NoteTrack;
27 
28 bool ImportMIDI(const wxString &fName, NoteTrack * dest);
29 
30 class MIDIParser {
31  public:
32  MIDIParser();
33 
34  void Parse();
35 
36  unsigned char *buffer;
37  int bufferLen;
38  int index;
39 
40  NoteTrack *noteTrack;
41 
42  int midifile_error;
43 
44  int keys[16][128];
45  int division;
46  double tempo;
47 
48  private:
49 
50  int check_aborted(void);
51 
52  int Mf_getc(void);
53  void Mf_error(char *);
54  void Mf_on(int, int, int);
55  void Mf_off(int, int, int);
56  void Mf_header(int, int, int);
57  void Mf_tempo(int);
58 
59  void Mf_starttrack(void) {}
60  void Mf_endtrack(void) {}
61  void Mf_eot(void) {}
62  void Mf_pressure(int, int, int) {}
63  void Mf_controller(int, int, int) {}
64  void Mf_pitchbend(int, int, int) {}
65  void Mf_program(int, int) {}
66  void Mf_chanpressure(int, int) {}
67  void Mf_sysex(int, char *) {}
68  void Mf_arbitrary(int, char *) {}
69  void Mf_metamisc(int, int, char *) {}
70  void Mf_seqnum(int) {}
71  void Mf_smpte(int, int, int, int, int) {}
72  void Mf_timesig(int, int, int, int) {}
73  void Mf_keysig(int, int) {}
74  void Mf_sqspecific(int, char *) {}
75  void Mf_text(int, int, char *) {}
76 
77  int Mf_nomerge; /* 1 => continue'ed system exclusives are */
78  /* not collapsed. */
79  long Mf_currtime; /* current time in delta-time units */
80  int Mf_skipinit;
81 
82  long Mf_toberead;
83 
84  int abort_flag;
85 
86  long readvarinum(void);
87  long read32bit(void);
88  int read16bit(void);
89  void msgenlarge(void);
90  char *msg(void);
91  int readheader(void);
92  void readtrack(void);
93  void sysex(void);
94  void msginit(void);
95  int egetc(void);
96  int msgleng(void);
97 
98  int readmt(char *, int);
99  long to32bit(int, int, int, int);
100  int to16bit(int, int);
101  void mferror(char *);
102  void badbyte(int);
103  void metaevent(int);
104  void msgadd(int);
105  void chanmessage(int, int, int);
106 
107  char *Msgbuff; /* message buffer */
108  int Msgsize; /* Size of currently allocated Msg */
109  int Msgindex; /* index of next available location in Msg */
110 };
111 
112 #endif
113 
114 #endif
Unused class that might someday be used again to read MIDI files into a NoteTrack.
A Track that is used for Midi notes. (Somewhat old code).