Corruption possible by changing voice 2 note into voice 1

• Feb 9, 2015 - 16:32
Type
Functional
Severity
S3 - Major
Status
closed
Project

Ubuntu 14.04, GIT commit: 0891e57

The code to move notes between voices is limited, but unfortunately, not limited enough:

1) note entry
2) voice 1, whole note C
3) voice 2 (same measure), two half notes, both chords F & A
4) exit note entry mode
5) select A of second half note chord in voice 2
6) press voice 1 button

Result: note is moved to voice 1 even though it is "full" already with the whole note:

change-voice.png

We should probably simply disallow moving things into voice 1. If there is an existing element (chord or test) in that voice, it is replaced, but there is no check that it's the right duration, and undo does not restore the original element, either.


Comments

I started to assign this to myself think I'd fix it by limiting it further (only moving notes between existing chords or where there is an explicit rest). But maybe someone else wants to fix it "for real"? That would mean checking the destination voice, using an exisiting chord if present, converting a rest to chord if a rets is present, shortening a preceding chordrest if necessary, etc.

Status (old) active patch (code needs review)

https://github.com/musescore/MuseScore/pull/1757

The code itself works well. Almost too well - I find it surprising how easy it is to move notes from voice to voice. I worry a little that people might end up moving notes accidentally until they get used to it.

In the original example above, the result would be the whole note one voice 1 gets shortened to a half note, and the "A" is moved to voice 1. If you then move it back to voice 2 as per comment #1, it gets replaced by a rest in voice 1.

I have updated my PR based on suggestions from lasconic. It feels much better now. Notes are only moved if it can be done without changing duration or disturbing the surrounding notes.

But I hope there will be a pop-up alert with info why "this button doesn't work" so that you can't move the notes between voices. Or maybe user should have choice whether he wants to cut duration of note in the other voice or not?