diff options
author | Michael Schmidt <github@schmidt.tw> | 2019-10-07 20:25:16 +0200 |
---|---|---|
committer | Michael Schmidt <github@schmidt.tw> | 2019-12-14 00:26:26 +0100 |
commit | 43988b41b3071f6e1ff5ee0edfb4cee64f43c1ba (patch) | |
tree | 5903f86f6d2a0c3e2a41beee682a709158ef0622 /res | |
parent | 65e2f06e099cd74aabd9c888e9d67b7f6af96f74 (diff) |
Traktor Kontrol S2MK3: VuMeter handling
Diffstat (limited to 'res')
-rw-r--r-- | res/controllers/Traktor Kontrol S2 MK3.hid.xml | 2 | ||||
-rw-r--r-- | res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js | 53 |
2 files changed, 54 insertions, 1 deletions
diff --git a/res/controllers/Traktor Kontrol S2 MK3.hid.xml b/res/controllers/Traktor Kontrol S2 MK3.hid.xml index b9985996d9..813083e5e4 100644 --- a/res/controllers/Traktor Kontrol S2 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S2 MK3.hid.xml @@ -4,7 +4,7 @@ <name>Traktor Kontrol S2 MK3</name> <author>Michael Schmidt</author> <description>HID Mapping for Traktor Kontrol S2 MK3</description> - <wiki>http://mixxx.org/wiki/doku.php/traktor_s2_mk3</wiki> + <wiki>https://www.mixxx.org/wiki/doku.php/native_instruments_traktor_s2_mk3</wiki> <devices> <product protocol="hid" vendor_id="0x17cc" product_id="0x1710" usage_page="0xff01" usage="0x1" interface_number="0x3" /> </devices> diff --git a/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js index cadeb9f0b8..43ff4b61ae 100644 --- a/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js @@ -74,6 +74,13 @@ TraktorS2MK3 = new function () { // Jog wheels this.last_tick_val = [0, 0]; this.last_tick_time = [0.0, 0.0]; + + // VuMeter + this.vuLeftConnection = {}; + this.vuRightConnection = {}; + this.clipLeftConnection = {}; + this.clipRightConnection = {}; + this.vuMeterValues = {"vu-18": (1/6), "vu-12": (1/6*2), "vu-6": (1/6*3), "vu0": (1/6*4), "vu6": (1/6*5)}; } TraktorS2MK3.init = function (id) { @@ -587,6 +594,20 @@ TraktorS2MK3.registerOutputPackets = function () { output.addOutput("[Channel1]", "pfl", 0x1A, "B"); output.addOutput("[Channel2]", "pfl", 0x1B, "B"); + output.addOutput("[Channel1]", "vu-18", 0x1C, "B"); + output.addOutput("[Channel1]", "vu-12", 0x1D, "B"); + output.addOutput("[Channel1]", "vu-6", 0x1E, "B"); + output.addOutput("[Channel1]", "vu0", 0x1F, "B"); + output.addOutput("[Channel1]", "vu6", 0x20, "B"); + output.addOutput("[Channel1]", "PeakIndicator", 0x21, "B"); + + output.addOutput("[Channel2]", "vu-18", 0x22, "B"); + output.addOutput("[Channel2]", "vu-12", 0x23, "B"); + output.addOutput("[Channel2]", "vu-6", 0x24, "B"); + output.addOutput("[Channel2]", "vu0", 0x25, "B"); + output.addOutput("[Channel2]", "vu6", 0x26, "B"); + output.addOutput("[Channel2]", "PeakIndicator", 0x27, "B"); + output.addOutput("[ChannelX]", "fxButton1", 0x16, "B"); output.addOutput("[ChannelX]", "fxButton2", 0x17, "B"); output.addOutput("[ChannelX]", "fxButton3", 0x18, "B"); @@ -632,6 +653,12 @@ TraktorS2MK3.registerOutputPackets = function () { this.linkOutput("[Channel1]", "pfl", this.outputHandler); this.linkOutput("[Channel2]", "pfl", this.outputHandler); + // VuMeter + this.vuLeftConnection = engine.makeConnection("[Channel1]", "VuMeter", this.vuMeterHandler); + this.vuRightConnection = engine.makeConnection("[Channel2]", "VuMeter", this.vuMeterHandler); + this.clipLeftConnection = engine.makeConnection("[Channel1]", "PeakIndicator", this.vuOutputHandler); + this.clipRightConnection = engine.makeConnection("[Channel2]", "PeakIndicator", this.vuOutputHandler); + TraktorS2MK3.lightDeck(); } @@ -640,6 +667,25 @@ TraktorS2MK3.linkOutput = function (group, name, callback) { TraktorS2MK3.controller.linkOutput(group, name, group, name, callback); } +TraktorS2MK3.vuMeterHandler = function (value, group, key) { + for (var vuKey in TraktorS2MK3.vuMeterValues) { + if(TraktorS2MK3.vuMeterValues[vuKey] > value) { + TraktorS2MK3.vuOutputHandler(false, group, vuKey); + } else { + TraktorS2MK3.vuOutputHandler(true, group, vuKey); + } + } +} + +TraktorS2MK3.vuOutputHandler = function (value, group, key) { + var led_value = 0x00; + if (value) { + led_value = 0x7E; + } + + TraktorS2MK3.controller.setOutput(group, key, led_value, true); +} + TraktorS2MK3.outputHandler = function (value, group, key) { var led_value = 0x7C; if (value) { @@ -714,6 +760,13 @@ TraktorS2MK3.messageCallback = function (packet, data) { } TraktorS2MK3.shutdown = function () { + + // VuMeter connections + this.vuLeftConnection.disconnect(); + this.vuRightConnection.disconnect(); + this.clipLeftConnection.disconnect(); + this.clipRightConnection.disconnect(); + // Deactivate all LEDs var data_string = "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \n" + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \n" + |