mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.52k stars 1.28k forks source link

cannot jump to hotcue and immediately start a loop #8093

Closed mixxxbot closed 2 years ago

mixxxbot commented 2 years ago

Reported by: Be-ing Date: 2015-06-10T21:32:48Z Status: Fix Released Importance: Low Launchpad Issue: lp1464003 Tags: cue, looping


I am trying to map buttons on my controller to jump to a hotcue and immediately start a loop from that hotcue. The relevant JavaScript code is:

engine.setValue(group, 'hotcue_'+cue+'_activate', 1) engine.setValue(group, ElectrixTweaker.loopType[group] + ElectrixTweaker.loopSize[group] + '_activate', 1)

However, Mixxx sets a loop at the position of the track when the button is pressed then jumps to the hotcue. Is the engine taking too long to jump to the hotcue?

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-06-23T06:36:26Z


I ran into the same problem and tried various different versions of the JS-code with a DDJ-SX2. I found out that if you put enough code between the "hotcue_#activate" and the "loop#_activate" it actually works. To me there are two (three) options:

Opinions?

mixxxbot commented 2 years ago

Commented by: daschuer Date: 2019-06-23T16:13:54Z


This is a kind of race condition, because the seek and the loop commands are precalculated in the controller thread with the same preconditions from the last engine call. The result is executed during the next engine call.

I think that can be fixed by considdering pending seeks when activating a beat loop.

The related code can be found here:

https://github.com/mixxxdj/mixxx/blob/4b3978e7fdb40b65e5e965833ca8eeaf31b5a0a8/src/engine/enginebuffer.cpp#L1128

https://github.com/mixxxdj/mixxx/blob/4b3978e7fdb40b65e5e965833ca8eeaf31b5a0a8/src/engine/controls/loopingcontrol.cpp#L960

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-06-24T08:23:44Z


I also found those two code locations to be the most promising ones to work with. Good to know I am looking at the right place. So far, I have a solution, that only fails (misbehaves) in a corner case but I am still figuring out how everything works together. I will soon commit it for discussion.

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-06-24T18:43:42Z


I found a solution (https://github.com/goddisignz/mixxx/tree/activate_cue_and_loop). I am interested in comments and/or testing. Is the usual way to go just to open a pull request and wait for feedback or let someone review it before?

mixxxbot commented 2 years ago

Commented by: Be-ing Date: 2019-06-24T19:58:00Z


Yes, please open a pull request.

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-06-24T20:28:12Z


Opened under https://github.com/mixxxdj/mixxx/pull/2190 .

mixxxbot commented 2 years ago

Commented by: daschuer Date: 2019-06-25T06:13:50Z


While your PR is a good step to improve scripting flexibility. I think you need actually https://bugs.launchpad.net/mixxx/+bug/1367159 instead. This way also skins can benefit from the feature. Do you have interest to work on this as well?

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-06-25T08:11:30Z


I didn't have the "store loop as cuepoint" feature in mind but it sounds interesting to me. My DDJSX2 also has a "stored loops" mode for the performance pads which are currently used for fixed size instant loops.

Long story short: I'm in. Should I assign my self to the other bug as well?

mixxxbot commented 2 years ago

Commented by: daschuer Date: 2019-06-25T13:51:05Z


Great, yes adopt the bug and get in contact with Ferran. I am sure he can give some hints.

mixxxbot commented 2 years ago

Commented by: Be-ing Date: 2019-06-26T13:49:09Z


I agree, properly implementing the storage of multiple loops would be better than a quick hack in a controller script. I'm not sure, but you might run into the same issue in the engine with a race condition between seeking to the loop and enabling it. So maybe that is worth solving.

mixxxbot commented 2 years ago

Commented by: goddisignz Date: 2019-07-22T04:48:17Z


Nee PR here: https://github.com/mixxxdj/mixxx/pull/2213

mixxxbot commented 2 years ago

Issue closed with status Fix Released.