Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native Instruments Traktor Kontrol S2 MK3 mapping #2348

Merged
merged 26 commits into from
Dec 13, 2019

Conversation

mi01
Copy link
Contributor

@mi01 mi01 commented Nov 4, 2019

Hello,
i created a USB-HID controller mapping for the Native Instruments Traktor Kontrol S2 MK3. I think its complete now, so i would like to contribute it officially here. There is a wiki page and a thread in the forums also with additional infos. I'm looking forward to get some feedback.

Copy link
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor issues, otherwise looks good to me.

res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
@Holzhaus
Copy link
Member

Holzhaus commented Nov 9, 2019

@Be-ing ping

@Be-ing
Copy link
Contributor

Be-ing commented Nov 12, 2019

Thank you for helping out with the code review @Holzhaus. Reviewing the code is helpful, however my bigger concern with controller mappings is whether the UX design makes sense and works with how Mixxx is designed. This is why it is essential for a wiki page to be written before review. The contents of the wiki page can be compared with the code to verify that the code does what it is supposed to do (as much as can be done without the reviewer having the hardware). Also, the wiki page can be edited for language clarity/organization/style.

This takes some work and so far I have been the only one doing this. I am overwhelmed keeping up with mappings and trying to make releases happen. If you could help review mappings for UX design, that would be really helpful!

// Reset sync button timer if active
if (TraktorS2MK3.syncPressedTimer[group] !== 0) {
engine.stopTimer(TraktorS2MK3.syncPressedTimer[group]);
TraktorS2MK3.syncPressedTimer[group] = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're resetting the timer, but you're not changing any control object. According to your wiki entry, the mapping is supposed to toggle sync_master.

Copy link
Contributor Author

@mi01 mi01 Dec 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written in https://www.mixxx.org/wiki/doku.php/mixxxcontrols#channeln under sync_enabled Mixxx distinguishes between pressing the SYNC button for a long period (< 1 sec) and a short press. I just imitate this behavior in my script, since Mixxx is not checking the duration when setting the control from a controller script. This is also mentioned in the Wiki page, but i made it more clear there now.

The timer is started when the button is pressed. When it is released the syncHandler() function is checking, if the timer is still running. If this is true, i reset the sync control key. Otherwise i do nothing, so SYNC lock is enabled.

But you pointed to the right spot, there was some unnecessary code in syncHandler(), because stopping the timer when it is already expired is useless. I fixed this in mi01@0ac8408


TraktorS2MK3.syncHandler = function (field) {
if (TraktorS2MK3.shiftPressed[field.group]) {
engine.setValue(field.group, "beatsync_phase", field.value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but the shift behaviour is not really documented. In the wiki entry, it sounds like this depends on quantize, not the shift state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot this in the Wiki page, updated it now.

res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
@Be-ing
Copy link
Contributor

Be-ing commented Dec 9, 2019

It looks like the intro to the wiki page was copied and pasted:

The Kontrol S2 MK3 is a two-channel controller with an integrated sound card. It has two integrated stereo outputs (line and 1/8“ / 3.5 mm TRS), headphone outputs (1/8” / 3.5 mm TRS) and microphone inputs (1/4“ / 6.3 mm TRS). The MK2 uses the standard HID protocol to send and receive signals from a computer, so it can work with Mixxx. The Kontrol S2 MK3 can run from USB bus power. Using the separate power supply increases the brightness of the LEDs, which is helpful for using it in daylight, and increases the volume of the headphone output.

Can you verify that this is all correct? Does this controller have a power supply separate from the USB power?

@Be-ing
Copy link
Contributor

Be-ing commented Dec 9, 2019

I read through the wiki page and made some edits for clarity. Everything seems to be mapped in a sensible way with two small exceptions.

You could map the sampler gain knob to control the gain knobs of all the samplers together. This is an ugly hack but it's the best we can do for now. In the future I want to implement a sampler output bus that would have its own gain knob.

The way you have mapped the FX buttons in the middle of the mixer isn't all that useful without any other effects controls available on the controller. However, I don't know what else to suggest to do with them for now. Do you have any other ideas? With #1705 one of my goals is to implement something like Traktor's Mixer FX but even more powerful so you could save custom effect chains and assign them to the QuickEffect knobs. But don't count on that feature getting implemented soon.

@mi01
Copy link
Contributor Author

mi01 commented Dec 9, 2019

It looks like the intro to the wiki page was copied and pasted:

The Kontrol S2 MK3 is a two-channel controller with an integrated sound card. It has two integrated stereo outputs (line and 1/8“ / 3.5 mm TRS), headphone outputs (1/8” / 3.5 mm TRS) and microphone inputs (1/4“ / 6.3 mm TRS). The MK2 uses the standard HID protocol to send and receive signals from a computer, so it can work with Mixxx. The Kontrol S2 MK3 can run from USB bus power. Using the separate power supply increases the brightness of the LEDs, which is helpful for using it in daylight, and increases the volume of the headphone output.

Can you verify that this is all correct? Does this controller have a power supply separate from the USB power?

Indeed i copy and pasted this part of the wiki page from the predecessors page, but its correct, there is an optional power supply (15V/1.2A). But i fixed the typo now, mentioning the MK2 instead of MK3 there. You can have a look at the manual, if you like: https://www.native-instruments.com/fileadmin/ni_media/downloads/manuals/traktor/TRAKTOR_KONTROL_S2_MK3_Manual_English_1218.pdf

I read through the wiki page and made some edits for clarity. Everything seems to be mapped in a sensible way with two small exceptions.

You could map the sampler gain knob to control the gain knobs of all the samplers together. This is an ugly hack but it's the best we can do for now. In the future I want to implement a sampler output bus that would have its own gain knob.

Yes, this seems to be the only way to give this knob a meaningful function. Added this in a7e475b and updated the wiki page.

The way you have mapped the FX buttons in the middle of the mixer isn't all that useful without any other effects controls available on the controller. However, I don't know what else to suggest to do with them for now. Do you have any other ideas? With #1705 one of my goals is to implement something like Traktor's Mixer FX but even more powerful so you could save custom effect chains and assign them to the QuickEffect knobs. But don't count on that feature getting implemented soon.

I dont have any other idea regarding this buttons, but assigning effect units to the decks seems not completely useless to me. However it would be great to have a improved effect system in the future and i promise to update the mapping in this case.

res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js Outdated Show resolved Hide resolved
@Be-ing Be-ing changed the base branch from master to 2.2 December 13, 2019 21:43
@Be-ing
Copy link
Contributor

Be-ing commented Dec 13, 2019

Please rebase this on the 2.2 branch so we can include it in the next minor release of Mixxx (2.2.4). git rebase -i mixxxdj/master (assuming you have named the remote for the upstream repo "mixxxdj") and select only your commits.

@Be-ing
Copy link
Contributor

Be-ing commented Dec 13, 2019

Great work. I am glad we have a mapping for this controller soon after its release. Just rebase this on the 2.2 branch and then it will be ready to merge.

@mi01 mi01 force-pushed the TraktorKontrolS2MK3-Mapping branch from 13e7ef4 to 14e4a1b Compare December 13, 2019 23:04
@Be-ing
Copy link
Contributor

Be-ing commented Dec 13, 2019

There are still many unrelated commits from the master branch in this. Do an interactive rebase with git rebase -i mixxxdj/2.2 to remove all the commits except the ones for your mapping.

@mi01 mi01 force-pushed the TraktorKontrolS2MK3-Mapping branch from 14e4a1b to 1698b25 Compare December 13, 2019 23:28
@Be-ing Be-ing merged commit 20cc4fe into mixxxdj:2.2 Dec 13, 2019
@mi01
Copy link
Contributor Author

mi01 commented Dec 13, 2019

Sorry, accidentally just copied your command from above and rebased to the head of the master branch before. Hope this works now. Thank you for your great feedback and support!

@Be-ing
Copy link
Contributor

Be-ing commented Dec 13, 2019

Thanks for your contribution and patience with the review.

@Be-ing
Copy link
Contributor

Be-ing commented Dec 13, 2019

I moved this controller into the Community Supported Mappings list on the wiki

@Holzhaus Holzhaus added this to the 2.2.4 milestone Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants