Skip to content

AutoDJProcessorTest.FadeToDeck2_Long_Transition fix#34

Merged
Be-ing merged 19 commits intoBe-ing:autodj_intro_outrofrom
daschuer:autodj_intro_outro
Nov 7, 2019
Merged

AutoDJProcessorTest.FadeToDeck2_Long_Transition fix#34
Be-ing merged 19 commits intoBe-ing:autodj_intro_outrofrom
daschuer:autodj_intro_outro

Conversation

@daschuer
Copy link
Copy Markdown

No description provided.

} else {
pFromDeck->fadeBeginPos = endPoint;
pFromDeck->fadeEndPos = endPoint - m_transitionTime;
pFromDeck->fadeEndPos = endPoint;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This breaks fading with a negative transition time. AutoDJ stops in this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was causes elsewhere, but fixed now.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Oct 28, 2019

When the transition time is 0, tracks are loaded at the end. AutoDJ keeps playing by seeking back to the start when it is time to transition, but this is really confusing.

Comment thread src/library/autodj/autodjprocessor.cpp Outdated
if (m_eState == ADJ_IDLE) {
if (thisDeckPlaying || thisPlayPosition >= 1.0) {
// cache this before calculating the new transition in otherDeck.play();
bool hasFadeTransition = thisDeck.fadeBeginPos < thisDeck.fadeEndPos;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

When could this be false? It is not obvious. At first glance it seems like this should be a debug assert.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is always false, if you use a negative or zero transition time.
I will add a comment.

@daschuer
Copy link
Copy Markdown
Author

When the transition time is 0, tracks are loaded at the end. AutoDJ keeps playing by seeking back to the start when it is time to transition, but this is really confusing.

Does this seek to the end happens automatically? I cannot confirm that. I have only found and fix an issue using n invalid cue point of -1.

Or do you mean manual seeking to the end? The track should not seek or unload to allow the user to adjust the outro, right? Do you now have a different opinion?

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Oct 29, 2019

Does this seek to the end happens automatically?

Yes, the second track and every track after that loaded in Full Track mode with a transition transition time of 0 loads at the end of the track.

@daschuer
Copy link
Copy Markdown
Author

I cannot reproduce this and I have no idea where the seek is coming from.
We have two concurrent seeks when loading the track. First seek to cue, second seek to auto DJ calculated position. The cue load should not seek to end though.
Which load mode do you use without Auto DJ?
Does it also happen with other modes than full track mode?
Does it still happen after my last changes here?

@daschuer
Copy link
Copy Markdown
Author

Could it be the deck clone feature?
Did you use always the same track?

It looks like the new code tricks the detection.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Oct 29, 2019

This seeking to the end bug is new with this PR and 100% reproducible for me. I am not sure what commit introduced the bug because AutoDJ has not worked at all with a transition time of 0 since before any of your recent PRs were merged. ee9cfcc is the most recent commit before this PR where Full Track mode works with a transition time of 0. That commit does not have the loading at end of track bug.

Does it also happen with other modes than full track mode?

No. Maybe it would happen with Skip Silence mode if the outro end was at the very end of the track but I have not tested.

Does it still happen after my last changes here?

Yes.

@daschuer
Copy link
Copy Markdown
Author

I have a bug in rare cases where the seek to 0:0 does not happen. Instead it is seeked to the main cue as set in the deck preferences.

I guess here the seek is omitted:
https://github.com/daschuer/mixxx/blob/70214dfbd27a0915eb51406d49f827f801586659/src/library/autodj/autodjprocessor.cpp#L1305

Maybe in you case there is a stray 1 stored as seek point and never overridden due to an early return in calculateTransition()

Can you verify this?

I have tried to remove the is playing dependency, but this has messed up the tests.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Oct 30, 2019

I tested your latest changes and the bug is still there. I will try debugging tonight.

I have a bug in rare cases where the seek to 0:0 does not happen. Instead it is seeked to the main cue as set in the deck preferences.

The main cue is not at the end of the track, so I don't think this bug is related.

@daschuer
Copy link
Copy Markdown
Author

Being at the main cue maybe only a side effect.
The issue is if to or from deck is nullptr, the we load position is not witten.
For some reason it could be 1 in you case an -1 in my case.

Maybe we should force it to -1 in case of early exit.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Oct 31, 2019

I will try debugging tonight.

Actually I won't have time until this weekend.

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Oct 31, 2019

My issue is gone now. Yours as well?

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 3, 2019

The random seek issue still happens sometimes. I am currently digging into it.

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 3, 2019

Fixed now. @Be-ing: Is your issue fixed as well?

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 3, 2019

No, the seeking to the end bug is still there. I am puzzled why you cannot reproduce it. I can reproduce it 100% of the time by choosing Full Track mode and setting the transition time to 0. The bug appears as soon as the first transition is made after enabling AutoDJ.

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 4, 2019

Strange, I have added some debug. Can you create a mixxx.log file. I am curious which path in the code seeks to 1.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 4, 2019

I think the bug is actually in WOverview, not AutoDJProcessor. I just noticed that when the bug occurs, the scrolling waveform is in the correct position, it is only the overview that is in the wrong position. I suspect this was caused by merging master after mixxxdj#2238 was merged to master.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 4, 2019

This does seem to be somehow related to the track load preference. When I have the preference set to load at the beginning of the track, the bug occurs with every track. When I set it to load at intro start, the bug only occurs when the intro start is at the very beginning of the track.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 4, 2019

Yes, the problem is in WOverview. Adding a call to onConnectedControlChanged in slotWaveformSummaryUpdated hacks around the bug. However, I am not sure why onConnectedControlChanged is not getting called on track load. Do you want to use that quick hack or investigate further why WOverview::onConnectedControlChanged is not getting called?

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 4, 2019

After merging master, I can reproduce the issue.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 5, 2019

Okay, so how should we solve it?

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 7, 2019

@Be-ing: Now it should be solved. Please test again.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 7, 2019

It's fixed!

// We require ADJ_IDLE to prevent changing the thresholds in the middle of a
// fade.
if (m_eState != ADJ_IDLE) {
VERIFY_OR_DEBUG_ASSERT(m_eState == ADJ_IDLE) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I am confused why you changed this to a debug assertion. There is now code scattered throughout AutoDJProcessor repeating this check before calling calculateTransition. Why is it not sufficient to check this here at the top of calculateTransition? Aren't those other checks redundant?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have moved the check outside to clearly mark all calling functions as "guard for manual user changes only".
I had a knot in my head when debugging because of all these slots.
This change helped me finally for a better understanding. I have kept the change, because it also saved some cpu cycles.

@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 7, 2019

What was the root cause of the bug? I don't understand how the changes you made fixed it.

@daschuer
Copy link
Copy Markdown
Author

daschuer commented Nov 7, 2019

It was actually a combination of two bugs. One was a recursive call of playerPositionChanged(). A stop() causes finally another playerPositionChanged() to 0 before the fist value was passed to the woverview. So first 1 was passed after the following 0.

The other issue was in engine buffer, that a seek of an old track to a position prevents a new track to seek to the same position.

The later was the original bug where the fix inside AutoDj leads to the first bug. I think I now have catched the route cause. I guess the behaviour has changed in master lately due to the engine track loading refactoring.

@Be-ing Be-ing merged commit 7658b51 into Be-ing:autodj_intro_outro Nov 7, 2019
@Be-ing
Copy link
Copy Markdown
Owner

Be-ing commented Nov 7, 2019

Okay, thank you for digging deep to solve those tricky bugs. I am glad we did not go with the quick hack in WOverview.

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.

2 participants