A time signature change deletes all voices >1 in Tab staff with linked staves

• May 15, 2015 - 22:41
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Nightly 8911cdd or MuseScore 2.0.1 / Windows7

1) Load this file: test file.mscz

This is the start point:
1 four voices.jpg
2) Drag and drop a new time signature e.g. 2/4 in the first measure

Result: all the voices 2, 3, and 4 are deleted in the tab staff

result.jpg

Additionnal notes :

- same result in Tab staff type common and full
- if you copy-paste (in the test file) the first measure (EDIT: i.e. after the change in 2/4) into an other, the voices >1 return in the tab staff. But drag in this measure a new time signature removes that.


Comments

New title: this issue is related to linked staves.
Load this file to verify that it works if the content of the first staff (standard) has been pasted in the the second staff (Tab) : test file2.mscz

Title A time signature change deletes all voices >1 in Tab staff and linked staves A time signature change deletes all voices >1 in Tab staff with linked staves

I'm looking at this and I do understand what is going wrong. I have a proposed solution, although I'm not super confident about it.

The November 13 change referred to above had a number of effects, but I think the most relevant is the fact that ScoreRange::read() now iterates over uniqueStaves rather than all staves. This has the effect of not copying both linked staves, but only the first. The second staff is then recreated on the fly from the first via cloneStaff2(). Unfortunately, this happens after only the first track of the staff has been written, so the voices 2-4 never get cloned.

My proposed fix is to simply do the clone after the *last* track of the staff, rather than the first. Simly changing "if ((track & VOICES) == 0)" to "if ((track % VOICES) == VOICES - 1)" works in the test case and a couple of others I tried. I guess my worry is, I could imagine cases where the track list for the ScoreRange doesn't actually contain entries for voice 2-4, so track would only ever be multiples of 4. But this didn't seem to ever happen in the cases I tried, even when there was absolutely nothing in any voice but 0.

I also have to say I'm not overly thrilled with the fact that we end up recreating the linked staff on the fly. It means we lose any manual adjustments that were made before the change. Eg, add an accent mark to any note, drag it to a new position in the tab staff, then make the time signature change. The manual adjustment in the tab staff is lost. Not the end of the world I guess, but it does make me a little uncomfortable with the whole idea of this approach.

Anyhow, I'll be submitting a PR soon.