Skip to content

Commit

Permalink
ENG-60: Move and hide additional fermatas
Browse files Browse the repository at this point in the history
When a fermata in a secondary voice is read, this commit adds handling
that moves it below the staff. Additionally, there is handling to hide
it if the duration of both voices is the same, or if there is also
already a fermata below the staff.

Duplicate of musescore#8509
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Mar 5, 2023
1 parent aa38265 commit d7962ee
Show file tree
Hide file tree
Showing 4 changed files with 1,324 additions and 0 deletions.
22 changes: 22 additions & 0 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,28 @@ static void addFermataToChord(const Notation& notation, ChordRest* cr)
cr->el().push_back(na); // store for later move to segment
else
cr->segment()->add(na);

// Move or hide fermata based on existing fermatas.
bool alreadyAbove = false;
bool alreadyBelow = false;
for (Element* e: cr->segment()->annotations()) {
if (e->isFermata() && e != na
&& e->staffIdx() == na->staffIdx() && e->track() != na->track()) {
Element* otherCr = cr->segment()->elist()[e->track()];
if (toFermata(e)->placement() == Placement::BELOW) alreadyBelow = true;
if (toFermata(e)->placement() == Placement::ABOVE) alreadyAbove = true;

if (direction.isEmpty() && alreadyAbove)
na->setPlacement(Placement::BELOW);
else if (direction.isEmpty() && alreadyBelow)
na->setPlacement(Placement::ABOVE);

if ((otherCr->isChord() && cr->isChord()
&& toChord(otherCr)->durationType() == toChord(cr)->durationType())
|| (alreadyAbove && alreadyBelow))
na->setVisible(false);
}
}
}

//---------------------------------------------------------
Expand Down
Loading

0 comments on commit d7962ee

Please sign in to comment.