-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update controller mappings for Behringer DDM4000 & BCR2000 to 2.5 #14232
Conversation
d449056
to
f937c93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing the code, that calls code marked as deprecated, is a good thing. But we must not remove the deprecated code for compatibility reasons.
Backward compatibility to existing mapping scripts (this includes non-official mappings by our users) must be guranteed. Therefore please restore the deleted code in common-controller-scripts.js and midi-components-0.0.js.
Thanks for looking into this PR so quickly. I agree that in general, removal of code without deprecation (warning) is a no-go because it could break existing code. But I think the situation is different here. The functions I remove here were introduced recently in 2.5. I'd appreciate if @Swiftb0y and @christophehenry could add their opinion on keeping or removing these two functions. They know about this topic from #14197. I will then change the code accordingly. |
f937c93
to
a1167c9
Compare
Ok, than it seems indeed to be a special case here.
deepMerge(objTarget, objSource); | ||
target.length = 0; | ||
target.push(...Object.values(objTarget)); | ||
} else if (isSimpleObject(target) && isSimpleObject(source)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the isSimpleObject
function above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Done.
@JoergAtGithub, I agree with the assessment made by @git-developer. |
Yes, if we just added it in 2.5.0 and it's not working as intended, then I think it's best to remove it immediately in 2.5.1. |
fe3cbdf
to
1199b77
Compare
I agree, it's just that this PR is currently targeted at |
* @see `GenericMidiController` on component container definition | ||
* @private | ||
*/ | ||
const mergeDefinitions = (targetObject, ...sources) => sources.reduce((target, source) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand… You need a deep merging algorithm after all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 1 of 4 uses of lodash's _.merge()
requires a deep merge, the other 3 uses are working with a shallow merge. The scope is within Behringer-Extension-scripts.js
only. It is used to merge mapping definitions of the user with defaults from the user and defaults from the mapping. Most mapping definitions simply contain data, but the ShiftButton
may also reference a JS object (the target that is shifted by the button). This may cause a circular reference in the mapping description that must be considered in the merge algorithm.
This is the only case I found requiring a deep merge. No commonly used location (like applyLayer()
) is affected anymore. Due to the limited scope, verifying the behavior was feasible.
d0b2c1a
to
83ed303
Compare
I removed lodash from the XML file. Now the build fails:
The mapping works in 2.5. Does the test setup require special handling when |
not really. I suspect its because of the change from |
I would advise that you keep your changes to the Behringer scripts in a separate PR so that this one is kept atomic. |
OK, I'll fix the tests and then split the PR. |
95f016d
to
e5d64f1
Compare
May I ask a related question to @christophehenry: I noticed that Registering MIDI Input Handlers From Javascript was implemented in #12781. Do you know an example where a The Behringer mappings heavily rely on ComponentsJS and contain hundred of lines of XML (DDM4000 / BCR2000) just to delegate to a single input dispatcher function. It would be great if this could be simplified using JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost LGTM. I assume you have done a smoke test with the DDM or BCR?
Not yet. I am working on a Denon DN-S3700 controller that will use it at some point. When I'm done, I'll propose for official inclusion. |
e5d64f1
to
bfcfa92
Compare
bfcfa92
to
051b0cd
Compare
Thanks for the reminder. I did, but not after that latest changes. All global objects require |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you raising the original issue and adressing it. Thank you also @christophehenry for being so responsive and brainstorming possible solutions as well. Thank you both.
This PR updates controller mappings for Behringer DDM4000 and BCR2000 to 2.5:
Removal of a quirk that was required before Qt6var
withconst
/let
Lodash's
_.merge()
function performing a deep merge has been replaced. Most locations could be refactored to use a shallow merge (Object.assign()
). The only actual requirement for a deep merge is inBehringer-Extension-scripts.js
(for component container definitions). It is replaced by a custom implementation.The code was tested against 2.5 using Behringer controllers DDM4000 and BCR2000.