-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmidix_vu.h
42 lines (32 loc) · 849 Bytes
/
xmidix_vu.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
#ifndef XMIDIX__XMIDIX_VU_H_
#define XMIDIX__XMIDIX_VU_H_
#include <QWidget>
#include <QPainter>
#include <QFrame>
#include <QImage>
#include <alsa/seq_event.h>
#include <vector>
#include <memory>
class xmidix_vu : public QWidget {
Q_OBJECT
public:
explicit xmidix_vu(QWidget *parent = nullptr, std::shared_ptr<QImage> grad = nullptr);
void trigger(bool note_on, uint8_t note = 0, uint8_t note_velocity = 0);
protected:
void paintEvent(QPaintEvent *event) override;
private:
std::shared_ptr<QImage> gradient;
bool on;
uint8_t velocity;
};
class xmidix_vu_array : public QFrame {
Q_OBJECT
public:
explicit xmidix_vu_array(QWidget *parent = nullptr);
void clear();
public slots:
void midi_event(const snd_seq_event_t &event);
private:
std::vector<std::shared_ptr<xmidix_vu>> vus;
};
#endif //XMIDIX__XMIDIX_VU_H_