Skip to content

Commit

Permalink
WIP - Partial drawing for S4 MK3
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Oct 1, 2023
1 parent 4420f64 commit 61b365c
Show file tree
Hide file tree
Showing 17 changed files with 604 additions and 466 deletions.
2 changes: 1 addition & 1 deletion res/controllers/Dummy-Device-Default-Screen/OnAirTrack.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Item {
onTriggered: {
if (status == OnAirTrack.TimerStatus.Cooldown) {
status += backward ? -1 : 1
interval = 15
interval = 10
}
frame.x -= backward ? -1 : 1;
if (-frame.x >= (text.text.length - 29) * 11) {
Expand Down
6 changes: 3 additions & 3 deletions res/controllers/Traktor Kontrol S4 MK3.bulk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<info>
<name>S4 Mk3 screens</name>
<author>A. Colombier</author>
<description>Dummy device screens</description>
<description>Test device screens</description>
<devices>
<product protocol="bulk" vendor_id="0x17cc" product_id="0x1720" out_epaddr="0x03" />
</devices>
</info>
<controller id="Traktor">
<screens>
<screen identifier="leftdeck" width="320" height="240" targetFps="15" pixelType="RBG565" reversed="true" splashoff="200" />
<screen identifier="rightdeck" width="320" height="240" targetFps="15" pixelType="RBG565" reversed="true" splashoff="200" />
<screen identifier="leftdeck" width="320" height="240" targetFps="60" pixelType="RBG565" reversed="true" splashoff="300" />
<screen identifier="rightdeck" width="320" height="240" targetFps="60" pixelType="RBG565" reversed="true" splashoff="300" />
</screens>
<scriptfiles>
<file filename="TraktorKontrolS4MK3Screens.qml" />
Expand Down
16 changes: 12 additions & 4 deletions res/controllers/Traktor-Kontrol-S4-MK3-Screens/BPMIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Rectangle {
border.color: smallBoxBorder
border.width: 2

signal updated

Text {
id: inidcator
text: value.toFixed(2)
id: indicator
text: "-"
font.pixelSize: 17
color: fontColor
anchors.centerIn: parent
Expand All @@ -28,7 +30,10 @@ Rectangle {
group: root.group
key: "bpm"
onValueChanged: (value) => {
inidcator.text = value.toFixed(2);
const newValue = value.toFixed(2);
if (newValue === indicator.text) return;
indicator.text = newValue;
root.updated()
}
}
}
Expand All @@ -46,7 +51,10 @@ Rectangle {
group: root.group
key: "rateRange"
onValueChanged: (value) => {
range.text = `-/+ \n${(value * 100).toFixed()}%`;
const newValue = `-/+ \n${(value * 100).toFixed()}%`;
if (range.text === newValue) return;
range.text = newValue;
root.updated();
}
}
}
Expand Down
43 changes: 0 additions & 43 deletions res/controllers/Traktor-Kontrol-S4-MK3-Screens/CustomCheckBox.qml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ Rectangle {
border.width: 2

color: colorsMap[key]
signal updated

Mixxx.ControlProxy {
group: root.group
key: "key"
onValueChanged: (value) => {
if (value === root.key) return;
root.key = value;
root.updated()
}
}

Expand Down
4 changes: 4 additions & 0 deletions res/controllers/Traktor-Kontrol-S4-MK3-Screens/Keyboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ Item {

property int key: -1

signal updated

Mixxx.ControlProxy {
group: root.group
key: "key"
onValueChanged: (value) => {
if (value === root.key) return;
root.key = value;
root.updated()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Rectangle {
property color loopOnFontColor: "black"

property bool on: true
signal updated

radius: 6
border.width: 2
Expand All @@ -31,7 +32,10 @@ Rectangle {
group: root.group
key: "beatloop_size"
onValueChanged: (value) => {
indicator.text = (value < 1 ? `1/${1 / value}` : `${value}`);
const newValue = (value < 1 ? `1/${1 / value}` : `${value}`);
if (newValue === indicator.text) return;
indicator.text = newValue;
root.updated()
}
}
}
Expand All @@ -40,7 +44,9 @@ Rectangle {
group: root.group
key: "loop_enabled"
onValueChanged: (value) => {
if (value === root.on) return;
root.on = value;
root.updated()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Item {
Backward
}

signal updated

property string fullText
property int index

Expand Down Expand Up @@ -70,6 +72,7 @@ Item {
if (text.text.trim() == "-") {
text.text = trackLoadedControl.value ? `Unknown for ${root.group}` : qsTr("No Track Loaded")
}
root.updated()
}

Timer {
Expand All @@ -85,9 +88,10 @@ Item {
onTriggered: {
if (status == OnAirTrack.TimerStatus.Cooldown) {
status += backward ? -1 : 1
interval = 10
interval = 15
}
frame.x -= backward ? -1 : 1;
root.updated()
if (-frame.x >= (text.text.length - 29) * 11) {
backward = true
status = OnAirTrack.TimerStatus.Cooldown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,26 @@ Item {
property real windowWidth: Window.width

width: 0
signal updated

Mixxx.ControlProxy {
group: root.group
key: "track_loaded"
onValueChanged: (value) => {
if (value === root.visible) return;
root.visible = value
root.updated()
}
}

Mixxx.ControlProxy {
group: root.group
key: "playposition"
onValueChanged: (value) => {
root.width = value * (320 - 12);
const newValue = Math.round(value * (320 - 12));
if (newValue === root.width) return;
root.width = newValue;
root.updated()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ Rectangle {
border.color: timeColor
border.width: 2
color: timeColor
signal updated

function update() {
let newValue = "";
if (root.mode === TimeAndBeatloopIndicator.Mode.RemainingTime) {
var seconds = ((1.0 - progression.value) * duration.value);
var mins = parseInt(seconds / 60).toString();
seconds = parseInt(seconds % 60).toString();

indicator.text = `-${mins.padStart(2, '0')}:${seconds.padStart(2, '0')}`;
newValue = `-${mins.padStart(2, '0')}:${seconds.padStart(2, '0')}`;
} else {
indicator.text = (beatjump.value < 1 ? `1/${1 / beatjump.value}` : `${beatjump.value}`);
newValue = (beatjump.value < 1 ? `1/${1 / beatjump.value}` : `${beatjump.value}`);
}
if (newValue === indicator.text) return;
indicator.text = newValue;
root.updated()
}

Text {
Expand Down Expand Up @@ -69,6 +74,7 @@ Rectangle {
onValueChanged: (value) => {
root.border.color = value ? 'red' : timeColor
root.color = value ? 'red' : timeColor
root.updated()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion res/controllers/Traktor-Kontrol-S4-MK3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ class S4Mk3Deck extends Deck {
const wheelOutput = new Uint8Array(40).fill(0);
wheelOutput[0] = decks[0] - 1;

if (engine.getValue(this.group, "end_of_track") && WheelLedBlinkOnTrackEnd) {
if (engine.getValue(this.group, "end_of_track") && WheelLedBlinkOnTrackEnd && fractionOfTrack < 1) {
wheelOutput[1] = wheelLEDmodes.ringFlash;
} else {
wheelOutput[1] = wheelLEDmodes.spot;
Expand Down
Loading

0 comments on commit 61b365c

Please sign in to comment.