-
Notifications
You must be signed in to change notification settings - Fork 3k
Improvements for double/half durations on range and list selection #24385
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
base: master
Are you sure you want to change the base?
Improvements for double/half durations on range and list selection #24385
Conversation
2d44875 to
ba4e942
Compare
0f85279 to
e954bfc
Compare
|
Could this get rewiewed (again), please? |
|
What is going to happen with this PR? |
|
Sorry, we're really a bit too much behind with reviewing community PRs. Hopefully we can manage to get through most of them in the coming months. I've added it to 4.6. |
|
This is cool. Does shift Q/W also work on range selection? it would be nice if it did. |
|
It should, but let me rebase, then you can check yourself |
e954bfc to
7780b99
Compare
|
Thanks! Indeed, shift Q/W works with range selection but here are some bugs i found:
|
|
Interesting, none of this happens with 3.7 Evolution (except your point 4. does, but as you mentioned, that's not really a bug), which contains the changes this PR here ports forward. |
|
After a closer look, i pinpointed the correct conditions of the bugs, which ,btw, i also found to be present in 3.7
|
260bbae to
edbbcae
Compare
Backport of musescore#24385, commit 3 Co-Authored-By: Ashraf El Droubi <[email protected]>
edbbcae to
5b2596d
Compare
4737555 to
afd7138
Compare
|
I can't reproduce, not with a rebased version (I had to add a missing last argument |
|
Similar crash still present, quarter note ties and press "W" twice Untitled.mp4 |
|
Sorry, no crash here, not on Windows and in the MSVC debugger |
afd7138 to
812723b
Compare
|
Perhaps it has to do with selection (not ties), I can crash the program when Cmnd+Click after adding a note (already selected) then press w twice video1161111886.mp4 |
|
Maybe you can write down the exact steps? |
Confirmed on second device, and other instruments |
|
OK, finally, crash confirmed... Debugging session tomorrow |
3797531 to
2e9a46b
Compare
|
OK, crash investigated and fixed (and rebased once again) |
…e different durations Backport of musescore#24385, commit 3 and 4, including a simplification (removing redundant code), plus fixing clazy warnings Co-Authored-By: Ashraf El Droubi <[email protected]> Co-Authored-By: Casper Jeukendrup <[email protected]>
|
Thank you! Tested on MacOS 15, Windows 11, Ubuntu 22.04.3. Approved |
|
What prevents it from getting merged then? |
|
I noticed a change in behaviour for full-measure rests: for most time signatures, it no longer decreases the duration of a full-measure rest, but only rewrites it using a non-full-measure rest. Example: in 4/4, a centred full measure rest only changes into a non-centred 4/4 rest, instead of being split into two 2/4 rests. Similar situation in 3/4. I don't know if that's a blocker, but I did want to check it. |
| ? cr->durationType().fraction() * Fraction(3, 3 + nSteps) | ||
| : cr->durationType().fraction()* Fraction(3 - nSteps, 3 + nSteps), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thoughts, this fraction multiplication magic seems not the best implementation to me. A bit risky, and relying heavily on the assumption that nSteps == ±1 (and not 0, or 2), which wasn't the case with the previous implementation.
What is actually the reason for replacing the original implementation with shiftRetainDots and the DurationType::V_MEASURE check?
If it's only that it's a bit verbose, it could be moved into a static Fraction …(…) function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't speak for the changes not in accord with what I initially provided for 3.x (https://github.com/Jojo-Schmitz/MuseScore/pull/609/files), but I can say that the nSteps assumption was valid given that this function (cmdIncDecDuration) in 3.x is only used for some "wrapped" around functions with the following:
void cmdDoubleDuration() { cmdIncDecDuration(-1, false); }
void cmdHalfDuration() { cmdIncDecDuration( 1, false); }
void cmdIncDurationDotted() { cmdIncDecDuration(-1, true); }
void cmdDecDurationDotted() { cmdIncDecDuration( 1, true); }
The nSteps will always be ±1 with these. but I don't know if things have changed in the main upstream 4.x branch. It wasn't ever used besides those four functions, but it wouldn't hurt to safeguard just in case there is a change in the future of course.
As for the multiplication magic and the removal of the V_MEASURE test: @Jojo-Schmitz ? The V_MEASURE check still remains at the bottom of this function in 3.7 from what I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first equation guarntees multiplication by 3/2 or 3/4. (for dotted augmentation/diminishing)
The second eq. sets multiplication by ½ or 2.
Both cases depend on nSteps being ±1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ash-86 et. al: Not sure, but it seems to me the multiplication isn't necessary since there are shiftRetainDots and shift functions already existing for TDuration (not fractions), like if the code were to do this:
for (auto cr : crs) {
TDuration odt = cr->durationType();
TDuration ndt(stepDotted ? odt.shiftRetainDots(nSteps, stepDotted) : odt.shift(nSteps));
changeCRlen(cr, ndt);
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, whatever's easier to read :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested using the shift functions, although they too work fine for most cases, the problem with changing a measure rest persists, with even wierder results...
We could simply disable w/q actions for measure rests. It is not a legit usecase anyway and I don't think it will be missed at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What coded change would be needed then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, there was already a check for measure-rests!! Should bring back that, and let's use shift functions instead of doing fraction math, as per worldwideweary's suggestion, this becomes:
for (ChordRest* cr : crs) {
// if measure rest is selected as input, then the correct initialDuration will be the
// duration of the measure's time signature, else is just the ChordRest's duration
TDuration initialDuration = cr->durationType();
if (initialDuration == DurationType::V_MEASURE) {
initialDuration = TDuration(cr->measure()->timesig(), true);
if (initialDuration.fraction() < cr->measure()->timesig() && nSteps > 0) {
// Duration already shortened by truncation; shorten one step less
--nSteps;
}
}
TDuration newDuration(stepDotted ? initialDuration.shiftRetainDots(nSteps, stepDotted) : initialDuration.shift(nSteps));
if (cr->isChord() && (toChord(cr)->noteType() != NoteType::NORMAL)) {
undoChangeChordRestLen(cr, newDuration);
} else {
changeCRlen(cr, newDuration);
}
}
In my test, everything seemed to work well.
|
it's a shame this didn't make it to 4.6 :( |
|
@Jojo-Schmitz could you rebase this, please? |
Port of musescore#7519 Co-Authored-By: Casper Jeukendrup <[email protected]>
…valent to pressing a duration toggle. Shift also allowed Port of #609
…e different durations Co-Authored-By: Ashraf El Droubi <[email protected]>
Co-Authored-By: Ashraf El Droubi <[email protected]> Co-Authored-By: Casper Jeukendrup <[email protected]>
2e9a46b to
503c206
Compare
|
done |
Fix #317188: Allow [Q] and [W] to work on a range selection.
Port of Fix #317188: Allow [Q] and [W] to work on a range selection #7519 for 3.x
[Cmd: Double/Half Duration] Allow to apply to a list selection - equivalent to pressing a duration toggle. Shift also allowed
Port of [Cmd: Double/Half Duration] Allow to apply to a list selection - equi… Jojo-Schmitz/MuseScore#609, fixes Enhancement: Allow Q/W to perform duration toggle on a list selection Jojo-Schmitz/MuseScore#608
Fix #20962: Keep selection when deleting, changing note/rest lengths #20984 Updated so that the selection would retain the chords if the user has a list selection and performs duration changes by way of the pad toggle. Similar to Double/Half like a range selection, but inserts rests in-between the notes when making smaller form
I (@worldwideweary) figured why not in addition let Q/W (with or without shift) do the same thing with the duration changes. That is
qwList.webm