Skip to content

Commit

Permalink
feat: add Joe Easton's mod for S4Mk3 screens
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Sep 15, 2024
1 parent 4ca0e47 commit e2e4950
Show file tree
Hide file tree
Showing 122 changed files with 11,879 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import QtQuick 2.15

import './CSI' as CSI
import './Screens/Defines' as Defines
import './Screens/S4MK3/Views' as Views
import './Screens/S4MK3' as S4MK3

//----------------------------------------------------------------------------------------------------------------------
// S4MK3 Screen - manage top/bottom deck of one screen
//----------------------------------------------------------------------------------------------------------------------

Item {
id: screen

required property bool isLeftScreen

//--------------------------------------------------------------------------------------------------------------------

readonly property int topDeckId: isLeftScreen ? 1 : 2
readonly property int bottomDeckId: isLeftScreen ? 3 : 4
property bool propTopDeckFocus: true

Defines.Font {id: fonts}
Defines.Utils {id: utils}
Defines.Settings {id: settings}
Defines.Durations {id: durations}
Views.Colors {id: colors}

property int deckA: settings.deckAColour
property int deckB: settings.deckBColour
property int deckC: settings.deckCColour
property int deckD: settings.deckDColour

Component.onCompleted: {
if (engine.getSetting("useSharedDataAPI")) {
engine.makeSharedDataConnection(screen.onSharedDataUpdate)
}
}

function onSharedDataUpdate(data) {
if (typeof data === "object" && typeof data.group === "object") {
propTopDeckFocus = data.group[isLeftScreen ? 'leftdeck' : 'rightdeck'] === `[Channel${screen.topDeckId}]`
}
}

width: 320
height: 240
clip: true

/*
A screen is visible if -
The deck is in focus and the linked deck is not selecting a sample slot
OR
The deck is not in focus but a sample slot is selected
*/
S4MK3.DeckScreen {
id: topDeckScreen
deckId: topDeckId
visible: propTopDeckFocus
anchors.fill: parent
}

S4MK3.DeckScreen {
id: bottomDeckScreen
deckId: bottomDeckId
visible: !propTopDeckFocus
anchors.fill: parent
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

// Returns a color for the specified Deck index
/**
*
* @param deckIdx
*/
function colorForDeck(deckIdx) {
switch (deckIdx) {
case 1:
case 2:
// Deck A and B are color-coded in Blue
return Color.Blue;

case 3:
case 4:
// Deck C and D are color-coded in Orange
return Color.LightOrange;
}

// Fall-through...
return Color.Black;
}

// primary decks default to track, secondary decks default to remix
/**
*
* @param deckIdx
*/
function defaultTypeForDeck(deckIdx) {
return (deckIdx > 2) ? DeckType.Remix : DeckType.Track;
}

/**
*
* @param deckType
*/
function deckTypeSupportsGridAdjust(deckType) {
return deckType == DeckType.Track || deckType == DeckType.Stem;
}

/**
*
* @param deckIdx
*/
function linkedDeckIdx(deckIdx) {
switch (deckIdx) {
// Deck A and C are linked
case 0: return 2;
case 2: return 0;
// Deck B and D are linked
case 1: return 3;
case 3: return 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

// Returns a color for the specified Deck index
/**
*
* @param deckId
* @param deckA
* @param deckB
* @param deckC
* @param deckD
*/
function colorForDeck(deckId, deckA, deckB, deckC, deckD) {
switch (deckId) {
case 1: return colorForDeckSingle(deckA);
case 2: return colorForDeckSingle(deckB);
case 3: return colorForDeckSingle(deckC);
case 4: return colorForDeckSingle(deckD);
}
}

/**
*
* @param deck
*/
function colorForDeckSingle(deck) {
if (deck === 0) { return Color.Red; } else if (deck === 1) { return Color.DarkOrange; } else if (deck === 2) { return Color.LightOrange; } else if (deck === 3) { return Color.White; } else if (deck === 4) { return Color.Yellow; } else if (deck === 5) { return Color.Lime; } else if (deck === 6) { return Color.Green; } else if (deck === 7) { return Color.Mint; } else if (deck === 8) { return Color.Cyan; } else if (deck === 9) { return Color.Turquoise; } else if (deck === 10) { return Color.Blue; } else if (deck === 11) { return Color.Plum; } else if (deck === 12) { return Color.Violet; } else if (deck === 13) { return Color.Purple; } else if (deck === 14) { return Color.Magenta; } else if (deck === 15) { return Color.Fuchsia; } else if (deck === 16) { return Color.Black; } else if (deck === 17) { return Color.WarmYellow; } else { return Color.White; }
}

/**
*
* @param deck
*/
function colorForDeckSingle2(deck) {
if (deck === 0) { return Color.Red; } else if (deck === 1) { return Color.DarkOrange; } else if (deck === 2) { return Color.LightOrange; } else if (deck === 3) { return Color.White; } else if (deck === 4) { return Color.Yellow; } else if (deck === 5) { return Color.Lime; } else if (deck === 6) { return Color.Green; } else if (deck === 7) { return Color.Mint; } else if (deck === 8) { return Color.Cyan; } else if (deck === 9) { return Color.Turquoise; } else if (deck === 10) { return Color.Blue; } else if (deck === 11) { return Color.Plum; } else if (deck === 12) { return Color.Violet; } else if (deck === 13) { return Color.Purple; } else if (deck === 14) { return Color.Magenta; } else if (deck === 15) { return Color.Fuchsia; } else if (deck === 16) { return Color.WarmYellow; } else { return Color.White; }
}

/**
*
* @param key
* @param masterKey
*/
function colorKey(key, masterKey) {
if (key === "1m" || "1M") { if (masterKey === "12m" || "12M" || "2m" || "2M") { return true; } } else { return false; }
}

// primary decks default to track, secondary decks default to remix
/**
*
* @param deckIdx
*/
function defaultTypeForDeck(deckIdx) {
return (deckIdx > 2) ? DeckType.Remix : DeckType.Track;
}

/**
*
* @param deckType
*/
function deckTypeSupportsGridAdjust(deckType) {
return deckType === DeckType.Track || deckType === DeckType.Stem;
}

/**
*
* @param val
*/
function select(val) {
return Math.round(val * 45);
}

/**
*
* @param deckIdx
*/
function linkedDeckIdx(deckIdx) {
switch (deckIdx) {
// Deck A and C are linked
case 0: return 2;
case 2: return 0;
// Deck B and D are linked
case 1: return 3;
case 3: return 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
pragma Singleton

import QtQuick 2.15

// Constants to use in enables based on active footer page
QtObject {
readonly property int empty: 0
readonly property int filter: 1
readonly property int pitch: 2
readonly property int fxSend: 3
readonly property int fx: 4
readonly property int midi: 5
readonly property int volume: 6
readonly property int slot1: 7
readonly property int slot2: 8
readonly property int slot3: 9
readonly property int slot4: 10

readonly property variant states: [ "EMPTY"
, "FILTER"
, "PITCH"
, "FX SEND"
, "FX"
, "MIDI"
, "VOLUME"
, "SLOT 1"
, "SLOT 2"
, "SLOT 3"
, "SLOT 4"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pragma Singleton

import QtQuick 2.15

// Constants to use in enables based on active overlay
QtObject {
readonly property int upper_button_1: 0
readonly property int upper_button_2: 1
readonly property int upper_button_3: 2
readonly property int upper_button_4: 3
readonly property int lower_button_1: 4
readonly property int lower_button_2: 5
readonly property int lower_button_3: 6
readonly property int lower_button_4: 7
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pragma Singleton

import QtQuick 2.15

// Constants to use in enables based on active overlay
QtObject {
readonly property int none: 0
readonly property int bpm: 1
readonly property int key: 2
readonly property int fx: 3
readonly property int quantize: 4
readonly property int slice: 5
readonly property int sorting: 6
readonly property int capture: 7
readonly property int browserWarnings: 8
readonly property int swing: 9

readonly property variant states: [ "none"
, "bpm"
, "key"
, "fx"
, "quantize"
, "slice"
, "sorting"
, "capture"
, "browserWarnings"
, "swing"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
pragma Singleton

import QtQuick 2.15
import '..' as CSI

QtObject {
readonly property int disabled: 0
readonly property int hotcues: 1
readonly property int remix: 2
readonly property int stems: 3
readonly property int freeze: 4
readonly property int loop: 5
readonly property int favorite: 6
readonly property int roll: 7
readonly property int jump: 8
readonly property int fx1: 9
readonly property int fx2: 10
readonly property int tone: 11
readonly property int fxBank1: 12
readonly property int fxBank2: 13
readonly property int fxBank3: 14
readonly property int fxBank4: 15

function isPadsModeSupported(padMode, deckType) {
switch(padMode) {
case disabled:
return deckType == DeckType.Live
case hotcues:
return deckType == DeckType.Stem || deckType == DeckType.Track;
case remix:
return deckType == DeckType.Remix;
case stems:
return deckType == DeckType.Stem;
case freeze:
return deckType == DeckType.Stem || deckType == DeckType.Track;
case loop:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case jump:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case favorite:
return deckType == DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case roll:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case fx1:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case fx2:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case tone:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track;
case fxBank1:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case fxBank2:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case fxBank3:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
case fxBank4:
return deckType != DeckType.Live || deckType == DeckType.Stem || deckType == DeckType.Track || deckType == DeckType.Remix;
}
}

function defaultPadsModeForDeck(deckType) {

switch(deckType) {
case DeckType.Stem:
return stems;
case DeckType.Remix:
return remix;
case DeckType.Track:
return hotcues;
case DeckType.Live:
default:
return disabled;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma Singleton

import QtQuick 2.15

QtObject {
readonly property int deck: 0
readonly property int browser: 1
readonly property int settings: 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma Singleton

import QtQuick 2.15

// Constants to use in enables based on active overlay
QtObject {
readonly property int track: 0
readonly property int daw: 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
singleton Overlay Overlay.qml
singleton FxOverlay FxOverlay.qml
singleton FooterPage FooterPage.qml
singleton StemStyle StemStyle.qml
singleton ScreenView ScreenView.qml
singleton PadsMode PadsMode.qml
Loading

0 comments on commit e2e4950

Please sign in to comment.