Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling waveform using SceneGraph in QML #13470

Draft
wants to merge 56 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
280fcf7
using rendergraph for allshader waveforms, with rendergraph::Geometry…
Aug 23, 2024
d3a69bb
waveformrenderbeat with rendergraph, various fixes, use same shaders …
Aug 27, 2024
c2fffea
preroll/postroll using rendergraph
Aug 30, 2024
4ad583c
node iterator, fixed examples
Aug 30, 2024
1dc16a5
fix teardown order
Aug 30, 2024
8014163
mark range with dynamic nodes
Aug 31, 2024
9a01213
make linked list handling part of rendergraph::Node
Aug 31, 2024
9eb2938
towards digits renderer as node
Aug 31, 2024
1e4d04b
draw playpos with rendergraph
Aug 31, 2024
058f5ec
reuse materialshaders
Aug 31, 2024
8032b38
keep track of material that modified the shader uniforms, fix scenegraph
Aug 31, 2024
3dcf907
digitsrenderer with rendergraph
Aug 31, 2024
507a465
draw marks with rendergraph
Aug 31, 2024
a0df59e
removed pimpl from rendergraph opengl
Sep 1, 2024
18fa2c4
removed pimpl from rendergraph scenegraph
Sep 18, 2024
1967817
cleanup and moved common rendergraph files to common/rendergraph
Sep 18, 2024
88013d4
remove nodebase, use encapsulation for scenegraph Node
Sep 19, 2024
b8bcb19
reorganized the code, with a public common API that is derived from t…
Sep 19, 2024
319ffb0
Update src/rendergraph/common/rendergraph/material/patternmaterial.h
m0dB Sep 22, 2024
390dd0e
Update src/rendergraph/common/rendergraph/material/rgbamaterial.cpp
m0dB Sep 22, 2024
afdc0ed
Update res/shaders/rendergraph/unicolor.frag
m0dB Sep 22, 2024
dff3a31
Update src/rendergraph/opengl/backend/shadercache.h
m0dB Sep 22, 2024
c713d6a
Update src/rendergraph/common/rendergraph/attribute.h
m0dB Sep 22, 2024
6ebc9d5
removed accidental commit
Sep 22, 2024
2a4a7d1
removed backend:: namespace, minor changes based on reviews
Sep 22, 2024
c5444fc
added comment to explain return value of remove node functions
Sep 22, 2024
ec3f816
use a generic Material::compare
Sep 22, 2024
86e5f09
added some DEBUG_ASSERTs and some vector.reserve calls
Sep 22, 2024
bc32a9c
use string literal
Sep 22, 2024
eeae3ea
use qshader to load qsb files for opengl Qt >= 6.6
Sep 22, 2024
0a691ad
avoid adding entire src dir to include paths
Sep 22, 2024
9c607c1
updated READMEs
Sep 22, 2024
2f8e548
improved/added asserts
Sep 23, 2024
c6cdb34
moved opengl node as baseclass for waveform renderers to derived clas…
Sep 23, 2024
92cd753
fix typo
Sep 23, 2024
8e5128f
moved rendergraph::OpenGLNode to derived
Sep 23, 2024
07d1f6a
moved vertexupdaters
Sep 23, 2024
b24e9ba
ported waveformrendererrgb to rendergraph, hurray!
Sep 23, 2024
b817d6c
removed class Attribute and use BaseGeometry::Attribute to reduce del…
Sep 24, 2024
0e870dd
comment
Sep 24, 2024
941f0cc
put rendergraph_sg and rendergraph_gl in different namespaces
Sep 25, 2024
1f10725
remove generated file
Sep 27, 2024
ca5f780
also use rendergraph::Engine in scenegraph to initialize and resize n…
Sep 27, 2024
bf7ed15
wip
Oct 6, 2024
1e57aae
let matrix be handled by qt scenegraph or by the opengl engine, remov…
Oct 19, 2024
8011f61
remove treenode
Oct 20, 2024
6b2442d
add nodeinterface for unique_ptr ownership methods
Oct 20, 2024
1a38137
reduce delta with feat/qml-scrolling-waveform-with-sg-and-rendergraph
Oct 20, 2024
cf17f15
reduce delta with feat/qml-scrolling-waveform-with-sg-and-rendergraph
Oct 20, 2024
5220b39
reduced delta with feat/qml-scrolling-waveform-with-sg-and-rendergraph
Oct 20, 2024
ce87914
fix: add non-null safety on context windows ptr
acolombier Oct 21, 2024
d4b4b7d
chore: remove unused matrix helper
acolombier Oct 21, 2024
358f66a
fix: prevent use-after-free with a texture buffer deepcopy
acolombier Oct 21, 2024
f8033d0
feat: add rendergraph support for stem renderer
acolombier Oct 21, 2024
32b7991
scrolling qml waveformdisplay working
Oct 22, 2024
23f331f
feat: add scrolling waveform in QML using scenegraph
acolombier Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ repos:
rev: v0.13.0
hooks:
- id: markdownlint-cli2
language_version: lts
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
hooks:
Expand Down
42 changes: 40 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,7 @@ else()
)
endif()
if(QOPENGL)
target_compile_definitions(mixxx-lib PRIVATE __RENDERGRAPH_IS_OPENGL)
target_sources(mixxx-lib PRIVATE
src/shaders/endoftrackshader.cpp
src/shaders/slipmodeshader.cpp
Expand All @@ -1514,7 +1515,6 @@ if(QOPENGL)
src/shaders/vinylqualityshader.cpp
src/util/opengltexture2d.cpp
src/waveform/renderers/allshader/digitsrenderer.cpp
src/waveform/renderers/allshader/matrixforwidgetgeometry.cpp
src/waveform/renderers/allshader/waveformrenderbackground.cpp
src/waveform/renderers/allshader/waveformrenderbeat.cpp
src/waveform/renderers/allshader/waveformrenderer.cpp
Expand Down Expand Up @@ -1771,7 +1771,7 @@ if(QT6)
# below that takes care of the correct object order in the resulting binary
# According to https://doc.qt.io/qt-6/qt-finalize-target.html it is importand for
# builds with Qt < 3.21
qt_add_executable(mixxx WIN32 src/main.cpp MANUAL_FINALIZATION)
qt_add_executable(mixxx WIN32 MACOSX_BUNDLE src/main.cpp MANUAL_FINALIZATION)
else()
find_package(Qt5 COMPONENTS Core) # For Qt Core cmake functions
# This is the first package form the environment, if this fails give hints how to install the environment
Expand Down Expand Up @@ -2767,9 +2767,11 @@ if(QML)
res/qml/Mixxx/Controls/WaveformOverviewHotcueMarker.qml
res/qml/Mixxx/Controls/WaveformOverviewMarker.qml
res/qml/Mixxx/Controls/WaveformOverview.qml
res/qml/Mixxx/Controls/WaveformDisplay.qml
)
target_link_libraries(mixxx-qml-lib PRIVATE mixxx-qml-mixxxcontrolsplugin)

target_compile_definitions(mixxx-qml-lib PRIVATE __RENDERGRAPH_IS_SCENEGRAPH)
target_sources(mixxx-qml-lib PRIVATE
src/qml/asyncimageprovider.cpp
src/qml/qmlapplication.cpp
Expand All @@ -2789,6 +2791,22 @@ if(QML)
src/qml/qmlvisibleeffectsmodel.cpp
src/qml/qmlchainpresetmodel.cpp
src/qml/qmlwaveformoverview.cpp
src/qml/qmlwaveformdisplay.cpp
src/qml/qmlwaveformrenderer.cpp
src/waveform/renderers/allshader/digitsrenderer.cpp
src/waveform/renderers/allshader/waveformrenderbeat.cpp
src/waveform/renderers/allshader/waveformrenderer.cpp
src/waveform/renderers/allshader/waveformrendererendoftrack.cpp
src/waveform/renderers/allshader/waveformrendererpreroll.cpp
src/waveform/renderers/allshader/waveformrendererrgb.cpp
src/waveform/renderers/allshader/waveformrenderersignalbase.cpp
src/waveform/renderers/allshader/waveformrendermark.cpp
src/waveform/renderers/allshader/waveformrendermarkrange.cpp
# FIXME depends on rendergraph/openglnode.h
# src/waveform/renderers/allshader/waveformrendererslipmode.cpp
# src/waveform/renderers/allshader/waveformrendererfiltered.cpp
# src/waveform/renderers/allshader/waveformrendererhsv.cpp
# src/waveform/renderers/allshader/waveformrenderersimple.cpp
# The following sources need to be in this target to get QML_ELEMENT properly interpreted
src/control/controlmodel.cpp
src/control/controlsortfiltermodel.cpp
Expand Down Expand Up @@ -3481,6 +3499,7 @@ if (STEM)
if(QML)
target_compile_definitions(mixxx-qml-lib PUBLIC __STEM__)
target_sources(mixxx-qml-lib PRIVATE
src/waveform/renderers/allshader/waveformrendererstem.cpp
src/qml/qmlstemsmodel.cpp
)
endif()
Expand Down Expand Up @@ -3810,6 +3829,25 @@ if(VINYLCONTROL)
target_link_libraries(mixxx-lib PRIVATE mixxx-xwax)
endif()

# rendergraph
add_subdirectory(src/rendergraph/opengl)
add_subdirectory(res/shaders/rendergraph)
target_compile_definitions(rendergraph_gl PUBLIC
$<$<CONFIG:Debug>:MIXXX_DEBUG_ASSERTIONS_ENABLED>
)
target_link_libraries(mixxx-lib PUBLIC rendergraph_gl)
target_compile_definitions(mixxx-lib PRIVATE rendergraph=rendergraph_gl)
target_compile_definitions(mixxx-lib PRIVATE allshader=allshader_gl)
if(QML)
add_subdirectory(src/rendergraph/scenegraph)
target_compile_definitions(rendergraph_sg PUBLIC
$<$<CONFIG:Debug>:MIXXX_DEBUG_ASSERTIONS_ENABLED>
)
target_link_libraries(mixxx-qml-lib PRIVATE rendergraph_sg)
target_compile_definitions(mixxx-qml-lib PRIVATE rendergraph=rendergraph_sg)
target_compile_definitions(mixxx-qml-lib PRIVATE allshader=allshader_sg)
endif()

# WavPack audio file support
find_package(wavpack)
default_option(WAVPACK "WavPack audio file support" "wavpack_FOUND")
Expand Down
4 changes: 4 additions & 0 deletions res/mixxx.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,9 @@
<file>shaders/passthrough.vert</file>
<file>shaders/rgbsignal.frag</file>
<file>shaders/stackedsignal.frag</file>
<file>shaders/rendergraph/endoftrack.frag.gl</file>
<file>shaders/rendergraph/endoftrack.vert.gl</file>
<file>shaders/rendergraph/texture.frag.gl</file>
<file>shaders/rendergraph/texture.vert.gl</file>
</qresource>
</RCC>
7 changes: 7 additions & 0 deletions res/qml/Mixxx/Controls/WaveformDisplay.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Mixxx 1.0 as Mixxx

Mixxx.WaveformDisplay {
id: root

player: Mixxx.PlayerManager.getPlayer(root.group)
}
238 changes: 238 additions & 0 deletions res/qml/WaveformDisplay.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
import "." as Skin
import Mixxx 1.0 as Mixxx
import Mixxx.Controls 1.0 as MixxxControls
import QtQuick 2.12
import "Theme"

Item {
id: root

required property string group

enum MouseStatus {
Normal,
Bending,
Scratching
}

MixxxControls.WaveformDisplay {
anchors.fill: parent
group: root.group
zoom: zoomControl.value
backgroundColor: "#5e000000"

Mixxx.WaveformRendererEndOfTrack {
color: '#ff8872'
}

Mixxx.WaveformRendererPreroll {
color: '#ff8872'
}

Mixxx.WaveformRendererMarkRange {
// <!-- Loop -->
Mixxx.WaveformMarkRange {
startControl: "loop_start_position"
endControl: "loop_end_position"
enabledControl: "loop_enabled"
color: '#00b400'
opacity: 0.7
disabledColor: '#FFFFFF'
disabledOpacity: 0.6
}
// <!-- Intro -->
Mixxx.WaveformMarkRange {
startControl: "intro_start_position"
endControl: "intro_end_position"
color: '#2c5c9a'
opacity: 0.6
durationTextColor: '#ffffff'
durationTextLocation: 'after'
}
// <!-- Outro -->
Mixxx.WaveformMarkRange {
startControl: "outro_start_position"
endControl: "outro_end_position"
color: '#2c5c9a'
opacity: 0.6
durationTextColor: '#ffffff'
durationTextLocation: 'before'
}
}

Mixxx.WaveformRendererRGB {
axesColor: '#a1a1a1a1'
lowColor: '#ff2154d7'
midColor: '#cfb26606'
highColor: '#e5029c5c'
}

Mixxx.WaveformRendererStem { }

Mixxx.WaveformRendererBeat {
color: '#a1a1a1a1'
}

Mixxx.WaveformRendererMark {
playMarkerColor: 'cyan'
playMarkerBackground: 'orange'
defaultMark: Mixxx.WaveformMark {
align: "bottom|right"
color: "#00d9ff"
textColor: "#1a1a1a"
text: " %1 "
}

untilMark.showTime: true
untilMark.showBeats: true
untilMark.align: Mixxx.WaveformUntilMark.AlignBottom
untilMark.textSize: 11

Mixxx.WaveformMark {
control: "cue_point"
text: 'CUE'
align: 'top|right'
color: 'red'
textColor: '#1a1a1a'
}
Mixxx.WaveformMark {
control: "loop_start_position"
text: '↻'
align: 'top|left'
color: 'green'
textColor: '#FFFFFF'
}
Mixxx.WaveformMark {
control: "loop_end_position"
align: 'bottom|right'
color: 'green'
textColor: '#FFFFFF'
}
Mixxx.WaveformMark {
control: "intro_start_position"
align: 'top|right'
color: 'blue'
textColor: '#FFFFFF'
}
Mixxx.WaveformMark {
control: "intro_end_position"
text: '◢'
align: 'top|left'
color: 'blue'
textColor: '#FFFFFF'
}
Mixxx.WaveformMark {
control: "outro_start_position"
text: '◣'
align: 'top|right'
color: 'blue'
textColor: '#FFFFFF'
}
Mixxx.WaveformMark {
control: "outro_end_position"
align: 'top|left'
color: 'blue'
textColor: '#FFFFFF'
}
}
}

Mixxx.ControlProxy {
id: scratchPositionEnableControl

group: root.group
key: "scratch_position_enable"
}

Mixxx.ControlProxy {
id: scratchPositionControl

group: root.group
key: "scratch_position"
}

Mixxx.ControlProxy {
id: wheelControl

group: root.group
key: "wheel"
}

Mixxx.ControlProxy {
id: rateRatioControl

group: root.group
key: "rate_ratio"
}

Mixxx.ControlProxy {
id: zoomControl

group: root.group
key: "waveform_zoom"
}
readonly property real effectiveZoomFactor: (1 / rateRatioControl.value) * (100 / zoomControl.value)

MouseArea {
property int mouseStatus: WaveformDisplay.MouseStatus.Normal
property point mouseAnchor: Qt.point(0, 0)

anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: {
mouseAnchor = Qt.point(mouse.x, mouse.y);
if (mouse.button == Qt.LeftButton) {
if (mouseStatus == WaveformDisplay.MouseStatus.Bending)
wheelControl.parameter = 0.5;

mouseStatus = WaveformDisplay.MouseStatus.Scratching;
scratchPositionEnableControl.value = 1;
// TODO: Calculate position properly
scratchPositionControl.value = -mouse.x * zoomControl.value * 50;
} else {
if (mouseStatus == WaveformDisplay.MouseStatus.Scratching)
scratchPositionEnableControl.value = 0;

wheelControl.parameter = 0.5;
mouseStatus = WaveformDisplay.MouseStatus.Bending;
}
}
onPositionChanged: {
switch (mouseStatus) {
case WaveformDisplay.MouseStatus.Bending: {
const diff = mouse.x - mouseAnchor.x;
// Start at the middle of [0.0, 1.0], and emit values based on how far
// the mouse has traveled horizontally. Note, for legacy (MIDI) reasons,
// this is tuned to 127.
const v = 0.5 + (diff / root.width);
// clamp to [0.0, 1.0]
wheelControl.parameter = Math.max(Math.min(v, 1), 0);
break;
};
case WaveformDisplay.MouseStatus.Scratching:
// TODO: Calculate position properly
scratchPositionControl.value = -mouse.x * zoomControl.value * 50;
break;
}
}
onReleased: {
switch (mouseStatus) {
case WaveformDisplay.MouseStatus.Bending:
wheelControl.parameter = 0.5;
break;
case WaveformDisplay.MouseStatus.Scratching:
scratchPositionEnableControl.value = 0;
break;
}
mouseStatus = WaveformDisplay.MouseStatus.Normal;
}

onWheel: {
if (wheel.angleDelta.y < 0 && zoomControl.value > 1) {
zoomControl.value -= 1;
} else if (wheel.angleDelta.y > 0 && zoomControl.value < 10.0) {
zoomControl.value += 1;
}
}
}
}
8 changes: 4 additions & 4 deletions res/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ApplicationWindow {
}
}

WaveformRow {
Skin.WaveformDisplay {
id: deck3waveform

group: "[Channel3]"
Expand All @@ -111,7 +111,7 @@ ApplicationWindow {
}
}

WaveformRow {
Skin.WaveformDisplay {
id: deck1waveform

group: "[Channel1]"
Expand All @@ -124,7 +124,7 @@ ApplicationWindow {
}
}

WaveformRow {
Skin.WaveformDisplay {
id: deck2waveform

group: "[Channel2]"
Expand All @@ -137,7 +137,7 @@ ApplicationWindow {
}
}

WaveformRow {
Skin.WaveformDisplay {
id: deck4waveform

group: "[Channel4]"
Expand Down
Loading
Loading