lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
plugins
Vectorscope
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
31
namespace
lmms
32
{
33
class
VecControls
;
34
class
SampleFrame
;
35
}
36
37
//#define VEC_DEBUG
38
39
namespace
lmms::gui
40
{
41
42
43
// Widget that displays a vectorscope visualization of stereo signal.
44
class
VectorView
:
public
QWidget
45
{
46
Q_OBJECT
47
public
:
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
57
protected:
58
void
paintEvent
(QPaintEvent *event) override;
59
void
mouseDoubleClickEvent
(QMouseEvent *event) override;
60
void
wheelEvent
(QWheelEvent *event) override;
61
62
private slots:
63
void
periodicUpdate
();
64
65
private:
66
void
drawZoomInfo
();
67
68
private:
69
VecControls
*
m_controls
;
70
71
LocklessRingBuffer
<
SampleFrame
> *
m_inputBuffer
;
72
LocklessRingBufferReader
<
SampleFrame
>
m_bufferReader
;
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
LocklessRingBuffer.h
lmms::LocklessRingBuffer
A convenience layer for a realtime-safe and thread-safe multi-reader ringbuffer.
Definition
LocklessRingBuffer.h:41
lmms::LocklessRingBufferReader
Wrapper for lockless ringbuffer reader.
Definition
LocklessRingBuffer.h:72
lmms::SampleFrame
Definition
SampleFrame.h:41
lmms::VecControls
Definition
VecControls.h:44
lmms::gui::VectorView::m_colorLabels
QColor m_colorLabels
Definition
VectorView.h:83
lmms::gui::VectorView::m_colorGrid
QColor m_colorGrid
Definition
VectorView.h:82
lmms::gui::VectorView::paintEvent
void paintEvent(QPaintEvent *event) override
Definition
VectorView.cpp:61
lmms::gui::VectorView::~VectorView
~VectorView() override=default
lmms::gui::VectorView::m_lastPoint
QPointF m_lastPoint
Definition
VectorView.h:79
lmms::gui::VectorView::m_bufferReader
LocklessRingBufferReader< SampleFrame > m_bufferReader
Definition
VectorView.h:72
lmms::gui::VectorView::m_inputBuffer
LocklessRingBuffer< SampleFrame > * m_inputBuffer
Definition
VectorView.h:71
lmms::gui::VectorView::colorGrid
QColor colorGrid
Definition
VectorView.h:54
lmms::gui::VectorView::sizeHint
QSize sizeHint() const override
Definition
VectorView.h:51
lmms::gui::VectorView::colorLabels
QColor colorLabels
Definition
VectorView.h:55
lmms::gui::VectorView::periodicUpdate
void periodicUpdate()
Definition
VectorView.cpp:219
lmms::gui::VectorView::wheelEvent
void wheelEvent(QWheelEvent *event) override
Definition
VectorView.cpp:241
lmms::gui::VectorView::m_colorTrace
QColor m_colorTrace
Definition
VectorView.h:81
lmms::gui::VectorView::VectorView
VectorView(VecControls *controls, LocklessRingBuffer< SampleFrame > *inputBuffer, QWidget *parent=nullptr)
Definition
VectorView.cpp:42
lmms::gui::VectorView::m_controls
VecControls * m_controls
Definition
VectorView.h:69
lmms::gui::VectorView::m_zoomTimestamp
unsigned int m_zoomTimestamp
Definition
VectorView.h:77
lmms::gui::VectorView::colorTrace
QColor colorTrace
Definition
VectorView.h:53
lmms::gui::VectorView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event) override
Definition
VectorView.cpp:230
lmms::gui::VectorView::m_zoom
float m_zoom
Definition
VectorView.h:74
lmms::gui::VectorView::drawZoomInfo
void drawZoomInfo()
Definition
VectorView.cpp:256
lmms::gui
Definition
AudioPortAudio.cpp:209
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0