Skip to content

allow for overlapping beatlooprolls#1812

Merged
daschuer merged 3 commits into
mixxxdj:masterfrom
iamcodemaker:looproll
Sep 25, 2018
Merged

allow for overlapping beatlooprolls#1812
daschuer merged 3 commits into
mixxxdj:masterfrom
iamcodemaker:looproll

Conversation

@iamcodemaker
Copy link
Copy Markdown
Contributor

This is necessary if multiple beatlooproll keys are pressed on a controller. Previously, Mixxx would stop the loop roll if any keys were released. Now it tracks all active rolls and will activate the last active one that is still active (button still down) instead of deactivating all rolls. Additionally, if a loop roll is active, activating another beat loop roll will start the loop from the start of the current loop, instead the current play position.

I believe this loop roll behavior is more intuitive and natural.

This is necessary if multiple beatlooproll keys are pressed on a
controller. Previously, Mixxx would stop the loop roll if any keys were
released. Now it tracks all active rolls and will activate the last
active one that is still active (button still down) instead of
deactivating all rolls. Additionally, if a loop roll is active,
activating another beat loop roll will start the loop from the start of
the current loop, instead the current play position.
@daschuer
Copy link
Copy Markdown
Member

Thank you for the Pull request.
Do we have a Launchpad bug for it?

Copy link
Copy Markdown
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.

Works good, I have only some minor comments.
Thank you.

Comment thread src/engine/loopingcontrol.cpp Outdated
slotBeatLoop(pBeatLoopControl->getSize(), false, true);
slotBeatLoop(pBeatLoopControl->getSize(), m_bLoopRollActive, true);
m_bLoopRollActive = true;
m_activeLoopRolls.push(pBeatLoopControl);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

taking a plain pointer in slotBeatLoopActivateRoll() promises not to store it. This rule is violated here.
Can we just store the size instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. I'll make that change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we store doubles in here, are we going to have any issues comparing them using ==? I don't understand floats well enough to say. The values should be exact though, so my gut says this is fine.

Comment thread src/engine/loopingcontrol.cpp Outdated
Q_UNUSED(pBeatLoopControl);
setLoopingEnabled(false);
pBeatLoopControl->deactivate();
m_activeLoopRolls.removeAll(pBeatLoopControl);
Copy link
Copy Markdown
Member

@daschuer daschuer Sep 19, 2018

Choose a reason for hiding this comment

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

RemoveAll is not available in QT 5.2
Can you use this instead?

    int i; 
    while (0 <= (i = m_activeLoopRolls.indexOf(pBeatLoopControl))) {
        m_activeLoopRolls.remove(i);
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will update. In theory there should only be one of each beat loop in here max. Actually thinking about it, if a controller had two ways to activate a loop roll we might end up with duplicates. So looping here is necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made the removal loop O(n) (though the stack will always be so small it won't matter). It is slightly more complex now though.

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Sep 19, 2018

Ooouh, sounds interesting!! I got used to the way it works right now, but your idea makes sense. Didn't test this yet.

Is this the right place to ask for taking a look at lp:1721881 beatloop shouldn't alter beatloop size in spinbox ?

Also, just yesterday I wished I could transfrom a rolling beatlopp into a 'regular' one, to resize it and move it. I got stucked when thinking about the controller implementation...

Edit there's also #1428 that stalled somehow

@rryan
Copy link
Copy Markdown
Member

rryan commented Sep 19, 2018

Thanks! To make sure we dont break this in the future could you please add some unit tests?
src/test/looping_control_test.cpp

@iamcodemaker
Copy link
Copy Markdown
Contributor Author

Not sure if there is a launchpad bug for it, I didn't check. I'll work on some tests.

Tests validate the following:

- beatlooproll activation and deactivation work
- overlapping beatlooprolls remain active until the last roll is
  released
- overlapping beatlooprolls are properly activated as they stack and
  unwind
- new beatlooprolls start at the play position
- beatlooprolls activated while existing beatloops are in progress
  preserve the start point
@daschuer
Copy link
Copy Markdown
Member

@rons0 transforming a loop, in a way that you can release you finger and the loop keeps looping?
Thats a valid use case. Can you file a bug that we can consider details there?

@daschuer
Copy link
Copy Markdown
Member

I have just filed a bug.
https://bugs.launchpad.net/bugs/1793454
Please assigne it to yourself.

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Sep 20, 2018

@daschuer
Copy link
Copy Markdown
Member

The Travis failure is unrelated.
LGTM Thank you very much.

@daschuer daschuer merged commit 972001e into mixxxdj:master Sep 25, 2018
@iamcodemaker iamcodemaker deleted the looproll branch November 30, 2018 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants