Skip to content

Commit

Permalink
Fix #303450 MusicXML: Text in voice 2 not placed correctly
Browse files Browse the repository at this point in the history
Backport of musescore#7863, resp. duplicate of musescore#7870, part 3
  • Loading branch information
shoogle authored and Jojo-Schmitz committed Sep 23, 2021
1 parent 9d2280f commit c4343f7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions importexport/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4779,15 +4779,21 @@ static void directionMarker(XmlWriter& xml, const Marker* const m)
// findTrackForAnnotations
//---------------------------------------------------------

// An annotation is attached to the staff, with track set
// to the lowest track in the staff. Find a track for it
// (the lowest track in this staff that has a chord or rest)
// Annotations must be attached to chords or rests. If there is no chord or
// rest in the annotation's track then we must use a different track that
// does have a chord or a rest.

static int findTrackForAnnotations(int track, Segment* seg)
{
if (seg->segmentType() != SegmentType::ChordRest)
return -1;

if (seg->element(track))
return track; // able to use annotation's own track

// No chords or rests in the annotation's own track so look for chord and
// rests in the other tracks in this staff.

int staff = track / VOICES;
int strack = staff * VOICES; // start track of staff containing track
int etrack = strack + VOICES; // end track of staff containing track + 1
Expand Down

0 comments on commit c4343f7

Please sign in to comment.