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

ControllerEngine Refactoring #3463

Merged
merged 79 commits into from
Dec 20, 2020

Conversation

Holzhaus
Copy link
Member

Continuation of #2920 (great work by @Be-ing!) with merge conflicts resolved.

It also adds the comment to make @daschuer happy and moves the C++ style wrapping into the ControllerScriptEngineLegacy class. For the new API, we should just hand out the dataview and do the cast to Uint8Arry in actual JavaScript if necessary, not in an JavaScript-wrapped-in-C++-and-called-by-JavaScript abomination.

Be-ing added 30 commits July 12, 2020 15:18
* Move src/controllers/engine to src/controllers/scripting
* Create src/controllers/scripting/legacy subfolder
* Rename ControllerEngine to ControllerScriptHandler
* Rename ControllerEngineJSProxy to ControllerScriptInterface
This allows for a clean separation between new and legacy code.
This avoids calling two separate JS functions (one to convert the
ArrayBuffer to a Uint8Array then the callback) every time controller
input is received.
ArrayBuffer is more useful for HID and perhaps other use cases. For
backwards compatibility, continue to convert the ArrayBuffer to a
Uint8Array in ControllerScriptEngineLegacy

following discussion on
https://github.com/mixxxdj/mixxx/pull/2920/files/9363b497e13e39191655441a32b458f0af1727d8..e25bf12ab4bd910745d4359a9b3520b8c7f673c9#diff-69d807d0e5894e9f5bf1bd447ca878ab
Be-ing and others added 16 commits October 30, 2020 14:03
This will be reimplemented differently in the future.
m_pJSEngine is never passed to other threads
With the new engine, this should be implement in JavaScript code, e.g.
inside the MIDI dispatcher class or something like that.
@Holzhaus Holzhaus added this to the 2.4.0 milestone Dec 17, 2020
@Holzhaus Holzhaus added this to In progress in 2.4 release via automation Dec 17, 2020
@github-actions github-actions bot added the build label Dec 17, 2020
Copy link
Member

@daschuer daschuer 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 for reviving this branch. I have left some comments.

s_testing = true;
}

static ControlFlags shouldAssertForInvalidControlObjects() {
Copy link
Member

Choose a reason for hiding this comment

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

The function name is a question that can be answered with true or false but not with individual flags.
I would prefer to make this bool, because the flags are an implementation detail of code out of sight.
Alternative we need a new name.


static ControlFlags shouldAssertForInvalidControlObjects() {
if (s_enabled && !s_testing) {
return ControlFlag::None;
Copy link
Member

Choose a reason for hiding this comment

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

None means assert all assumptions. What is the reasoning that we don't want that during tests? Is this correct:

s_testing = true s_testing = false
s_enabled = true ignore assert
s_enabled = false ignore ignore

Please add a comment why.
Thank you.

Copy link
Member

Choose a reason for hiding this comment

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

We may also consider to rename ControlFlag::None to
ControlFlag::AssertAll; Or AssertExeptions:None or such.

Copy link
Member Author

Choose a reason for hiding this comment

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

Please add a comment why.

This was done because some tests are expected to fail. I just pushed the new commits that disable controller testing for these tests.

@daschuer
Copy link
Member

Thank you LGTM.

@daschuer daschuer merged commit 7b00e93 into mixxxdj:main Dec 20, 2020
2.4 release automation moved this from In progress to Done Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
2.4 release
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants