LMMS
Loading...
Searching...
No Matches
VectorView.h
Go to the documentation of this file.
1/* VectorView.h - declaration of VectorView class.
2 *
3 * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/com>
4 * Copyright (c) 2025- Michael Gregorius
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24#ifndef VECTORVIEW_H
25#define VECTORVIEW_H
26
27#include <QWidget>
28
29#include "LocklessRingBuffer.h"
30
31namespace lmms
32{
33class VecControls;
34class SampleFrame;
35}
36
37//#define VEC_DEBUG
38
39namespace lmms::gui
40{
41
42
43// Widget that displays a vectorscope visualization of stereo signal.
44class VectorView : public QWidget
45{
46 Q_OBJECT
47public:
48 VectorView(VecControls* controls, LocklessRingBuffer<SampleFrame>* inputBuffer, QWidget* parent = nullptr);
49 ~VectorView() override = default;
50
51 QSize sizeHint() const override {return QSize(300, 300);}
52
53 Q_PROPERTY(QColor colorTrace MEMBER m_colorTrace)
54 Q_PROPERTY(QColor colorGrid MEMBER m_colorGrid)
55 Q_PROPERTY(QColor colorLabels MEMBER m_colorLabels)
56
57protected:
58 void paintEvent(QPaintEvent *event) override;
59 void mouseDoubleClickEvent(QMouseEvent *event) override;
60 void wheelEvent(QWheelEvent *event) override;
61
62private slots:
63 void periodicUpdate();
64
65private:
66 void drawZoomInfo();
67
68private:
70
73
74 float m_zoom;
75
76 // State variables for comparison with previous repaint
77 unsigned int m_zoomTimestamp;
78
79 QPointF m_lastPoint = QPoint();
80
81 QColor m_colorTrace = QColor(60, 255, 130, 255); // ~LMMS green
82 QColor m_colorGrid = QColor(76, 80, 84, 128); // ~60 % gray (slightly cold / blue), 50 % transparent
83 QColor m_colorLabels = QColor(76, 80, 84, 255); // ~60 % gray (slightly cold / blue)
84
85#ifdef VEC_DEBUG
86 float m_executionAvg = 0;
87#endif
88};
89
90
91} // namespace lmms::gui
92
93#endif // VECTORVIEW_H
#define override
Definition DistrhoDefines.h:73
A convenience layer for a realtime-safe and thread-safe multi-reader ringbuffer.
Definition LocklessRingBuffer.h:41
Wrapper for lockless ringbuffer reader.
Definition LocklessRingBuffer.h:72
Definition SampleFrame.h:41
Definition VecControls.h:44
QColor m_colorLabels
Definition VectorView.h:83
QColor m_colorGrid
Definition VectorView.h:82
void paintEvent(QPaintEvent *event) override
Definition VectorView.cpp:61
~VectorView() override=default
QPointF m_lastPoint
Definition VectorView.h:79
LocklessRingBufferReader< SampleFrame > m_bufferReader
Definition VectorView.h:72
LocklessRingBuffer< SampleFrame > * m_inputBuffer
Definition VectorView.h:71
QColor colorGrid
Definition VectorView.h:54
QSize sizeHint() const override
Definition VectorView.h:51
QColor colorLabels
Definition VectorView.h:55
void periodicUpdate()
Definition VectorView.cpp:219
void wheelEvent(QWheelEvent *event) override
Definition VectorView.cpp:241
QColor m_colorTrace
Definition VectorView.h:81
VectorView(VecControls *controls, LocklessRingBuffer< SampleFrame > *inputBuffer, QWidget *parent=nullptr)
Definition VectorView.cpp:42
VecControls * m_controls
Definition VectorView.h:69
unsigned int m_zoomTimestamp
Definition VectorView.h:77
QColor colorTrace
Definition VectorView.h:53
void mouseDoubleClickEvent(QMouseEvent *event) override
Definition VectorView.cpp:230
float m_zoom
Definition VectorView.h:74
void drawZoomInfo()
Definition VectorView.cpp:256
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35