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 waveform overview lenght. #11359

Merged
merged 5 commits into from
Mar 19, 2023
Merged

Fix waveform overview lenght. #11359

merged 5 commits into from
Mar 19, 2023

Conversation

daschuer
Copy link
Member

This aims to fix #11344 where the waveform overview is rendered with the wrong length.
A possible regression from #11162
mixxx-2.3.3-145-gcfcd265afd-win64.msi

@robbert-vdh
Copy link
Contributor

I rebased this on top of the main branch and I can confirm that this also fixes the problem I posted about in #11280 (comment).

Comment on lines 80 to 86
double getTrackSamples() const {
return m_trackSamplesControl->get();
if (m_trackLoaded) {
return m_trackSamplesControl->get();
} else {
return 0.0;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

IMO this only fixes the symptom of a more complex issue. If there is no track loaded, the CO should already be 0.0...

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have a better solution?
The complex issue is that the track change is propagated via the Qt signal queue while the track samples control is changed instantly as an atomic.
m_trackLoaded bool ensures that the value is not used during the transition.

Copy link
Member

Choose a reason for hiding this comment

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

I see, so its basically a data-race.
The problem I still have with this solution is that the waveform assumes that CO values <= 0.0 mean that no track is loaded. Or rather, it relies on the fact that that is always the case (which it isn't due to the data-race). I think it would be better to move the m_trackLoaded != nullptr check to callers where they should actually check that.

Copy link
Member Author

Choose a reason for hiding this comment

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

The track length is set here to an invalid value from the worker thread:

setTrackEndPosition(mixxx::audio::kInvalidFramePos); // Stop renderer

in a responds from a new track loaded into the player.

The Waveform overview visualizes the track loading process. It has already the new track before the engine had evicted the old one. In this situation is guarded by the m_trackLoaded boolean.

I will add a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think a outdated waveform update signal cause a paint event with these inconstant data.

@daschuer daschuer added this to the 2.3.5 milestone Mar 14, 2023
@daschuer
Copy link
Member Author

@Swiftb0y done.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

typo

Comment on lines 84 to 85
// Ignor the value, because the engine can still have the old track
// during loading
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Ignor the value, because the engine can still have the old track
// during loading
// Ignore the value, because the engine can still have the old track
// during loading

Copy link
Member

Choose a reason for hiding this comment

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

hmm, codespell didn't catch that

Copy link
Member Author

Choose a reason for hiding this comment

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

I have amended the last commit

@daschuer
Copy link
Member Author

Done

@ronso0
Copy link
Member

ronso0 commented Mar 18, 2023

Two users confirmed this fixes #11344 so this is ready to go without a second review?

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

Sure

@Swiftb0y Swiftb0y merged commit eeae59a into mixxxdj:2.3 Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants