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 debug assertion in BeatFactory::makePreferredBeats() #4270

Merged
merged 6 commits into from
Sep 16, 2021
Merged

Fix debug assertion in BeatFactory::makePreferredBeats() #4270

merged 6 commits into from
Sep 16, 2021

Conversation

uklotzde
Copy link
Contributor

@uklotzde uklotzde commented Sep 7, 2021

auto pGrid = mixxx::BeatGrid::makeBeatGrid(
sampleRate, constBPM, firstBeat.toNearestFrameBoundary(), subVersion);
return pGrid;
if (firstBeat.isValid()) {
Copy link
Member

Choose a reason for hiding this comment

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

The method is only called by analyzerbeats. Can we move the check there and leave the debug assertion intact?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I only wonder why the assertion was triggered by firstBeat.toNearestFrameBoundary(), because adjustPhase() already requires a valid value? firstBeat is invalidated by makeConstBpm().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Em, no, I don't think we can't move this check out of BeatFactory::makePreferredBeats(). Will test again.

Also edge cases with a single beat are not handled correctly. It doesn't make any sense to infer a tempo for less than 2 beats.

…erredBeats

# Conflicts:
#	src/track/beatutils.cpp
…erredBeats

# Conflicts:
#	src/track/beatfactory.cpp
@uklotzde
Copy link
Contributor Author

Ping.

I suggest to keep the input validation and handling inside the functions instead of making assumptions by whom and how they are called.

The only exception is to assume that all mandatory parameters are valid, e.g. the sample rate.

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

LGTM.
@Holzhaus: merge?

@Holzhaus
Copy link
Member

I'm currently traveling so I cannot retest this. But the code looks good to me. No objections.

@daschuer
Copy link
Member

Ok than I will hit merge. Thank you.

@daschuer daschuer merged commit 07f675a into mixxxdj:main Sep 16, 2021
@uklotzde uklotzde deleted the makePreferredBeats branch September 16, 2021 21:51
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.

None yet

3 participants