-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeyboard.hpp
118 lines (90 loc) · 2.35 KB
/
keyboard.hpp
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
*
*
*
* */
#ifndef KEYBOARD_H
#define KEYBOARD_H
#include <QWidget>
#include <QTextStream>
#include <QKeyEvent>
#include <QMap>
#include <QLabel>
#include "key.hpp"
#include "recplay.hpp"
class keyBoard : public QWidget
{
Q_OBJECT
public:
keyBoard(QWidget* = 0);
~keyBoard() {};
QWidget* parent() {return _parent;}
keyBoard* setCKeyWidth(int);
keyBoard* setAKeyWidth(int);
keyBoard* setCKeyHeight(int);
keyBoard* setAKeyHeight(int);
keyBoard* setKeyGeometry(int,int,int,int);
keyBoard* updateTopBar();
int width();
int height();
void playNote(Key*);
void stopNote(Key*);
Key* getNoteByKeyCode(int);
Key* getNoteByName(QString);
keyBoard* generate(int,int,QString="assets/default.keys",QString="a4",double=440.);
keyBoard* sort();
keyBoard* draw();
keyBoard* timbre(QString);
QVector<double> timbre();
QString getTimbre();
static QString Usage();
int getMinOct() {
return this->_minOctave;
}
int getMaxOct() {
return this->_maxOctave;
}
QString getGeNote() {
return this->_generatorNote;
}
double getGenFreq() {
return this->_generatorFreq;
}
QString getLayout() {
return this->_layout;
}
RecPlay* rec();
void setKeyLetters();
public slots:
void chOctEventUp();
void chOctEventDown();
protected:
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
private:
// frequency is first due to qmap auto sorting
QMap<double,QString> cNotes;
QMap<double,QString> aNotes;
QVector<Key*> _keys;
// keys default dimensions
int cKeyWidth = 40;
int cKeyHeight = 160;
int aKeyWidth = 30;
int aKeyHeight = 80;
int Xoffset = 0;
int Yoffset = 0;
QVector<double> _timbre;
int _curOctave;
int _minOctave;
int _maxOctave;
QString _generatorNote;
double _generatorFreq;
bool _generated = false;
QLabel* _topBar;
QString _layout = "";
QVector<QString> letters;
QVector<int> code;
QVector<QString> K;
QWidget* _parent;
};
#endif