dragging anchor of instrument change text needs to revert staff's transposition
Draggin instrument change text will leave behind incorrectly transposed notes. I noticed this while testing Marc's fix for #9352: Add ability to set transposition by range.
If start with a bunch of middle C's:
And then add instrument change text to Tenor Saxophone on first note of meas 2:
Then we have the notes correctly transposed according to the new instrument's transposition.
However, if we then drag the instrument change text right to meas 3, those notes in meas 2 should revert to middle C without any transposition, but instead you will see the notes in meas 2 are left in an incorrectly-transposed state:
Note that the although the staff transposition is incorrect, it is at least in the correct octave. Also if you listen to the playback, you will hear the notes in meas 2 at the correct pitch of concert middle C and played correctly in the original instrument (piano). Now, interestingly if you save the score inst-change-dragged.mscz and re-open it, you will see the score looks the same (with the notes in meas 2 displaying as middle D, but that the notes sound as middle D. So it seems the incorrect residual staff transposition was not saved into the mscx (which is good, because it shouldn't have been saved), but of course those notes were saved as the incorrect pitch, D.
Similarly, there if a problem if drag the change instrument text left of where it was initially inputted:
Those two tenor sax note in meas 2 display as C but should be displayed as D. And if you save and reload the score, inst-change-meas-2-dragged-left.mscz then similarly will note that the those two C notes for tenor will sound incorrectly as Bb.
This bug was found on 2.1-dev 13d7332 nightly windows build.
Comments
There is an additional problem which occurs if change staff properties instrument after adding a change instrument text.
Start with:
then set staff properties instrument to bari:
then dragging the change instrument text around doesn't affect anything:
these issues affect both 2.1-dev and 3.0-master 72ab8cb
I don't have access to a machine running MuseScore right now, but I'm confused - what do you mean "drag"? Are you somehow trying to move an existing instrument change text from one measure to another? I'm not sure there is any supported means of doing that. If anything happens at all when you drag, that is probably a bug in itself - dragging text should affect its visual position only, not its behavior.
click and hold the change instrument text and drag it such that its anchor is tied to a different tick.
That sounds like a bug to me. We do that for dynamics (and I don't like it) but as far as I know, other text should drag normally. I am not aware of any special code designed to handle instrument changes specially like that. Probably whatever is happening to change the tick on a drag should be disabled.
ok...I'm changing this issue title then...I can probably go ahead and do that fix, since will be easy.
It's here:
https://github.com/musescore/MuseScore/blob/2.1/libmscore/instrchange.c…
Looks like there was an initial implementation of a dynamics-like scheme for changing tick on drag, but to me that approach ia not good and we should delete this function so drag works normally. If we do decide we should handle instrument changes specially like dynamics - and I'd argue against that - we would need to complete the implementation, as indeed right now it doesn't do the things it would need to in order to work correctly.
Marc, I made PR to remove that overriden function:
https://github.com/musescore/MuseScore/pull/3071
So now dragging just defaults to Element::drag() which doesn't change anchor (I've tested in 3.0 branch).
(Aside: there is a layout bug when dragging in 3.0-dev, which results from measure not updating layout when drag, causing it hard to find the element).
Fixed in branch master, commit cbd5471838
fix #181616 disable change anchor for Instrument Change text
Removes the overridden method InstrumentChange::drag(). So now just uses Element::drag(), which won't change the anchor.
Fixed in branch master, commit 3e6e6391cf
Merge pull request #3071 from ericfont/181616-InstChangeAnchor
fix #181616 disable change anchor for Instrument Change text
Fixed in branch 2.1, commit fa578f9fd5
fix #181616 disable change anchor for Instrument Change text
Removes the overridden method InstrumentChange::drag(). So now just uses Element::drag(), which won't change the anchor.
Automatically closed -- issue fixed for 2 weeks with no activity.