-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkey.hpp
62 lines (49 loc) · 1.18 KB
/
key.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
#ifndef KEY_H
#define KEY_H
#include <QPushButton>
#include <QTextStream>
#include <QWidget>
#include <QMouseEvent>
#include "audiooutputstreamer.hpp"
#include "recplay.hpp"
#include <QTimer>
#include <chrono>
class keyBoard;
class Key : public QPushButton
{
Q_OBJECT
public:
Key();
Key(QString, QWidget*);
~Key(){};
int left();
Key* setGeometry(int,int,int,int);
Key* setFrequency(double);
Key* setDefaultStyle();
QString name();
double frequency();
bool sharp();
bool valid();
keyBoard* parent();
clock_t lastTriggered;
bool _playing = false;
QTimer* _timer;
public slots:
void play();
void stop();
protected:
void mousePressEvent(QMouseEvent*);
void mouseReleaseEvent(QMouseEvent*);
private:
QString _name;
QString _defaultStyle;
QWidget* _parent;
int _left, _top, _width, _height;
double _frequency;
bool _sharp = false;
bool _valid = false;
RecPlay* _rec;
std::chrono::high_resolution_clock::time_point _start;
AudioOutputStreamer* _aOutput;
};
#endif