lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
plugins
SlicerT
SlicerTWaveform.h
Go to the documentation of this file.
1
/*
2
* SlicerTWaveform.h - declaration of class SlicerTWaveform
3
*
4
* Copyright (c) 2023 Daniel Kauss Serna <daniel.kauss.serna@gmail.com>
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
25
#ifndef LMMS_GUI_SLICERT_WAVEFORM_H
26
#define LMMS_GUI_SLICERT_WAVEFORM_H
27
28
#include <QElapsedTimer>
29
#include <QWidget>
30
31
namespace
lmms
{
32
33
class
SlicerT
;
34
35
namespace
gui
{
36
37
class
SlicerTWaveform
:
public
QWidget
38
{
39
Q_OBJECT
40
41
public
slots:
42
void
updateUI
();
43
void
isPlaying
(
float
current,
float
start,
float
end);
44
45
public
:
46
SlicerTWaveform
(
int
totalWidth,
int
totalHeight,
SlicerT
* instrument, QWidget* parent);
47
48
// predefined sizes
49
static
constexpr
int
s_seekerHorMargin
= 5;
50
static
constexpr
int
s_seekerVerMargin
= 6;
51
static
constexpr
int
s_middleMargin
= 6;
52
static
constexpr
int
s_arrowHeight
= 5;
53
54
// interaction behavior values
55
static
constexpr
float
s_distanceForClick
= 0.02f;
56
static
constexpr
float
s_minSeekerDistance
= 0.13f;
57
static
constexpr
float
s_zoomSensitivity
= 0.5f;
58
static
constexpr
int
s_minMilisPassed
= 10;
59
60
enum class
UIObjects
61
{
62
Nothing,
63
SeekerStart,
64
SeekerEnd,
65
SeekerMiddle,
66
SlicePoint,
67
};
68
69
protected
:
70
void
mousePressEvent
(QMouseEvent* me)
override
;
71
void
mouseReleaseEvent
(QMouseEvent* me)
override
;
72
void
mouseMoveEvent
(QMouseEvent* me)
override
;
73
void
mouseDoubleClickEvent
(QMouseEvent* me)
override
;
74
void
wheelEvent
(QWheelEvent* we)
override
;
75
76
void
paintEvent
(QPaintEvent* pe)
override
;
77
void
resizeEvent
(QResizeEvent* event)
override
;
78
79
private
:
80
int
m_width
;
81
int
m_height
;
82
83
int
m_seekerHeight
;
// used to calcualte all vertical sizes
84
int
m_seekerWidth
;
85
int
m_editorHeight
;
86
int
m_editorWidth
;
87
88
UIObjects
m_closestObject
;
89
int
m_closestSlice
= -1;
90
91
float
m_seekerStart
= 0;
92
float
m_seekerEnd
= 1;
93
float
m_seekerMiddle
= 0.5f;
94
95
float
m_noteCurrent
;
96
float
m_noteStart
;
97
float
m_noteEnd
;
98
99
float
m_zoomLevel
= 1.0f;
100
101
QPixmap
m_sliceArrow
;
102
QPixmap
m_seeker
;
103
QPixmap
m_seekerWaveform
;
104
QPixmap
m_editorWaveform
;
105
QPixmap
m_sliceEditor
;
106
QPixmap
m_emptySampleIcon
;
107
108
SlicerT
*
m_slicerTParent
;
109
110
QElapsedTimer
m_updateTimer
;
111
void
drawSeekerWaveform
();
112
void
drawSeeker
();
113
void
drawEditorWaveform
();
114
void
drawEditor
();
115
116
void
updateClosest
(QMouseEvent* me);
117
void
updateCursor
();
118
};
119
}
// namespace gui
120
}
// namespace lmms
121
#endif
// LMMS_GUI_SLICERT_WAVEFORM_H
lmms::SlicerT
Definition
SlicerT.h:40
lmms::gui::SlicerTWaveform::m_closestSlice
int m_closestSlice
Definition
SlicerTWaveform.h:89
lmms::gui::SlicerTWaveform::wheelEvent
void wheelEvent(QWheelEvent *we) override
Definition
SlicerTWaveform.cpp:468
lmms::gui::SlicerTWaveform::updateUI
void updateUI()
Definition
SlicerTWaveform.cpp:285
lmms::gui::SlicerTWaveform::updateClosest
void updateClosest(QMouseEvent *me)
Definition
SlicerTWaveform.cpp:295
lmms::gui::SlicerTWaveform::m_editorHeight
int m_editorHeight
Definition
SlicerTWaveform.h:85
lmms::gui::SlicerTWaveform::m_seekerWidth
int m_seekerWidth
Definition
SlicerTWaveform.h:84
lmms::gui::SlicerTWaveform::updateCursor
void updateCursor()
Definition
SlicerTWaveform.cpp:343
lmms::gui::SlicerTWaveform::s_seekerVerMargin
static constexpr int s_seekerVerMargin
Definition
SlicerTWaveform.h:50
lmms::gui::SlicerTWaveform::mousePressEvent
void mousePressEvent(QMouseEvent *me) override
Definition
SlicerTWaveform.cpp:358
lmms::gui::SlicerTWaveform::m_seekerMiddle
float m_seekerMiddle
Definition
SlicerTWaveform.h:93
lmms::gui::SlicerTWaveform::m_seekerHeight
int m_seekerHeight
Definition
SlicerTWaveform.h:83
lmms::gui::SlicerTWaveform::s_minMilisPassed
static constexpr int s_minMilisPassed
Definition
SlicerTWaveform.h:58
lmms::gui::SlicerTWaveform::m_editorWaveform
QPixmap m_editorWaveform
Definition
SlicerTWaveform.h:104
lmms::gui::SlicerTWaveform::m_updateTimer
QElapsedTimer m_updateTimer
Definition
SlicerTWaveform.h:110
lmms::gui::SlicerTWaveform::s_minSeekerDistance
static constexpr float s_minSeekerDistance
Definition
SlicerTWaveform.h:56
lmms::gui::SlicerTWaveform::m_zoomLevel
float m_zoomLevel
Definition
SlicerTWaveform.h:99
lmms::gui::SlicerTWaveform::SlicerTWaveform
SlicerTWaveform(int totalWidth, int totalHeight, SlicerT *instrument, QWidget *parent)
Definition
SlicerTWaveform.cpp:68
lmms::gui::SlicerTWaveform::m_closestObject
UIObjects m_closestObject
Definition
SlicerTWaveform.h:88
lmms::gui::SlicerTWaveform::m_height
int m_height
Definition
SlicerTWaveform.h:81
lmms::gui::SlicerTWaveform::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *me) override
Definition
SlicerTWaveform.cpp:453
lmms::gui::SlicerTWaveform::s_zoomSensitivity
static constexpr float s_zoomSensitivity
Definition
SlicerTWaveform.h:57
lmms::gui::SlicerTWaveform::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition
SlicerTWaveform.cpp:98
lmms::gui::SlicerTWaveform::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *me) override
Definition
SlicerTWaveform.cpp:387
lmms::gui::SlicerTWaveform::m_width
int m_width
Definition
SlicerTWaveform.h:80
lmms::gui::SlicerTWaveform::drawEditorWaveform
void drawEditorWaveform()
Definition
SlicerTWaveform.cpp:173
lmms::gui::SlicerTWaveform::paintEvent
void paintEvent(QPaintEvent *pe) override
Definition
SlicerTWaveform.cpp:476
lmms::gui::SlicerTWaveform::s_distanceForClick
static constexpr float s_distanceForClick
Definition
SlicerTWaveform.h:55
lmms::gui::SlicerTWaveform::drawSeekerWaveform
void drawSeekerWaveform()
Definition
SlicerTWaveform.cpp:113
lmms::gui::SlicerTWaveform::drawSeeker
void drawSeeker()
Definition
SlicerTWaveform.cpp:138
lmms::gui::SlicerTWaveform::UIObjects
UIObjects
Definition
SlicerTWaveform.h:61
lmms::gui::SlicerTWaveform::m_sliceEditor
QPixmap m_sliceEditor
Definition
SlicerTWaveform.h:105
lmms::gui::SlicerTWaveform::m_noteCurrent
float m_noteCurrent
Definition
SlicerTWaveform.h:95
lmms::gui::SlicerTWaveform::m_seeker
QPixmap m_seeker
Definition
SlicerTWaveform.h:102
lmms::gui::SlicerTWaveform::m_seekerStart
float m_seekerStart
Definition
SlicerTWaveform.h:91
lmms::gui::SlicerTWaveform::m_seekerEnd
float m_seekerEnd
Definition
SlicerTWaveform.h:92
lmms::gui::SlicerTWaveform::drawEditor
void drawEditor()
Definition
SlicerTWaveform.cpp:204
lmms::gui::SlicerTWaveform::m_editorWidth
int m_editorWidth
Definition
SlicerTWaveform.h:86
lmms::gui::SlicerTWaveform::s_seekerHorMargin
static constexpr int s_seekerHorMargin
Definition
SlicerTWaveform.h:49
lmms::gui::SlicerTWaveform::s_middleMargin
static constexpr int s_middleMargin
Definition
SlicerTWaveform.h:51
lmms::gui::SlicerTWaveform::m_slicerTParent
SlicerT * m_slicerTParent
Definition
SlicerTWaveform.h:108
lmms::gui::SlicerTWaveform::m_seekerWaveform
QPixmap m_seekerWaveform
Definition
SlicerTWaveform.h:103
lmms::gui::SlicerTWaveform::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *me) override
Definition
SlicerTWaveform.cpp:395
lmms::gui::SlicerTWaveform::m_emptySampleIcon
QPixmap m_emptySampleIcon
Definition
SlicerTWaveform.h:106
lmms::gui::SlicerTWaveform::s_arrowHeight
static constexpr int s_arrowHeight
Definition
SlicerTWaveform.h:52
lmms::gui::SlicerTWaveform::isPlaying
void isPlaying(float current, float start, float end)
Definition
SlicerTWaveform.cpp:272
lmms::gui::SlicerTWaveform::m_noteEnd
float m_noteEnd
Definition
SlicerTWaveform.h:97
lmms::gui::SlicerTWaveform::m_sliceArrow
QPixmap m_sliceArrow
Definition
SlicerTWaveform.h:101
lmms::gui::SlicerTWaveform::m_noteStart
float m_noteStart
Definition
SlicerTWaveform.h:96
lmms::gui
Definition
AudioPortAudio.cpp:209
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0