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