-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNoteListProcessor.h
70 lines (62 loc) · 1.54 KB
/
NoteListProcessor.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef __NOTE_LIST_PROCESSOR__
#define __NOTE_LIST_PROCESSOR__
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <vector>
#include <fstream>
#include <cstdlib>
#include <iomanip>
#include <algorithm> // remove and remove_if
#include <map>
#include "MidiFile.h"
#include "bprinter/table_printer.h"
using namespace std;
using namespace smf;
namespace noteListProcessor
{
class MidiHelper
{
public:
MidiHelper(string midifilePath);
~MidiHelper();
void getTickNoteMap(map<int, vector<int>> &tickNoteMap);
private:
int tickPerSecond = 120;
string midiFilePath;
};
class NoteListProcessor
{
public:
int highestPitch;
int lowestPitch;
int validHighestPitch = 127;
int validLowestPitch = 0;
int recommHighestPitch = 120;
int recommLowestPitch = 45;
int suggestTranpose;
int offestToMidiPitch = 0;
double midiDuration;
map<int, int> noteOccurTimesMap;
int centroidPitch = 0;
std::ostream *defaultOutput;
NoteListProcessor(string midifilePath, std::ostream *outputStream = &(std::cout));
~NoteListProcessor();
void setExternTranspose(int t);
void analyzeNoteMap();
void analyzeNoteMapByCentroid();
void transposeTickNoteMap();
void generateBin(vector<char> &mem);
void generateDeltaBin(vector<char> &mem);
private:
map<int, vector<int>> tickNoteMap;
map<int, vector<int>> tickNoteMapTransposed;
string pitchName[129];
bool useExternTransposeParam = false;
int externTransposeParam = 0;
void InitPitchName();
void printAnalyzeResult();
};
} // namespace noteListProcessor
#endif