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

Write location before spanner end on score end #20107

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

miiizen
Copy link
Contributor

@miiizen miiizen commented Nov 20, 2023

Resolves: #19082
Resolves: #17646
This PR writes a location tag before any spanner which ends at the end of the score. Ususally, these spanners would be written to the beginning of the following bar. Instead they are written to the end of the bar, but when reading the file the location is ambiguous. The location tag ensures the location is updated to the end tick of the file when reading the spanner end.

prevLoc.setStaff(s->staffIdx());

spannerEndLoc.toRelative(prevLoc);
if (spannerEndLoc.frac() != Fraction(0, 1)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this condition better get moved up to the first if?

    if (frac == s->score()->endTick() && frac != Fraction(0,1)) {

Or ever the other way round?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, as spannerEndLoc has been made relative to the previous location by this point. This is checking if spannerEndLoc is the same as the previous location written to the file (difference between fractions is 0). If so, we don't need to bother writing to the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thanks for explaining

@cbjeukendrup
Copy link
Contributor

@DmitryArefiev Since #17646 seems also related to playback, does this also need to be tested by you?

@DmitryArefiev
Copy link
Contributor

@cbjeukendrup I've tested #17646 on Win10 - looks fine, but #17646 also doesn't occur in 4.2 latest master (and happens in 4.1.1)

@DmitryArefiev
Copy link
Contributor

Tested #19082 #17646 on Win10 - all good on my side

@RomanPudashkin RomanPudashkin merged commit 674b35c into musescore:master Nov 22, 2023
11 checks passed
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants