]> git.sesse.net Git - nageru/blob - lrameter.h
Properly reset the PBO setting in Mixer::bm_frame(), so new textures are properly...
[nageru] / lrameter.h
1 // TODO: This isn't really an LRA meter right now (it ignores the range).
2
3 #ifndef LRAMETER_H
4 #define LRAMETER_H
5
6 #include <math.h>
7 #include <QLabel>
8 #include <QPaintEvent>
9 #include <QWidget>
10 #include <mutex>
11
12 class LRAMeter : public QWidget
13 {
14         Q_OBJECT
15
16 public:
17         LRAMeter(QWidget *parent);
18
19         void set_levels(float level_lufs, float range_low_lufs, float range_high_lufs) {
20                 std::unique_lock<std::mutex> lock(level_mutex);
21                 this->level_lufs = level_lufs;
22                 this->range_low_lufs = range_low_lufs;
23                 this->range_high_lufs = range_high_lufs;
24                 QMetaObject::invokeMethod(this, "update", Qt::AutoConnection);
25         }
26
27 private:
28         void resizeEvent(QResizeEvent *event) override;
29         void paintEvent(QPaintEvent *event) override;
30
31         std::mutex level_mutex;
32         float level_lufs = -HUGE_VAL;
33         float range_low_lufs = -HUGE_VAL;
34         float range_high_lufs = -HUGE_VAL;
35
36         QPixmap on_pixmap, off_pixmap;
37 };
38
39 #endif