Denon MC7000: Handle autoloop button in script#4307
Conversation
|
Please rebase this on the 2.3 branch. |
|
@toszlanyi what do you think? |
8345ec1 to
4af3e95
Compare
sure! Just force pushed the branch. |
4af3e95 to
faaa21b
Compare
|
BTW: |
|
We usually squash-merge mapping changes anyways. |
faaa21b to
eadce46
Compare
eadce46 to
a3dc464
Compare
|
I don't understand the script linting... first it tells me to replace |
a3dc464 to
ee2a128
Compare
:/ please ignore that one. That's eslint being overzealous. The JavaScript interpreter in 2.3 doesn't support |
0d5b295 to
f593ac1
Compare
Ok, I see.. I'm sorry for the massive github action runs but I can't cancel them and the only chance for me was to see what the linter tells me on each iteration. |
I'm sorry, this is a temporary issue. We have upgraded the javascript environment in 2.4 and with that, new linter rules apply as well. So when you base a branch on main (so 2.4) the ES7 linter rules will get applied (suggesting to replace var with const). However, that makes the script incompatible with 2.3. So make sure you are basing your work on the correct branch. |
no problem, i was just confused ;-)
OK 👍 so then I'll try to make it work with 2.3. Besides of this I just wonder if the new behavior suits for most users or should I also introduce a boolean flag to keep the old behavior? |
I don't think thats necessary. But I'd like to hear @toszlanyi's opinion on this |
ok... yesterday I had a unexpected behavior with my current (local) script, I don't know if it was me or the implementation logic. Nevertheless I expect to make the final and manually tested PR on Friday, because I need it for a gig on Saturday 😄 |
| // Auto-Loop Button | ||
| MC7000.autoLoop = function(channel, control, value, status, group) { | ||
| if (engine.getValue(group, "loop_enabled")) { | ||
| script.toggleControl(group, "reloop_toggle"); | ||
| } else { | ||
| script.toggleControl(group, "beatloop_activate"); | ||
| } | ||
| }; | ||
|
|
There was a problem hiding this comment.
Looks reasonable to me. Just wanna check what happens if a loop is set but inactive. Does it trigger a new loop at play position or reloop the existing one... Can do that by Thursday
There was a problem hiding this comment.
I like that little improvement but the first push on Autoloop button activates and deactivates the loop immediately so you have to push a 2nd time. Once a loop is set then it works as expected.
as all var were replaced with let then the script doesnt work in Mixxx 2.3 any longer. I have therefore quickly changed my one and could push this to #4021 if you like. Or we let this one still move.
There was a problem hiding this comment.
I couldn't get beatloop_activate to work properly if there was no loop set in the track yet. Anyhow beatloop_4_activate works to set a new loop and activate it. Is this a bug or what else do we miss here?
There was a problem hiding this comment.
I found another issue ... Assumed there was a loop inside the track and I reloop it with Shift and Autoloop, go out the loop by pressing Autoloop then the loop position sometimes move to the current play position and activates. This is quite unpredictable - it doesn't happen always but now and then. Expecting the loop to stay where it was but not toggled on to current play position as I did only wanted to exit the Reloop.
There was a problem hiding this comment.
I am using a much more complex logic for this purpose:
Don't ask me why I came up with this, I don't remember.
We need a domain specific API to unify this behavior for multiple controllers. Manipulating individual control values is too low level. Needing to write a custom function hasLoop() function only to determine if a valid loop range is defined clearly indicates this conceptual gap.
There was a problem hiding this comment.
hm...it still does not what I'd expect.
I think I have to read the API docs more accurate to understand the difference behaviors between
loop_*, reloop_* and beatloop_*
There was a problem hiding this comment.
So what would be the workflow that you expect?
There was a problem hiding this comment.
The method script.toggleControl does not work for me.
At least the last commit (c43ac92) is working at least for 90% of my usecases:
Create and activate a beatloop or disable a loop.
There was a problem hiding this comment.
That commit seems to have some significant flaws in it (see eslint output). Also make sure you are using the correct Control Objects...
There was a problem hiding this comment.
script.toggleControl(group, "reloop_toggle", 100);
The third parameter (
100) doesn't do anything.
Mmhhhh interesting - got this line from the Mixxx Controls page inside the manual. See last example in that linked chapter.
f593ac1 to
c43ac92
Compare
c43ac92 to
d7bd32d
Compare
d7bd32d to
990f3f5
Compare
| engine.setValue(group, "loop_enabled", false); | ||
| engine.setValue(group, "reloop_toggle", true); | ||
| } else { | ||
| engine.setValue(group, "beatloop_activate", true); |
There was a problem hiding this comment.
This invocation sequence requires a comment, i.e. why you need a negative edge trigger. Does this even work as intended?
There was a problem hiding this comment.
This comment is imprecise and wrong. script.toggleControl() works as expected and inverts a boolean value, i.e. 0/false -> 1/true or 1/true -> 0/false. Setting beatloop_activate to true and then to false is a completely different use case.
How about setting beatloop_activate to true on button down and to false otherwise (button up or when entering the other if arm on button down)?
I am using this pattern a lot in the MC6000MK2 script to avoid getting stuck in inconsistent states, e.g. when a button is pressed shifted and released unshifted or the other way round. All control values that might be affected by a button and all invocation sequences must be considered.
990f3f5 to
867f9b2
Compare
| engine.setValue(group, "loop_enabled", false); | ||
| engine.setValue(group, "reloop_toggle", true); | ||
| } else { | ||
| engine.setValue(group, "beatloop_activate", true); |
There was a problem hiding this comment.
This comment is imprecise and wrong. script.toggleControl() works as expected and inverts a boolean value, i.e. 0/false -> 1/true or 1/true -> 0/false. Setting beatloop_activate to true and then to false is a completely different use case.
How about setting beatloop_activate to true on button down and to false otherwise (button up or when entering the other if arm on button down)?
I am using this pattern a lot in the MC6000MK2 script to avoid getting stuck in inconsistent states, e.g. when a button is pressed shifted and released unshifted or the other way round. All control values that might be affected by a button and all invocation sequences must be considered.
| } | ||
| } else if (MC7000.PADModeCueLoop[deckNumber]) { | ||
| return; | ||
| // TODO |
There was a problem hiding this comment.
Please revert these unrelated changes.
|
Suggest to close this PR as the desired function was implemented globally with #4328 |
|
This PR is marked as stale because it has been open 90 days with no activity. |
|
I use CDJs now, so this PR is no longer relevant to me 😜 |
I was confused by the Auto-Loop button because I can't toggle the state like expected, so I solved the issue by copying the implementation of
Pioneer-DDJ-SX-scripts.js.