Notes not transposed when copied by notehead

• Mar 27, 2010 - 15:32
Type
Functional
Severity
3
Status
closed
Project

1. Create a new score with a flute and a Bb clarinet
2. Insert a G quarter note into the flute staff, and a C quarter note into the clarinet staff
3. Click on the *notehead* of the C quarter note in the clarinet staff and hit copy
4. Click on the *notehead* of the G quarter note in the flute staff and hit paste

Expected behavior:
There should be a Bb (transposed from the clarinet's C) in the flute staff, in the same way that it does when multiple notes are selected

Actual behavior:
There is a C in the flute staff.

Platform:
r2908, GNU/Linux


Comments

Severity
Status (old) needs info active

Assume a transposing score, not a score in concert pitch (i.e. concert pitch disabled).

Other weird things happen too - the pitch plays back incorrectly. BTW, at step 1, I entered Bb as the key for the score, so the flute shows two flats, the clarinet none. The G on the flute part is second-to-bottom line; the C in clarinet is second-to-top space. When I copied the C from clarinet to flute, what displayed was C *below* the staff, but what plays back is *Bb* (middle line). If I then hit down arrow, the note now renders as Cb on the second-to-top space (and plays as the A a whole step below).

It seems we can fix this by adding a call to Note::setTpcFromPitch() here:

https://github.com/musescore/MuseScore/blob/77e980d95d0aa40735a17eceb19…

The note being added has the right pitch, since that's recorded in concert pitch, so this call does the right thing in this case. I don't know if this gets hit in other situations too (we're dropping a Note onto another Note), but it seems to me this should be fairly safe. We could make it safer by only doing this if the source and destination staves differ. We could also do the actual calculations, checking concert pitch state, finding the transposition interval, transposing the tpc. But I guess I'd like to know if this code is likely to be hit in other contexts as well.