Pasting cross-measure ties sometimes appends incorrect note

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Pasting cross-measure ties sometimes appends incorrect note

jay.coskey
Summary: Pasting cross-measure ties sometimes appends incorrect note

Unless someone thinks this is in their area, I'd be interested in working on this as my first MuseScore development task.

==Possibly related issues==
* On 2009-02-27, Toby Smithe reported to this mailing list Launchpad bug #335461, "wrong measure-size using ties from capella-files".  That Launchpad bug could be related to this one.
* On 2009-01-27, nh2 posted to the MuseScore forum that slurs vanished when pasted.  Perhaps copying of ties/slurs has been implemented since then.

==Reproduction steps==
Platform: MuseScore 0.9.5 r1597 running on Ubuntu 8.10

(1) Create a new score with at least 7 measures, and add notes tied across measures in 3/4 time as indicated by the following Lilypond code.
    % Sequence of 3 whole "notes" spread across 4 measures in 3/4 time, using ties
    \relative c'' { \time 3/4
      a2.~
      a4 a2~
      a2 a4~
      a2.
    }
(2) Now attempt to continue the pattern of by pasting the 1st measure into the 5th, and then the 2nd into the 6th.

==Note about expections regarding copying of notes with ties across measures==
(a) Copy first tied note, but not the tie.
(b) Copy first and second tied note, and also the tie between them.
(c) Copy first tied note and the tie, but not second tied note.
Problem with (a): This would imply that copying consecutive measures would not faithfully reproduce the originals, since cross-measure ties would be left out.
Problem with (b): This might surprise the user, since it would modify a measure that they were not pasting into.
Problem with (c): It might surprise the user to have a new tie between a note they pasted and a pre-existing note in the next measure over, but this is less obtrusive than with (b).

MuseScore attempts to match (b), but (c) seems to be a more reasonable expectation.  Perhaps (a) or (b) could be optional overrides.

==Expected behavior==
Measures 5 and 6 should end up being copies of measures 1 and 2.

==Observed behavior==
Bug #1: Copying measure 1 to measure 5 copies not only the dotted half note, but also the second note in the tie.  That second note appears not as a quarter note in measure 6, but as a dotted half-note in measure 6.  Whether or not the second note should appear is debatable, but if it appears, it should appear as a quarter not, and not as a dotted half-note.

Bug #2:
Copying measure 2 to measure 6 then causes measures 5-7 to end up with the following contents (continuing the Lilypad notation from above)
    a2.~
    a4 a2~ X % See below for more about the extra element "X".
    a2

At different time (possibly depending on the history of commands executed during the run of MuseScore), the element named "X" above has been different.
(i) Sometimes, it is not present.  This matches expectation type (b), above.  (This is the only behavior I saw on MuseScore 0.9.4 r1518, running on Windows XP.)
(ii) Sometimes X is a quarter note without a stem, and length (Chord's Len value) 999999.  If this quarter note is deleted, a quarter rest is left behind.  Attempting to then add a new note on top of the quarter rest in measure 6 causes the new note to appear in measure 7.
(iii) Sometimes X is a dotted double rest with a stem, and length (Chord's Len value) 999999.  If this element is deleted from the score, then a symbol is left behind that looks like a whole rest rotated 90 degrees (reaching from the 2nd to 4th staff lines).  When the score is played, audio stops when the note tied to this "rest" is reached.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Pasting cross-measure ties sometimes appends incorrect note

jay.coskey
Q: Any ideas on how to dump the contents of the clipboard inside a debugger?

As mentioned earlier, when pasting the contents of the 1st measure into the 5th measure, MuseScore pastes 2 notes instead of the original 1. In Score::pasteStaff(), the first note pasted has its tickLen() set to 1920 instead of the correct value of 1440. The value 1920 comes from a QDomElement that ultimately comes from the clipboard. It was probably recorded in the dom when I originally went to paste a whole note (1920 ticks) into the 3/4-time 1st measure. I've tried to dump the clipboard inside a debugger by printing QApplication::clipboard()->mimeData(), but the debugger can't see QApplication. I might just write a snippet to traverse the dom. (It would be nice to be able to view the clipboard in the Inspector when debugMode is set.)

The note that appears in measure 6 has the wrong length because its length isn't set in Score::pasteStaff(). This explains the variable behavior seen in Bug #2. Also, the length of a note not being set (i.e., being set to an unexpected value) can cause an infinite loop in Score::setRest().

Still exploring....

Clarification: The "double rest with a stem" and the "rest turned 90 degrees" mentioned in my initial e-mail are in fact a breve note and a breve rest [ http://en.wikipedia.org/wiki/Longa_(music) ].

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|

Re: Pasting cross-measure ties sometimes appends incorrect note

wschweer
Administrator
The clipboard contents is normal xml text similar to the mscore save format.
It can be printed in cmd.cpp: cmdPaste():
        const QMimeData* ms = QApplication::clipboard()->mimeData();
        ...
        QByteArray ba = ms->data(...);
        printf("<%s>\n", ba.data());

Similar for drag in canvas.cpp: dragEnterEvent(...): comment out the first
drag.
It should be possible to paste the clipboard content to a console but it does
not work. I will have a closer look to this.

/Werner

On Tuesday 10 March 2009 21:57:13 [hidden email] wrote:

> Q: Any ideas on how to dump the contents of the clipboard inside a
> debugger?
>
> As mentioned earlier, when pasting the contents of the 1st measure into the
> 5th measure, MuseScore pastes 2 notes instead of the original 1. In
> Score::pasteStaff(), the first note pasted has its tickLen() set to 1920
> instead of the correct value of 1440. The value 1920 comes from a
> QDomElement that ultimately comes from the clipboard. It was probably
> recorded in the dom when I originally went to paste a whole note (1920
> ticks) into the 3/4-time 1st measure. I've tried to dump the clipboard
> inside a debugger by printing QApplication::clipboard()->mimeData(), but
> the debugger can't see QApplication. I might just write a snippet to
> traverse the dom. (It would be nice to be able to view the clipboard in the
> Inspector when debugMode is set.)
>
> The note that appears in measure 6 has the wrong length because its length
> isn't set in Score::pasteStaff(). This explains the variable behavior seen
> in Bug #2. Also, the length of a note not being set (i.e., being set to an
> unexpected value) can cause an infinite loop in Score::setRest().
>
> Still exploring....
>
> Clarification: The "double rest with a stem" and the "rest turned 90
> degrees" mentioned in my initial e-mail are in fact a breve note and a
> breve rest [ http://en.wikipedia.org/wiki/Longa_(music) ].
>
> ---------------------------------------------------------------------------
>--- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Mscore-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer