LMMS
Loading...
Searching...
No Matches
OscilloscopeGraph.h
Go to the documentation of this file.
1/*
2* OscilloscopeGraph.h - Oscilloscope graph widget to handle drawing the waveform and user scrolling/zooming
3*
4* Copyright (c) 2025-2026 Keratin
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 LMMS_GUI_OSCILLOSCOPE_GRAPH_H
25#define LMMS_GUI_OSCILLOSCOPE_GRAPH_H
26
28#include "LocklessRingBuffer.h"
29#include <QWidget>
30
31namespace lmms
32{
33
35class FloatModel;
36
37namespace gui
38{
39
40class Knob;
41
42class OscilloscopeGraph : public QWidget
43{
44 Q_OBJECT
45 Q_PROPERTY(QColor monoColor MEMBER m_monoColor)
46 Q_PROPERTY(QColor leftColor MEMBER m_leftColor)
47 Q_PROPERTY(QColor rightColor MEMBER m_rightColor)
48 Q_PROPERTY(QColor minorLineColor MEMBER m_minorLineColor)
49 Q_PROPERTY(QColor clippingLineColor MEMBER m_clippingLineColor)
50 Q_PROPERTY(QColor backgroundColor MEMBER m_backgroundColor)
51public:
54
55 void paintEvent(QPaintEvent* pe) override;
56 void wheelEvent(QWheelEvent* we) override;
57 void mousePressEvent(QMouseEvent* me) override;
58 void mouseMoveEvent(QMouseEvent* me) override;
59
62
63private slots:
64 void changeSampleRate();
65
66private:
68
70
71 // Buffer which is actually drawn on the screen, not the ring buffer used for communication between threads
74
76
77 QColor m_monoColor = QColor(255, 255, 255);
78 QColor m_leftColor = QColor(126, 146, 255, 128);
79 QColor m_rightColor = QColor(255, 128, 128, 128);
80 QColor m_minorLineColor = QColor(100, 100, 100);
81 QColor m_clippingLineColor = QColor(100, 0, 0);
82 QColor m_backgroundColor = QColor(0, 0, 0);
83};
84
85} // namespace gui
86
87} // namespace lmms
88
89#endif // LMMS_GUI_OSCILLOSCOPE_GRAPH_H
#define constexpr
Definition CarlaDefines.h:94
#define override
Definition DistrhoDefines.h:73
Definition AutomatableModel.h:463
Wrapper for lockless ringbuffer reader.
Definition LocklessRingBuffer.h:72
Definition OscilloscopeControls.h:41
Definition SampleFrame.h:41
Definition Knob.h:47
QColor m_clippingLineColor
Definition OscilloscopeGraph.h:81
QColor m_minorLineColor
Definition OscilloscopeGraph.h:80
QColor leftColor
Definition OscilloscopeGraph.h:46
QColor m_monoColor
Definition OscilloscopeGraph.h:77
OscilloscopeControls * m_controls
Definition OscilloscopeGraph.h:67
int m_mousePos
Definition OscilloscopeGraph.h:75
int m_ringBufferIndex
Definition OscilloscopeGraph.h:73
std::vector< SampleFrame > m_ringBuffer
Definition OscilloscopeGraph.h:72
void wheelEvent(QWheelEvent *we) override
Definition OscilloscopeGraph.cpp:147
LocklessRingBufferReader< SampleFrame > m_inputBufferReader
Definition OscilloscopeGraph.h:69
OscilloscopeGraph(QWidget *parent, OscilloscopeControls *controls)
Definition OscilloscopeGraph.cpp:42
QColor monoColor
Definition OscilloscopeGraph.h:45
void changeSampleRate()
Definition OscilloscopeGraph.cpp:56
QColor rightColor
Definition OscilloscopeGraph.h:47
void paintEvent(QPaintEvent *pe) override
Definition OscilloscopeGraph.cpp:66
QColor backgroundColor
Definition OscilloscopeGraph.h:50
static constexpr float MaxBufferLengthSeconds
Maximum length of the oscilloscope history in seconds.
Definition OscilloscopeGraph.h:61
QColor m_leftColor
Definition OscilloscopeGraph.h:78
QColor m_backgroundColor
Definition OscilloscopeGraph.h:82
QColor m_rightColor
Definition OscilloscopeGraph.h:79
void mouseMoveEvent(QMouseEvent *me) override
Definition OscilloscopeGraph.cpp:169
QColor clippingLineColor
Definition OscilloscopeGraph.h:49
QColor minorLineColor
Definition OscilloscopeGraph.h:48
void mousePressEvent(QMouseEvent *me) override
Definition OscilloscopeGraph.cpp:167
unsigned f
Definition inflate.c:1572
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:209
Definition AudioAlsa.cpp:35
Definition juce_Uuid.h:141