From 61d092a50ebc4893f2736bbcdaea65be22f4ca59 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 14 Mar 2023 14:00:21 +0100 Subject: [PATCH] Pass Uint8Arrays to TraktorS3.incomingData As suggested in https://github.com/mixxxdj/mixxx/pull/11199#discussion_r1133314678. The function does accept both typed arrays and plain arrays. --- res/controllers/Traktor-Kontrol-S3-hid-scripts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js index 8642bd0d7e1..a24c81e55aa 100644 --- a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js @@ -293,15 +293,15 @@ TraktorS3.Controller = class { // with different values once. Report 2 contains the state of the mixer // controls. const report2Values = new Uint8Array(controller.getInputReport(2)); - TraktorS3.incomingData([2, ...Array.from(report2Values.map(x => ~x))]); - TraktorS3.incomingData([2, ...Array.from(report2Values)]); + TraktorS3.incomingData(new Uint8Array([2, ...Uint8Array.from(report2Values.map(x => ~x))])); + TraktorS3.incomingData(new Uint8Array([2, ...Uint8Array.from(report2Values)])); // Report 1 is the state of the deck controls. These shouldn't have any // initial effect, and most of these values will be 0 anyways. We'll // just tell the packet parser the current values so it won't ignore the // next input. const report1Values = new Uint8Array(controller.getInputReport(1)); - TraktorS3.incomingData([1, ...Array.from(report1Values)]); + TraktorS3.incomingData(new Uint8Array([1, ...Uint8Array.from(report1Values)])); // NOTE: Soft takeovers must only be enabled after setting the initial // value, or the above line won't have any effect