Can't copy nested tuplets to last beat of measure
Reported version
3.0
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
This issue was reported here: https://musescore.org/en/node/278934.
Open the attached file. Copy the complete tuplet on beat 1 and try to paste it onto beat 4. MuseScore will complain the the tuplet crosses the bar line, even though it should fit in the measure.
Attachment | Size |
---|---|
paste-tuplet.mscz | 3.75 KB |
Comments
See https://github.com/musescore/MuseScore/pull/4246.
Fixed in branch master, commit 7ff253cae0
fix #278943: Can't copy tuplet to last beat of measure
Fixed in branch master, commit 03fffbc3f6
Merge pull request #4246 from mattmcclinch/278943-paste-tuplet
fix #278943: Can't copy tuplet to last beat of measure
Automatically closed -- issue fixed for 2 weeks with no activity.
and it happened again. 36e6246. create a >8 tuplet, copy paste to last beat of measure, get the 'tuplet cannot cross barlines' error.
I've been staring at the code, though I don't see any changes to what matt did. It looks like afrac() means 'actual fraction' take the starting tick and return the fraction of the measure used? Though, with this:
Fraction Fraction::fromTicks(int ticks)
{
return Fraction(ticks, MScore::division * 4).reduced();
}
Isn't that assuming that a measure is 4 beats long? So afrac is (ticksused)/(ticksin4/4measure)?
Also, it looks like paste.cpp is checking rfrac, not afrac. rfrac... if measure, rfrac = afrac - m->afrac, is that then accounting for time signatures that have other than four beats per measure? and then... rtick is tick - parent->tick. So starting tick of the tuplet, minus what? Who is the parent? The measure/amount highlighted?
Do we have documentation for the code? It'd make it easier. I can't find any.
A straight nine-let works fine, its only the nested version that is doing it's math correctly.
This pull request fixes the issue for nested tuplets: https://github.com/musescore/MuseScore/pull/4481.
I swear I tested my previous fix on this kind of tuplet. But that was before I realized that Tuplet::rtick() was not returning the correct value.
Laurelin, let me try to answer some of your questions.
A whole note is defined as 4 beats, no matter the time signature.
The parent of a tuplet is the measure that contains the tuplet.
rfrac() is the "relative fraction", or the beat relative to the beginning of the measure, in terms of a fraction of a whole note.
afrac() is the "absolute fraction", or the beat relative to the beginning of the score, in terms of a fraction of a whole note.
Oh, and the documentation for the code is the code itself.
Fixed in branch master, commit 1711862aa2
fix #278943: Can't copy nested tuplets to last beat of measure
Fixed in branch master, commit aca364679e
Merge pull request #4481 from mattmcclinch/278943-paste-nested-tuplet
fix #278943: Can't copy nested tuplets to last beat of measure
Automatically closed -- issue fixed for 2 weeks with no activity.