Skip to content

Commit

Permalink
Pass Uint8Arrays to TraktorS3.incomingData
Browse files Browse the repository at this point in the history
As suggested in
mixxxdj#11199 (comment). The
function does accept both typed arrays and plain arrays.
  • Loading branch information
robbert-vdh committed Jun 1, 2023
1 parent 580b951 commit 61d092a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions res/controllers/Traktor-Kontrol-S3-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61d092a

Please sign in to comment.