Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Headphones master button working! #6

Merged
merged 5 commits into from Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion Pioneer DDJ-200.midi.xml
Expand Up @@ -354,6 +354,16 @@
<fourteen-bit-msb/>
</options>
</control>
<control>
<group>[Master]</group>
<key>DDJ200.headmix</key>
<description>Headphones master button as headMix knob</description>
<status>0x96</status>
<midino>0x63</midino>
<options>
<script-binding/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>pfl</key>
Expand Down Expand Up @@ -862,7 +872,7 @@
<output>
<group>[Channel1]</group>
<key>sync_enabled</key>
<description>Deck 2: Beat sync LED</description>
<description>Deck 1: Beat sync LED</description>
<status>0x90</status>
<midino>0x58</midino>
<on>0x7F</on>
Expand Down
26 changes: 19 additions & 7 deletions Pioneer-DDJ-200-scripts.js
@@ -1,22 +1,24 @@
var DDJ200 = {};
var DDJ200 = {
headMix_switch : 0
};

DDJ200.init = function () {}
DDJ200.init = function () {};

DDJ200.shutdown = function () {}
DDJ200.shutdown = function () {};

DDJ200.scratch = function (channel, control, value, status, group) {
// For a control that centers on 0x40 (64):
// Convert value down to +1/-1
// Register the movement
engine.scratchTick(script.deckFromGroup(group), value - 64);
}
};

DDJ200.jog = function (channel, control, value, status, group) {
// For a control that centers on 0x40 (64):
// Convert value down to +1/-1
// Register the movement
engine.setValue(group, 'jog', value - 64);
}
};

DDJ200.touch = function (channel, control, value, status, group) {
var deckNumber = script.deckFromGroup(group);
Expand All @@ -28,7 +30,7 @@ DDJ200.touch = function (channel, control, value, status, group) {
var alpha = 1.0 / 8;
engine.scratchEnable(deckNumber, 128, 33 + 1 / 3, alpha, alpha / 32);
}
}
};

DDJ200.seek = function (channel, control, value, status, group) {
var oldPos = engine.getValue(group, "playposition");
Expand All @@ -38,4 +40,14 @@ DDJ200.seek = function (channel, control, value, status, group) {
var duration = engine.getValue(group, "duration");
var newPos = Math.max(0, oldPos + ((value - 64) * 0.2 / duration));
engine.setValue(group, "playposition", newPos); // Strip search
}
};

DDJ200.headmix = function (channel, control, value, status, group) {
if (value == 0) { return; }
DDJ200.headMix_switch = 1 - DDJ200.headMix_switch;
// toggle headMix knob to values of -1 and 1
engine.setValue("[Master]", "headMix", 2 * DDJ200.headMix_switch - 1);

// now switch headMix LED with midi.sendShortMsg(0x96, 0x63, 0x7F or 0);
midi.sendShortMsg(0x90+channel, control, 0x7F * DDJ200.headMix_switch);
};