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

Add [Main] to the list of valid groups for HID. #12102

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 21 additions & 55 deletions res/controllers/common-hid-packet-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1233,38 +1233,6 @@ class HIDController {
*/
this.deckSwitchMap = {1: 2, 2: 1, 3: 4, 4: 3, undefined: 1};

/**
* Standard target groups available in mixxx.
*
* This is used by HID packet parser to recognize group parameters we should try sending to mixxx.
* @type {string[]}
*/
this.valid_groups = [
"[Channel1]",
"[Channel2]",
"[Channel3]",
"[Channel4]",
"[Sampler1]",
"[Sampler2]",
"[Sampler3]",
"[Sampler4]",
"[Sampler5]",
"[Sampler6]",
"[Sampler7]",
"[Sampler8]",
"[Master]",
"[PreviewDeck1]",
"[Effects]",
"[Playlist]",
"[Flanger]",
"[Microphone]",
"[EffectRack1_EffectUnit1]",
"[EffectRack1_EffectUnit2]",
"[EffectRack1_EffectUnit3]",
"[EffectRack1_EffectUnit4]",
"[InternalClock]"
];

//
/**
* Set to value in ms to update Outputs periodically
Expand Down Expand Up @@ -1357,34 +1325,36 @@ class HIDController {
return `[Channel${deck}]`;
}
/**
* Map virtual deck names to real deck group. If group is already
* a real mixxx group value, just return it as it without mapping.
* @param {string} group Control group name e.g. "[Channel1]"
* Map virtual deck names ("deck, "deck1", "deck2") to real deck group. If group is already a
* real mixxx group value, just return it as it without mapping.
* @param {string} group Control group name e.g. "[Channel1]" or "deck" or "deck1".
* @returns {string} Channel
*/
resolveGroup(group) {
const channel_name = /\[Channel[0-9]+\]/;
if (group !== undefined && group.match(channel_name)) {
return group;
}
if (this.valid_groups.indexOf(group) !== -1) {
return group;
}
if (group === "deck" || group === undefined) {
if (this.activeDeck === undefined) {
return undefined;
}
return `[Channel${this.activeDeck}]`;
}
if (this.activeDeck === 1 || this.activeDeck === 2) {
if (group === "deck1") { return "[Channel1]"; }
if (group === "deck2") { return "[Channel2]"; }
}
if (this.activeDeck === 3 || this.activeDeck === 4) {
if (group === "deck1") { return "[Channel3]"; }
if (group === "deck2") { return "[Channel4]"; }
if (group === "deck1") {
if (this.activeDeck === 1 || this.activeDeck === 2) {
return "[Channel1]";
}
if (this.activeDeck === 3 || this.activeDeck === 4) {
return "[Channel3]";
}
return undefined;
} else if (group === "deck2") {
if (this.activeDeck === 1 || this.activeDeck === 2) {
return "[Channel2]";
}
if (this.activeDeck === 3 || this.activeDeck === 4) {
return "[Channel4]";
}
return undefined;
}
return undefined;
return group;
}
/**
* Find Output control matching give group and name
Expand Down Expand Up @@ -1746,11 +1716,7 @@ class HIDController {
return `[Channel${this.activeDeck}]`;
}
}
if (this.valid_groups.indexOf(group) !== -1) {
// console.log(`Resolving group ${group}`);
return this.resolveGroup(group);
}
return group;
return this.resolveGroup(group);
}
/**
* Get active control name from field
Expand Down