This repository has been archived by the owner on Jun 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
type.h
79 lines (69 loc) · 1.67 KB
/
type.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
71
72
73
74
75
76
77
78
79
#pragma once
#include "cv.h"
#include "highgui.h"
#include "cvaux.h"
#include "cxcore.h"
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc.hpp"
#include "tinyxml2.h"
#include <iostream>
#include<vector>
typedef struct space {
int start;
int length;
}space;
enum Value {
whole = 32,
half = 16,
quarter = 8,
eighth = 4,
sixteenth = 2,
thirty_second = 1
};
typedef struct technical {
int string; //弦
int fret; //品
}technical;
typedef struct notations {
int dynamics; //力度
technical technical;
}notations;
typedef struct note {
bool chord = false; //和声标记,为true与上一个音符同时发声
std::vector<int> possible; //其他可能的品数
Value timeValue = quarter; //时值
bool dot = false; //附点
int voice = 1; //发声类型
int duration = 1; //延音值
notations notation;
int pos; //x坐标
}note;
typedef struct Time {
int beats = 4; //每小节拍数
int beat_type = 4; //几分音符算作一拍
}Time;
typedef struct key {
int fifth = 0; //音调升降
char* mode = (char*)"major"; //1-标准音主序列
}key;
class measure {
private:
int noteBottom = 0;
int maxCharacterWidth = 0;
void recNum(cv::Mat section, std::vector<cv::Vec4i> rows);
public:
int id;
unsigned int number; //小节数
Time time;
std::vector<note> notes;
key key;
measure(cv::Mat org, cv::Mat img, std::vector<cv::Vec4i> rows,int id);
};
class saveDoc {
private:
tinyxml2::XMLDocument backup;
public:
saveDoc(const char* title, const char* composer, const char* lyricist, const char* artist, const char* tabber, const char* irights);
int save(const char* xmlPath);
void saveMeasure(measure toSave);
};