Skip to content

Commit

Permalink
feat: add scrolling waveform in QML using scenegraph
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Feb 2, 2025
1 parent cd72549 commit fb057a5
Show file tree
Hide file tree
Showing 62 changed files with 2,374 additions and 263 deletions.
41 changes: 39 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,7 @@ else()
)
endif()
if(QOPENGL)
target_compile_definitions(mixxx-lib PRIVATE __RENDERGRAPH_IS_OPENGL)
target_sources(
mixxx-lib
PRIVATE
Expand Down Expand Up @@ -2105,7 +2106,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 @@ -3318,9 +3319,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
Expand All @@ -3343,6 +3346,21 @@ if(QML)
src/qml/qmlchainpresetmodel.cpp
src/qml/qmlwaveformoverview.cpp
src/qml/qmlmixxxcontrollerscreen.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
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 @@ -4296,7 +4314,12 @@ if(STEM)
endif()
if(QML)
target_compile_definitions(mixxx-qml-lib PUBLIC __STEM__)
target_sources(mixxx-qml-lib PRIVATE src/qml/qmlstemsmodel.cpp)
target_sources(
mixxx-qml-lib
PRIVATE
src/waveform/renderers/allshader/waveformrendererstem.cpp
src/qml/qmlstemsmodel.cpp
)
endif()
endif()

Expand Down Expand Up @@ -4651,8 +4674,22 @@ endif()

# rendergraph
add_subdirectory(src/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 PUBLIC rendergraph=rendergraph_gl)
target_compile_definitions(mixxx-lib PRIVATE allshader=allshader_gl)
if(QML)
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)
Expand Down
163 changes: 157 additions & 6 deletions res/controllers/DummyDeviceDefaultScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Mixxx.ControllerScreen {
Layout.fillHeight: true
Text {
text: qsTr("Group")
font.pixelSize: 24
font.pixelSize: 18
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
Expand All @@ -183,7 +183,7 @@ Mixxx.ControllerScreen {
Layout.fillHeight: true
Text {
text: `${root.group}`
font.pixelSize: 24
font.pixelSize: 18
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
Expand All @@ -207,7 +207,7 @@ Mixxx.ControllerScreen {
Layout.fillHeight: true
Text {
text: qsTr("Widget")
font.pixelSize: 24
font.pixelSize: 18
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
Expand Down Expand Up @@ -258,7 +258,7 @@ Mixxx.ControllerScreen {
anchors.bottomMargin: 6
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6
spacing: 4
required property var modelData

Mixxx.ControlProxy {
Expand All @@ -273,7 +273,7 @@ Mixxx.ControllerScreen {
Layout.fillHeight: true
Text {
text: qsTr(modelData.title)
font.pixelSize: 24
font.pixelSize: 18
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
Expand All @@ -286,14 +286,165 @@ Mixxx.ControllerScreen {
Layout.fillHeight: true
Text {
text: `${mixxxValue.value}`
font.pixelSize: 24
font.pixelSize: 18
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}
}
}
RowLayout {
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6

Layout.fillWidth: true
Layout.fillHeight: true

Mixxx.ControlProxy {
id: zoomControl

group: root.group
key: "waveform_zoom"
}

MixxxControls.WaveformDisplay {
group: root.group
x: 0
width: root.width
height: 100

zoom: zoomControl.value
backgroundColor: "#36000000"

Mixxx.WaveformRendererEndOfTrack {
color: 'blue'
endOfTrackWarningTime: 30
}

Mixxx.WaveformRendererPreroll {
color: '#998977'
}

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: '#00ffffff'
lowColor: 'red'
midColor: 'green'
highColor: 'blue'

gainAll: 1.0
gainLow: 1.0
gainMid: 1.0
gainHigh: 1.0
}

Mixxx.WaveformRendererStem {
gainAll: 1.0
}

Mixxx.WaveformRendererBeat {
color: '#cfcfcf'
}

Mixxx.WaveformRendererMark {
playMarkerColor: 'cyan'
playMarkerBackground: 'transparent'
defaultMark: Mixxx.WaveformMark {
align: "bottom|center"
color: "#FF0000"
textColor: "#FFFFFF"
text: " %1 "
}

untilMark.showTime: false
untilMark.showBeats: false
untilMark.align: Mixxx.WaveformUntilMark.AlignCenter
untilMark.textSize: 14

Mixxx.WaveformMark {
control: "cue_point"
text: 'CUE'
align: 'top|right'
color: '#FF8000'
textColor: '#FFFFFF'
}
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"
text: ''
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"
text: ''
align: 'top|left'
color: 'blue'
textColor: '#FFFFFF'
}
}
}
}
}
}
}
Expand Down
48 changes: 48 additions & 0 deletions res/qml/Deck.qml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,54 @@ Item {
activeColor: Theme.deckActiveColor
}

Row {
anchors.left: playButton.right
anchors.leftMargin: 10
anchors.bottom: playButton.bottom
anchors.topMargin: 5
spacing: -1

Skin.IntroOutroButton {
keyPrefix: "intro_start"
group: root.group

text: "Intro\nStart"

width: playButton.height * 2 - 1
height: playButton.height
}

Skin.IntroOutroButton {
keyPrefix: "intro_end"
group: root.group

text: "Intro\nEnd"

width: playButton.height * 2 - 1
height: playButton.height
}

Skin.IntroOutroButton {
keyPrefix: "outro_start"
group: root.group

text: "Outro\nStart"

width: playButton.height * 2 - 1
height: playButton.height
}

Skin.IntroOutroButton {
keyPrefix: "outro_end"
group: root.group

text: "Outro\nEnd"

width: playButton.height * 2 - 1
height: playButton.height
}
}

Row {
anchors.left: cueButton.right
anchors.top: parent.top
Expand Down
Loading

0 comments on commit fb057a5

Please sign in to comment.