Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into huxley-hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
ywwg committed Sep 16, 2024
2 parents 06580d6 + 6b4a6f9 commit 4176d50
Show file tree
Hide file tree
Showing 43 changed files with 4,799 additions and 4,604 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/effects/backends/builtin/linkwitzriley8eqeffect.cpp
src/effects/backends/builtin/loudnesscontoureffect.cpp
src/effects/backends/builtin/metronomeeffect.cpp
src/effects/backends/builtin/metronomeclick.cpp
src/effects/backends/builtin/moogladder4filtereffect.cpp
src/effects/backends/builtin/compressoreffect.cpp
src/effects/backends/builtin/parametriceqeffect.cpp
Expand Down
107 changes: 83 additions & 24 deletions res/controllers/Denon-MC7000-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ MC7000.jogParams = {
}
};

// Parameter button settings (the orange buttons at the bottom left/right of the controller).
MC7000.parameterButtonSettings = {
// Parameter button mode. Available modes are `starsAndColor`, `beatjump` and `introOutro`.
mode: engine.getSetting("parameterButtonMode") ?? "starsAndColor",
// Whether to use the parameter buttons to change the pitch range during
// pitch play mode. If this option is enabled, the pitch change
// functionality overrides the normal parameter button mode during pitch play.
parameterButtonPitchPlayOverrideEnabled: engine.getSetting("parameterButtonPitchPlayOverrideEnabled") ?? true,
};

/*/////////////////////////////////
// USER VARIABLES END //
/////////////////////////////////*/
Expand Down Expand Up @@ -162,9 +172,6 @@ MC7000.prevVuLevel = [0, 0, 0, 0];
MC7000.prevJogLED = [0, 0, 0, 0];
MC7000.prevPadLED = [0, 0, 0, 0];

// Param Buttons for Pitch Play
MC7000.paramButton = [0, 0, 0, 0];

/*
Color Codes:
Colors are encoded using the following schema: Take the individual components of the color (R, G, B). Then use
Expand Down Expand Up @@ -952,35 +959,87 @@ MC7000.censor = function(channel, control, value, status, group) {
}
}
};
// Param Button for Pitch Play to decrease pitch, or decrease star rating otherwise
MC7000.StarsDown = function(channel, control, value, status, group) {
const deckNumber = script.deckFromGroup(group);
const deckIndex = deckNumber - 1;
if (value > 0x00) {
if (MC7000.PADMode[deckIndex] === "Pitch") {
for (let padIdx = 0; padIdx < 8; padIdx++) {
MC7000.halftoneToPadMap[deckIndex][padIdx] = MC7000.halftoneToPadMap[deckIndex][padIdx] - 8; // pitch down
}
} else {
engine.setValue(group, "stars_down", true); // stars down
}

// Parameter Buttons
MC7000.parameterButton = function(value, group, {isLeftButton, isShiftPressed}) {
if (value === 0) {
return;
}
};
// Param Button for Pitch Play to increase pitch, or increase star rating otherwise
MC7000.StarsUp = function(channel, control, value, status, group) {

const deckNumber = script.deckFromGroup(group);
const deckIndex = deckNumber - 1;
if (value > 0x00) {
if (MC7000.PADMode[deckIndex] === "Pitch") {
for (let padIdx = 0; padIdx < 8; padIdx++) {
MC7000.halftoneToPadMap[deckIndex][padIdx] = MC7000.halftoneToPadMap[deckIndex][padIdx] + 8; // pitch up
const settings = MC7000.parameterButtonSettings;

if (settings.parameterButtonPitchPlayOverrideEnabled && MC7000.PADMode[deckIndex] === "Pitch") {
const pitchDelta = isLeftButton ? -8 : 8;
for (let padIdx = 0; padIdx < 8; padIdx++) {
MC7000.halftoneToPadMap[deckIndex][padIdx] += pitchDelta;
}
} else {
switch (settings.mode) {
case "starsAndColor":
if (isShiftPressed) {
script.triggerControl(group, `track_color_${isLeftButton ? "prev" : "next"}`);
} else {
script.triggerControl(group, `stars_${isLeftButton ? "down" : "up"}`);
}
} else {
engine.setValue(group, "stars_up", true); // stars up
break;
case "beatjump":
if (isShiftPressed) {
const beatJumpSize = engine.getValue(group, "beatjump_size");
const indexDelta = isLeftButton ? -1 : 1;
const newIndex = Math.max(0, Math.min(MC7000.beatJump.length - 1, MC7000.beatJump.indexOf(beatJumpSize) + indexDelta));
const newBeatJumpSize = MC7000.beatJump[newIndex];
engine.setValue(group, "beatjump_size", newBeatJumpSize);
} else {
script.triggerControl(group, `beatjump_${isLeftButton ? "backward" : "forward"}`);
}
break;
case "introOutro":
{
const cue = isLeftButton ? "intro_end" : "outro_start";
const action = isShiftPressed ? "clear" : "activate";
script.triggerControl(group, `${cue}_${action}`);
}
break;
default:
break;
}
}
};

// Parameter Button '<'
MC7000.parameterButtonLeft = function(channel, control, value, status, group) {
MC7000.parameterButton(value, group, {
isLeftButton: true,
isShiftPressed: false
});
};

// Parameter Button '>'
MC7000.parameterButtonRight = function(channel, control, value, status, group) {
MC7000.parameterButton(value, group, {
isLeftButton: false,
isShiftPressed: false
});
};

// Parameter Button '<' + 'SHIFT'
MC7000.parameterButtonLeftShifted = function(channel, control, value, status, group) {
MC7000.parameterButton(value, group, {
isLeftButton: true,
isShiftPressed: true
});
};

// Parameter Button '>' + 'SHIFT'
MC7000.parameterButtonRightShifted = function(channel, control, value, status, group) {
MC7000.parameterButton(value, group, {
isLeftButton: false,
isShiftPressed: true
});
};

// Set Crossfader Curve
MC7000.crossFaderCurve = function(control, value) {
script.crossfaderCurve(value);
Expand Down
92 changes: 60 additions & 32 deletions res/controllers/Denon-MC7000.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,34 @@
</option>
</group>
</group>
<group label="Alternative Mapping">
<group label="Parameter Buttons">
<option
variable="parameterButtonMode"
type="enum"
label="Parameter Button Mode">
<value label="Change Star Rating (Shift: Track Color)" default="true">starsAndColor</value>
<value label="Perform Beat Jump (Shift: Adjust Jump Size)">beatjump</value>
<value label="Set Intro/Outro (Shift: Clear Intro/Outro)">introOutro</value>
<description>
Change the functionality of the orange parameter buttons
in the bottom left/right corner of the controller.
</description>
</option>
<option
variable="parameterButtonPitchPlayOverrideEnabled"
label="Override parameter button mode during pitch play to set pitch range"
type="boolean"
default="true">
<description>
Whether to use the parameter buttons to change the pitch
range during pitch play mode. If this option is enabled,
the pitch change functionality overrides the normal
parameter button mode during pitch play.
</description>
</option>
</group>
</group>
</settings>
<controller id="DENON MC7000">
<scriptfiles>
Expand Down Expand Up @@ -1984,7 +2012,7 @@
<!-- PARAMETER BUTTONS -->
<control>
<group>[Channel1]</group>
<key>MC7000.StarsDown</key>
<key>MC7000.parameterButtonLeft</key>
<description></description>
<status>0x94</status>
<midino>0x28</midino>
Expand All @@ -1994,7 +2022,7 @@
</control>
<control>
<group>[Channel1]</group>
<key>MC7000.StarsUp</key>
<key>MC7000.parameterButtonRight</key>
<description></description>
<status>0x94</status>
<midino>0x29</midino>
Expand All @@ -2003,28 +2031,28 @@
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_prev</key>
<group>[Channel1]</group>
<key>MC7000.parameterButtonLeftShifted</key>
<description></description>
<status>0x94</status>
<midino>0x2A</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_next</key>
<group>[Channel1]</group>
<key>MC7000.parameterButtonRightShifted</key>
<description></description>
<status>0x94</status>
<midino>0x2B</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>MC7000.StarsDown</key>
<key>MC7000.parameterButtonLeft</key>
<description></description>
<status>0x95</status>
<midino>0x28</midino>
Expand All @@ -2034,7 +2062,7 @@
</control>
<control>
<group>[Channel2]</group>
<key>MC7000.StarsUp</key>
<key>MC7000.parameterButtonRight</key>
<description></description>
<status>0x95</status>
<midino>0x29</midino>
Expand All @@ -2043,28 +2071,28 @@
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_prev</key>
<group>[Channel2]</group>
<key>MC7000.parameterButtonLeftShifted</key>
<description></description>
<status>0x95</status>
<midino>0x2A</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_next</key>
<group>[Channel2]</group>
<key>MC7000.parameterButtonRightShifted</key>
<description></description>
<status>0x95</status>
<midino>0x2B</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel3]</group>
<key>MC7000.StarsDown</key>
<key>MC7000.parameterButtonLeft</key>
<description></description>
<status>0x96</status>
<midino>0x28</midino>
Expand All @@ -2074,7 +2102,7 @@
</control>
<control>
<group>[Channel3]</group>
<key>MC7000.StarsUp</key>
<key>MC7000.parameterButtonRight</key>
<description></description>
<status>0x96</status>
<midino>0x29</midino>
Expand All @@ -2083,28 +2111,28 @@
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_prev</key>
<group>[Channel3]</group>
<key>MC7000.parameterButtonLeftShifted</key>
<description></description>
<status>0x96</status>
<midino>0x2A</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_next</key>
<group>[Channel3]</group>
<key>MC7000.parameterButtonRightShifted</key>
<description></description>
<status>0x96</status>
<midino>0x2B</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Channel4]</group>
<key>MC7000.StarsDown</key>
<key>MC7000.parameterButtonLeft</key>
<description></description>
<status>0x97</status>
<midino>0x28</midino>
Expand All @@ -2114,7 +2142,7 @@
</control>
<control>
<group>[Channel4]</group>
<key>MC7000.StarsUp</key>
<key>MC7000.parameterButtonRight</key>
<description></description>
<status>0x97</status>
<midino>0x29</midino>
Expand All @@ -2123,23 +2151,23 @@
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_prev</key>
<group>[Channel4]</group>
<key>MC7000.parameterButtonLeftShifted</key>
<description></description>
<status>0x97</status>
<midino>0x2A</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<control>
<group>[Library]</group>
<key>track_color_next</key>
<group>[Channel4]</group>
<key>MC7000.parameterButtonRightShifted</key>
<description></description>
<status>0x97</status>
<midino>0x2B</midino>
<options>
<normal/>
<script-binding/>
</options>
</control>
<!-- LIBRARY -->
Expand Down
11 changes: 11 additions & 0 deletions res/controllers/engine-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ declare interface ScriptConnection {
* Note: To execute all callback functions connected to a ControlObject at once, use {@link engine.trigger} instead
*/
trigger(): void;

/**
* String representation of the unique UUID of this connection instance
*/
readonly id: string;

/**
* whether the connection instance is actually responds to changes to the ControlObject it was created for.
* This is always true for a newly created instance and usually false after calling {@link disconnect}
*/
readonly isConnected: boolean;
}


Expand Down
Loading

0 comments on commit 4176d50

Please sign in to comment.