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

DDJ-200 support for 4 decks #3193

Merged
merged 30 commits into from
Nov 1, 2020
Merged

DDJ-200 support for 4 decks #3193

merged 30 commits into from
Nov 1, 2020

Conversation

fkbreitl
Copy link
Contributor

No description provided.

@Holzhaus
Copy link
Member

Does this PR change anything from the user's perspective? If so, please document that with a PR to the manual repo.

@fkbreitl
Copy link
Contributor Author

fkbreitl commented Oct 20, 2020 via email

@Holzhaus
Copy link
Member

Holzhaus commented Oct 20, 2020

In the meantime the files could already be updated.

Without the documentation, we can't review this properly. Also, I think the policy should be to only merge changes if the documentation is ready, too. Otherwise contributors might get busy or lose interest after the merge and we end up with even undocumented or not properly documented controller mappings in the mixxx repo :D

@fkbreitl
Copy link
Contributor Author

Ok, I have updated the documentation (the PR is still open) and fixed all issues from CodeFactor.
Code should be ready for review.

@Holzhaus
Copy link
Member

I have updated the documentation (the PR is still open)

Can you post a link? I don't see the PR.

@fkbreitl
Copy link
Contributor Author

Sorry, it always goes to your repo. Here is the correct one: mixxxdj/manual#237

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.

Thank you. Some first comments.

Comment on lines 29 to 30
engine.beginTimer(500, "engine.setValue(\"[Library]\", " +
"\"MoveFocus\", 1);", true);
Copy link
Member

Choose a reason for hiding this comment

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

Please don't use a string here, pass a function expression.

Comment on lines 14 to 15
1: this.vDeck1, 2: _.clone(this.vDeck1),
3: _.clone(this.vDeck1), 4: _.clone(this.vDeck1)
Copy link
Member

Choose a reason for hiding this comment

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

I'm really not a fan of lodash. This is very unreadable IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What alternative do you suggest?

Copy link
Member

Choose a reason for hiding this comment

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

Something like this maybe?

this.vDeck = {}
for (var i = 1; i <= 4; i++) {
    this.vDeck[i] = {
        syncEnabled: false,
        volMSB: 0,
        rateMSB: 0,
        jogDisabled: false,
    }
}

for (var i = 1; i <= 4; i++) {
var vgroup = "[Channel" + i + "]";
// run onTrackLoad after every track load to e.g. set LEDs accordingly
engine.connectControl(vgroup, "track_loaded", "DDJ200.onTrackLoad");
Copy link
Member

Choose a reason for hiding this comment

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

Please use engine.makeConnection instead and don't use a string, pass the actual function.

var deckNo = script.deckFromGroup(group);
var vDeckNo = DDJ200.vDeckNo[deckNo];
var vgroup = "[Channel" + vDeckNo +"]";
engine.setValue(vgroup, "LoadSelectedTrack", true);
Copy link
Member

Choose a reason for hiding this comment

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

Use script.triggerControl here.

Comment on lines 120 to 121
engine.beginTimer(900, "DDJ200.vDeck[" + vDeckNo +
"][\"jogDisabled\"] = false;", true);
Copy link
Member

Choose a reason for hiding this comment

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

use a function expression

if (deckNo === 1) {
// toggle virtual deck of controller deck 1
DDJ200.vDeckNo[1] = 4 - DDJ200.vDeckNo[1];
if (DDJ200.vDeckNo[1] === 1) LED = 0;
Copy link
Member

Choose a reason for hiding this comment

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

missing braces

} else { // deckNo === 2
// toggle virtual deck of controller deck 2
DDJ200.vDeckNo[2] = 6 - DDJ200.vDeckNo[2];
if (DDJ200.vDeckNo[2] === 2) LED = 0;
Copy link
Member

Choose a reason for hiding this comment

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

missing braces

0x7F * engine.getValue(vgroup, "pfl"));
}

if (vDeckNo % 2) c = 7; else c = 9;
Copy link
Member

Choose a reason for hiding this comment

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

missing braces

Comment on lines 14 to 15
1: this.vDeck1, 2: _.clone(this.vDeck1),
3: _.clone(this.vDeck1), 4: _.clone(this.vDeck1)
Copy link
Member

Choose a reason for hiding this comment

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

Something like this maybe?

this.vDeck = {}
for (var i = 1; i <= 4; i++) {
    this.vDeck[i] = {
        syncEnabled: false,
        volMSB: 0,
        rateMSB: 0,
        jogDisabled: false,
    }
}

var vgroup = "[Channel" + vDeckNo +"]";
var pfl = ! engine.getValue(vgroup, "pfl");
engine.setValue(vgroup, "pfl", pfl);
if (DDJ200.fourDeckMode === false) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (DDJ200.fourDeckMode === false) {
if (!DDJ200.fourDeckMode) {


DDJ200.switchLEDs = function(vDeckNo) {
// set LEDs of controller deck according to virtual deck
var c = 1; if (vDeckNo % 2) c = 0;
Copy link
Member

Choose a reason for hiding this comment

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

missing braces and multiple statements on the same line. Also, please use more meaningful variable names, e.g.: channelOffset or something like that.

Copy link
Contributor Author

@fkbreitl fkbreitl left a comment

Choose a reason for hiding this comment

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

I have don't the changes you requested

res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
fkbreitl and others added 11 commits October 23, 2020 19:49
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
@fkbreitl
Copy link
Contributor Author

I guess I have to pull the changes from my git repo first and then copy and past the patch in the file (since I don't see a save option).

@fkbreitl
Copy link
Contributor Author

Unfortunately after the above:
error: corrupt patch at line 6

@Holzhaus
Copy link
Member

Are you sure you're in the correct branch?

@Holzhaus
Copy link
Member

Maybe it's a copy and paste issue. Here's a file you can download and use for git apply: patch.txt

@fkbreitl
Copy link
Contributor Author

Maybe. Thank you.
I have now corrected my flymake indentation for Javascript and indented the whole buffer instead of applying your patch, which should have done the same thing.
And I fixed all remaining +"]".

@fkbreitl
Copy link
Contributor Author

I am also wondering what is the best way to keep my github repo up to date?
Should I pull the updates from mixxx to my laptop and then push them to my github repo or can I update github first and then pull it to my laptop, which would avoid the uploading part?

@Holzhaus
Copy link
Member

Why would you need to keep your GitHub repo up-to-date? I just have configured an upstream remote:

$ git remote add upstream https://github.com/mixxxdj/mixxx.git

When you start a new branch, just fetch the latest changes from the remote and start a new branch from there:

$ git fetch upstream
$ git checkout -b mynewbranch upstream/2.3

You only need to push your branch, there's no reason to update other branches:

$ git push origin mynewbranch

@fkbreitl
Copy link
Contributor Author

Aright. Thanks!

@Holzhaus
Copy link
Member

Unfortunately the indentation doesn't conform to our style rules yet, here's another patch:
patch.txt

@fkbreitl
Copy link
Contributor Author

Oh no, what are your style rules called? Is it not Javascript?

@fkbreitl
Copy link
Contributor Author

How did you detect these issues? My pre-commit hook did not complain.

@Holzhaus
Copy link
Member

How did you detect these issues? My pre-commit hook did not complain.

This branch is based on 2.2, but the pre-commit hooks only exist on 2.3 and onwards. I just merged this branch into 2.3 locally and ran the pre-commit hooks there, and used git diff to generate the patch.

@fkbreitl
Copy link
Contributor Author

Should I write a bug report that the Mixxx style rules do not comply with JS conventions?

@Holzhaus
Copy link
Member

Should I write a bug report that the Mixxx style rules do not comply with JS conventions?

What do you mean? Because we don't use hanging indents?

@fkbreitl
Copy link
Contributor Author

Yes, I thought it was a rule, but apparently its not...

res/controllers/Pioneer DDJ-200.midi.xml Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
fkbreitl and others added 6 commits October 29, 2020 15:51
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
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.

Just a minor comment, otherwise LGTM.

res/controllers/Pioneer-DDJ-200-scripts.js Outdated Show resolved Hide resolved
Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
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.

Thank you, LGTM.

@Holzhaus Holzhaus merged commit 81f5e67 into mixxxdj:2.2 Nov 1, 2020
@fkbreitl
Copy link
Contributor Author

fkbreitl commented Nov 1, 2020

Thank you!

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.

2 participants