Skip to content

Commit

Permalink
feat: controller screen rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Nov 2, 2023
1 parent c781980 commit 6278a36
Show file tree
Hide file tree
Showing 43 changed files with 3,707 additions and 227 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
-DMACOS_BUNDLE=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
-DVCPKG_TARGET_TRIPLET=x64-osx-min1015
-DVCPKG_DEFAULT_HOST_TRIPLET=x64-osx-min1015
Expand All @@ -69,6 +70,7 @@ jobs:
-DMACOS_BUNDLE=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
-DVCPKG_TARGET_TRIPLET=arm64-osx-min1100
-DVCPKG_DEFAULT_HOST_TRIPLET=x64-osx-min1015
Expand Down Expand Up @@ -98,6 +100,7 @@ jobs:
-DMEDIAFOUNDATION=ON
-DMODPLUG=ON
-DQT6=ON
-DQML=OFF
-DWAVPACK=ON
cc: cl
cxx: cl
Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,12 @@ if (NOT QML)
src/control/controlmodel.cpp
src/control/controlsortfiltermodel.cpp
)
else()
target_sources(mixxx-lib PRIVATE
# The following source depends of QML being available but aren't part of the new QML UI
src/controllers/rendering/controllerrenderingengine.cpp
src/controllers/controllerscreenpreview.cpp
)
endif()
if(QOPENGL)
target_sources(mixxx-lib PRIVATE
Expand Down Expand Up @@ -2082,8 +2088,15 @@ add_executable(mixxx-test
src/test/wpushbutton_test.cpp
src/test/wwidgetstack_test.cpp
src/util/moc_included_test.cpp
src/test/helpers/log_test.cpp
)
target_precompile_headers(mixxx-test REUSE_FROM mixxx-lib)
if (QML)
target_sources(mixxx-test PRIVATE
src/test/controller_mapping_file_handler_test.cpp
src/test/controllerrenderingengine_test.cpp
)
endif()
find_package(GTest CONFIG REQUIRED)
set_target_properties(mixxx-test PROPERTIES AUTOMOC ON)
target_link_libraries(mixxx-test PRIVATE mixxx-lib mixxx-gitinfostore GTest::gtest GTest::gmock)
Expand Down
22 changes: 22 additions & 0 deletions res/controllers/Dummy Device Screen.hid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<MixxxControllerPreset mixxxVersion="2.4.0" schemaVersion="1">
<info>
<name>Dummy Device (Screens)</name>
<author>A. Colombier</author>
<description>Dummy device screens</description>
<devices>
<product protocol="hid" vendor_id="0xdead" product_id="0xbeaf" />
</devices>
</info>
<controller id="DummyDevice">
<screens>
<screen identifier="main" width="480" height="360" targetFps="20" pixelType="RBGA" splashoff="500" />
<screen identifier="jog" width="128" height="128" targetFps="5" pixelType="RBGA" />
</screens>
<scriptfiles>
<file filename="DummyDeviceDefaultScreen.qml" />
</scriptfiles>
<qmllibraries>
</qmllibraries>
</controller>
</MixxxControllerPreset>
267 changes: 267 additions & 0 deletions res/controllers/DummyDeviceDefaultScreen.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
import QtQuick 2.15
import QtQuick.Window 2.3
import QtQuick.Scene3D 2.14

import QtQuick.Controls 2.15
import QtQuick.Shapes 1.11
import QtQuick.Layouts 1.3
import QtQuick.Window 2.15

import Qt5Compat.GraphicalEffects

import Mixxx 1.0 as Mixxx
import Mixxx.Controls 1.0 as MixxxControls

Item {
id: root

required property string screenId
property color fontColor: Qt.rgba(242/255,242/255,242/255, 1)
property color smallBoxBorder: Qt.rgba(44/255,44/255,44/255, 1)

property string group: "[Channel1]"
property var deckPlayer: Mixxx.PlayerManager.getPlayer(root.group)

function init(controlerName, isDebug) {
console.log(`Screen ${root.screenId} has started`)
switch (root.screenId) {
case "jog":
loader.sourceComponent = jog
break;
default:
loader.sourceComponent = main
}
}

function shutdown() {
console.log(`Screen ${root.screenId} is stopping`)
loader.sourceComponent = splash
}

// function transformFrame(input: ArrayBuffer, timestamp: date) {
function transformFrame(input, timestamp) {
return new ArrayBuffer(0);
}

Mixxx.ControlProxy {
group: root.group
key: "track_loaded"

onValueChanged: (value) => {
deckPlayer = Mixxx.PlayerManager.getPlayer(root.group)
}
}

Timer {
id: channelchange

interval: 2000
repeat: true
running: true

onTriggered: {
root.group = root.group === "[Channel1]" ? "[Channel2]" : "[Channel1]"
deckPlayer = Mixxx.PlayerManager.getPlayer(root.group)
}
}

Component {
id: splash
Rectangle {
color: "black"
anchors.fill: parent
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: "../images/templates/logo_mixxx.png"
}
}
}

Component {
id: jog

Rectangle {
anchors.fill: parent
color: "black"

Image {
id: artwork
anchors.fill: parent
visible: deckPlayer.trackLocationUrl.toString().length !== 0

source: deckPlayer.coverArtUrl ?? "../images/templates/logo_mixxx.png"
height: 100
width: 100
fillMode: Image.PreserveAspectFit
}

Text {
visible: deckPlayer.trackLocationUrl.toString().length === 0

text: qsTr("No Track Loaded")
font.pixelSize: 12
font.family: "Noto Sans"
font.letterSpacing: -1
color: "white"
}
}
}

Component {
id: main

Rectangle {
id: debugValue
anchors.fill: parent
color: 'black'

antialiasing: true

ColumnLayout {
id: column
anchors.fill: parent
anchors.leftMargin: 0
anchors.rightMargin: 0
anchors.topMargin: 0
anchors.bottomMargin: 0
spacing: 6

RowLayout {
Layout.fillWidth: true
spacing: 0

Repeater {
id: debugColor

model: [
"black",
"white",
"red",
"green",
"blue",
Qt.rgba(0, 1, 1),
]

Rectangle {
required property var modelData

color: modelData
Layout.fillWidth: true
height: 80
}
}
}

RowLayout {
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6

Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: qsTr("Group")
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: `${root.group}`
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}
}

Repeater {
model: [{
controllerKey: "beatloop_size",
title: "Beatloop Size"
}, {
controllerKey: "track_samples",
title: "Track sample"
}, {
controllerKey: "track_samplerate",
title: "Track sample rate"
}, {
controllerKey: "playposition",
title: "Play position"
}, {
controllerKey: "rate_ratio",
title: "Rate ratio"
}, {
controllerKey: "waveform_zoom",
title: "Waveform zoom"
}
]

RowLayout {
id: row
anchors.leftMargin: 6
anchors.rightMargin: 6
anchors.topMargin: 6
anchors.bottomMargin: 6
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 6
required property var modelData

Mixxx.ControlProxy {
id: mixxxValue
group: root.group
key: modelData.controllerKey
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: qsTr(modelData.title)
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}

Rectangle {
color: 'transparent'
Layout.fillWidth: true
Layout.fillHeight: true
Text {
text: `${mixxxValue.value}`
font.pixelSize: 24
font.family: "Noto Sans"
font.letterSpacing: -1
color: fontColor
}
}
}
}
}
}
}
Loader {
id: loader
anchors.fill: parent
sourceComponent: splash
}
}
2 changes: 1 addition & 1 deletion src/controllers/bulk/bulkcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void BulkController::sendBytes(const QByteArray& data) {
qCWarning(m_logOutput) << "Unable to send data to" << getName()
<< "serial #" << m_sUID;
} else {
qCDebug(m_logOutput) << ret << "bytes sent to" << getName()
qCDebug(m_logOutput) << transferred << "bytes sent to" << getName()
<< "serial #" << m_sUID;
}
}
Loading

0 comments on commit 6278a36

Please sign in to comment.