mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.51k stars 1.28k forks source link

Traktor Kontrol Z1 - RangeError: index out of range #13832

Open JoergAtGithub opened 1 week ago

JoergAtGithub commented 1 week ago

I´m a new user and when I tried to connect my unity to mix, and error was reported. Could anyone help me, please?:

Uncaught exception: file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/common-hid-packet-parser.js:455: RangeError: index out of range Backtrace: unpack@file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/common-hid-packet-parser.js:455 parse@file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/common-hid-packet-parser.js:989 parsePacket@file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/common-hid-packet-parser.js:1636 readCurrentPosition@file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/Traktor-Kontrol-Z1-scripts.js:123 init@file:///Volumes/mixxx-2.4.1/Mixxx.app/Contents/Resources/controllers/Traktor-Kontrol-Z1-scripts.js:26

Originally posted by @Karaku in https://github.com/mixxxdj/mixxx/issues/1989#issuecomment-2453523144

JoergAtGithub commented 1 week ago

@Karaku Could you try to replace the following lines in Traktor-Kontrol-Z1-scripts.js at Line 119

 readCurrentPosition() {
     // Sync on-screen controls with controller knob positions
     const report0x01 = new Uint8Array(controller.getInputReport(0x01));
     // The first packet is ignored by HIDController
     this.controller.parsePacket([0x01, ...Array.from(report0x01.map(x => x ^ 0xFF))]);
     this.controller.parsePacket([0x01, ...Array.from(report0x01)]);
 }

by


 readCurrentPosition() {
     // Sync on-screen controls with controller knob positions
     const report0x01 = new Uint8Array(controller.getInputReport(0x01));
     // The first packet is ignored by HIDController
     this.incomingData([0x01, ...report0x01.map(x => ~x)]);
     this.incomingData([0x01, ...report0x01]);
 }
Karaku commented 14 hours ago

Hey! Is working!

After modifying the code, the option to map it via midi with the learning assistant via midi has been enabled. I still need to map the Main Knob and the FX "On" and "Mode" buttons, if someone would be so kind as to Explain to me if they have any correspondence, thanks again!

The other two options have these errors:

The mapping "Apple Mikey HID Driver " and "Traktor Kontrol Z1 F76A_3":

Uncaught exception: file:///Applications/Mixxx.app/Contents/Resources/controllers/Traktor-Kontrol-Z1-scripts.js:129: SyntaxError: Unexpected token `identifier' Backtrace: @file:///Applications/Mixxx.app/Contents/Resources/controllers/Traktor-Kontrol-Z1-scripts.js:129

JoergAtGithub commented 14 hours ago

The mapping that comes with Mixxx is a HID mapping, you must load it to the Traktor Z1 HID device, not to the MIDI device (which is just a software emulation).

Karaku commented 13 hours ago

Sorry, I'm quite new to these issues, I see that in the Controllers folder, in addition to the .js file, there is a hid.txt file and a hid.txt file, but line 119 does not exist there... :)

JoergAtGithub commented 13 hours ago

The file name on your system is: file:///Applications/Mixxx.app/Contents/Resources/controllers/Traktor-Kontrol-Z1-scripts.js

Karaku commented 13 hours ago

Yes, that is the file that I modified with line 119 and as a result it only let me map the controller manually...

JoergAtGithub commented 4 hours ago

Do you get any error message after the change? Can you share a Screenshot of your controller settings in the Preference dialog?