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

fix beatsync_phase depending on quantize #1679

Merged
merged 8 commits into from
Jun 10, 2018
Merged

Conversation

daschuer
Copy link
Member

@daschuer daschuer changed the base branch from 1.12 to 2.1 May 22, 2018 00:42
@daschuer
Copy link
Member Author

This should also go to 2.1.1.
Who likes to review?

@daschuer daschuer added this to the 2.1.1 milestone May 24, 2018
@daschuer
Copy link
Member Author

I really like to have this included in 2.1.1 who can have a look?

@Be-ing
Copy link
Contributor

Be-ing commented May 27, 2018

This seems okay from brief testing, but I am wary to introduce such a big UX change in a point release. Are you sure this won't be unwanted in some use cases?

@daschuer
Copy link
Member Author

Thank you for review.
I am pretty sure, because currently the right click in Shade and Deere does the same as the left click.
After this change, you sync also the phase with the right click, so it is an additional, recently requested feature, for the else redundant right click.
If you have a different opinion here, I can revert the skin changes and propose them for 2.2.
What do you think?

@Be-ing
Copy link
Contributor

Be-ing commented May 29, 2018

This changes the behavior of sync_enabled as well as beatsync. (On my controller I do not have beatsync mapped, only sync_enabled.)

@rryan
Copy link
Member

rryan commented May 29, 2018

No tests?

@daschuer
Copy link
Member Author

daschuer commented May 29, 2018

MM, that's odd, reading this code

// Users also expect phase to be aligned when they press the sync button.

It was original implemented that sync_enable also syncs phase.
But I think that was wrong and we have evidentially fixed the "issue"?

How continue here?

  • In 2.1 right and left click do not sync phase
  • Original left click syncs phase, right click not
  • Ieft click not syncing phase works natural for me. I do not want to have a shift if with quantize off.
  • beatsync should really sync phase and BPM as documented.

I propose to keep the "buggy" behavior of sync_enable, but keep all other changes of this branch targeting it to 2.1.

Any other ideas?

@ywwg
Copy link
Member

ywwg commented May 30, 2018

No tests?

agree, the sync code is very brittle and has benefited tremendously from the exhaustive unit tests to keep it from regressing. It sounds like there should at least be a test that confirms that phase is not synced when sync is pressed.

@ywwg
Copy link
Member

ywwg commented May 30, 2018

But I think that was wrong

I believe on other programs, pushing sync would sync both bpm and phase, especially when both decks were playing. I replicated that behavior when writing this code. It's worth checking to see what happens when the decks are not synced, and are both playing, and then you click sync.

@daschuer
Copy link
Member Author

The linked text was introduced here: #133
I have touched and probably brake something here: #738
So the current 2.1.0 behaviour was like this since 2.0 without much complains.

From the comments in #133 it looks like coupling the phase sync with quantize is desired.

For me this makes fully sense that this is coupled to quantize. This way the user can enable quantize when there is a good beatgrid and can disable it otherwise. If you enable quantize during sync enabled, the track moves slowly in phase. This matches the initial behaviour as well.

So IMHO the only thing to fix (change) here, is "beatsync" and "beatsync_phase"
It should match the docs on the wiki page.

Do you agree?

And yes, that should be verified by a test.

@daschuer
Copy link
Member Author

OK, now the sync_enabled behaviour is unchanged, beatsync_phase works independently from quantize and a test for both is in place. Is this OK now?

Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

my only real question is about the use of EXPECT_LT in the tests, otherwise this looks fine. thanks!

@@ -1429,3 +1429,52 @@ TEST_F(EngineSyncTest, ZeroBpmNaturalRate) {
EXPECT_EQ(0.0,
ControlObject::getControl(ConfigKey(m_sGroup1, "local_bpm"))->get());
}

TEST_F(EngineSyncTest, SyncPhaseToIfQuantize) {
Copy link
Member

Choose a reason for hiding this comment

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

how about "QuantizeImpliesSyncPhase" (in your wording, it should be "too")

Copy link
Contributor

Choose a reason for hiding this comment

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

ping

pButtonSyncEnabled1->set(1.0);
ProcessBuffer();
// 0.02 where set after testing both cases.
EXPECT_LT(0.02, ControlObject::getControl(ConfigKey(m_sGroup1, "beat_distance"))->get());
Copy link
Member

Choose a reason for hiding this comment

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

expect less-than? Should this be expect_float_eq or similar instead?

selection-color: #0f0f0f;
background-color: #0f0f0f;
selection-background-color: #888;
/* This combination of negative top/bottom padding & margin
Copy link
Member

Choose a reason for hiding this comment

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

I think your branch is behind a bit, causing these library CSS diffs

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

So IMHO the only thing to fix (change) here, is "beatsync" and "beatsync_phase"

This would still change the behavior of the SyncButton in Components.

@daschuer
Copy link
Member Author

daschuer commented May 31, 2018

Should bratsync also respect quatize? If we do so, we have the same as sync_enable. So it would be redundant. I see a demand for an bratsync button, that works like in other Apps and unconditionally syncs tempo and phase.

I do not understand why we need a hack in Components at all. You should be able to just map sync_enable, to get the desired behaviour.

@ywwg
Copy link
Member

ywwg commented May 31, 2018

My recollection is that "beatsync" was kept around for backwards-compatibility purposes. A short-press of sync_enable is indeed identical.

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

A short-press of sync_enable is indeed identical.

Not when set through a controller script.

@daschuer
Copy link
Member Author

@Be-ing can you explain why we need a hack in Components? Why can't you use plain sync_enable, to get the desired behaviour?

Do I understand it right, you wish that we keep bratsync quantize dependent?
If yes, we might need a unconditional alternative in 2.2 as requested, to make Mixxx behave like other tools. I am happy without it though. "Beatsync_tempo_phase" ?

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

@Be-ing can you explain why we need a hack in Components?

The push-and-hold behavior for sync_enabled was implemented as a hack that only affects XML mappings and skins, not controller scripts.

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

The push-and-hold behavior for sync_enabled was implemented as a hack that only affects XML mappings and skins, not controller scripts.

IMO this should not be changed because there should be a way to immediately activate master sync without having to push and hold a button.

@ywwg
Copy link
Member

ywwg commented May 31, 2018

what's wrong with push and hold?

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

It's easy to forget to hold, which can easily mess up a mix.

@ywwg
Copy link
Member

ywwg commented May 31, 2018

has this happened or are you speculating? on my controller sync is a lighted button, so when I push and hold it it stays lit. It's easy to tell when master sync is on or off based on the lighted state of the button, so there's nothing to forget.

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

Yes that happened to me when I had my controller mapped with push-and-hold, so I didn't keep it mapped that way very long and switched back to a simple toggle button. Seeing the master sync state on the controller doesn't solve the problem of having to hold down a button and manipulate other controls for a mix within a short span of time.

@ywwg
Copy link
Member

ywwg commented May 31, 2018

I'm a little unclear of the use-case you describe. When I use master sync I turn it on at the beginning of my set and it stays on the whole time. Or if I'm turning it on it's during the previewing stage where I'm not in a rush. What were you doing that you needed to turn it on quickly while you were doing other things?

@Be-ing
Copy link
Contributor

Be-ing commented May 31, 2018

I only use sync occasionally, so I have it off most of the time.

@ywwg
Copy link
Member

ywwg commented May 31, 2018

is push-and-hold an operation on the buttons, or on the control object? Maybe it should be up to the controller configuration to decide how that works.

@daschuer
Copy link
Member Author

daschuer commented May 31, 2018

It is an option of the ControlObject. I see, you cannot give a button release command from Controller scripts.

Ok so i will restore the beatsync behavior.

@daschuer
Copy link
Member Author

daschuer commented Jun 1, 2018

Ups, I have messed up my 2.1 branch. Fixed now.

@daschuer
Copy link
Member Author

daschuer commented Jun 3, 2018

@Be-ing:ready to merge? I would like to release 2.1.1 including this.

@Be-ing
Copy link
Contributor

Be-ing commented Jun 4, 2018

I'm confused what this new sync_phase Control is intended to do. Now right clicking the sync button makes the track seek so the play position jumps to the beat grid of the track that sync_phase was pressed on. Isn't it meant to align the beatgrid of the track sync_phase is pressed on to the other track's beatgrid?

@daschuer
Copy link
Member Author

daschuer commented Jun 4, 2018

This PR does not introduce any new control.
I think you mean the existing control beatsync_phase.
Before this PR it does nothing in case of quantize of. Now it always independent from quantize and seeks the track on which the button is pressed. No idea why it is the other track in your case.

@daschuer
Copy link
Member Author

daschuer commented Jun 5, 2018

I have double checked it and only the track where I press sync does the seek.
Do you have a recipe to reproduce it?

@daschuer
Copy link
Member Author

daschuer commented Jun 7, 2018

@Be-ing: merge?

@Be-ing
Copy link
Contributor

Be-ing commented Jun 8, 2018

I'm confused what this new sync_phase Control is intended to do. Now right clicking the sync button makes the track seek so the play position jumps to the beat grid of the track that sync_phase was pressed on. Isn't it meant to align the beatgrid of the track sync_phase is pressed on to the other track's beatgrid?

I think I got confused before because I tested tracks with very different tempos. sync_phase works as described.

Copy link
Contributor

@Be-ing Be-ing left a comment

Choose a reason for hiding this comment

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

I am a little confused now what this PR changes at this point. IIUC the only behavior change is that beatsync only syncs phase if quantize is enabled now?

if (isPlaying() && m_pQuantize->toBool()) {
// only sync phase if the deck is playing and if quantize is enabled.
// this way the it is up to the user to decide if a seek is desired or not.
// This is helpfull if the beatgrid of the track doe not fit at the current
Copy link
Contributor

Choose a reason for hiding this comment

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

helpful

// only sync phase if the deck is playing and if quantize is enabled.
// this way the it is up to the user to decide if a seek is desired or not.
// This is helpfull if the beatgrid of the track doe not fit at the current
// payposition
Copy link
Contributor

Choose a reason for hiding this comment

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

playposition

@@ -1429,3 +1429,52 @@ TEST_F(EngineSyncTest, ZeroBpmNaturalRate) {
EXPECT_EQ(0.0,
ControlObject::getControl(ConfigKey(m_sGroup1, "local_bpm"))->get());
}

TEST_F(EngineSyncTest, SyncPhaseToIfQuantize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ping

}



Copy link
Contributor

Choose a reason for hiding this comment

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

extra newlines at end of file

@@ -1179,7 +1179,7 @@ void EngineBuffer::processSeek(bool paused) {
return;
}

if ((seekType & SEEK_PHASE) && !paused && m_pQuantize->toBool()) {
if (!paused && ((seekType & SEEK_PHASE) || m_pQuantize->toBool())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not familiar with this area of the code. Can you clarify what this change does?

Copy link
Member Author

Choose a reason for hiding this comment

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

This allows to sync phase independent from quantize now. The sync signal of the controls that must not sync phase if quatize is of, is done in their buissnes logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay thank you for explaining.

@daschuer
Copy link
Member Author

daschuer commented Jun 8, 2018

I am a little confused now what this PR changes at this point. IIUC the only behavior change is that beatsync only syncs phase if quantize is enabled now?

The changes are that beatsync_phase syncs always phase even if quantize is disabled and we put that to the right klick instead of other redundant controls.
The other controls have not chsnges, and the description in the Mixxx Wikki have been corrected.

@daschuer
Copy link
Member Author

daschuer commented Jun 8, 2018

Done!

@Be-ing
Copy link
Contributor

Be-ing commented Jun 9, 2018

I'm still confused. I just tested master and beatsync_phase works regardless of whether quantize is enabled and beatsync only syncs phase if quantize is enabled. So what does this change other than the skins?

@daschuer
Copy link
Member Author

beatsync_phase did not work independently from quantize before.

@Be-ing Be-ing changed the title beatsync fix fix beatsync_phase depending on quantize Jun 10, 2018
@Be-ing
Copy link
Contributor

Be-ing commented Jun 10, 2018

I just tested master and beatsync_phase works regardless of whether quantize is enabled

I checked again and couldn't reproduce that. So this PR LGTM.

@Be-ing Be-ing merged commit 869158f into mixxxdj:2.1 Jun 10, 2018
@daschuer
Copy link
Member Author

Thank you.

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