-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.cpp
40 lines (35 loc) · 1.24 KB
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "MidiFile.h"
#include "Options.h"
#include <iostream>
#include <iomanip>
using namespace std;
using namespace smf;
int main(int argc, char** argv) {
Options options;
options.process(argc, argv);
MidiFile midifile;
if (options.getArgCount() == 0) midifile.read(cin);
else midifile.read(options.getArg(1));
midifile.doTimeAnalysis();
midifile.linkNotePairs();
int tracks = midifile.getTrackCount();
cout << "TPQ: " << midifile.getTicksPerQuarterNote() << endl;
if (tracks > 1) cout << "TRACKS: " << tracks << endl;
for (int track=0; track<tracks; track++) {
if (tracks > 1) cout << "\nTrack " << track << endl;
cout << "Tick\tSeconds\tDur\tMessage" << endl;
for (int event=0; event<midifile[track].size(); event++) {
//if (!midifile[track][event].isNoteOn())
// continue;
cout << dec << midifile[track][event].tick;
cout << '\t' << dec << midifile[track][event].seconds;
cout << '\t';
//cout << midifile[track][event].getDurationInSeconds();
cout << '\t' << hex;
for (int i=0; i<midifile[track][event].size(); i++)
printf("%d ",(int)midifile[track][event][i]);
cout << endl;
}
}
return 0;
}