Skip to content

Commit

Permalink
Implementation for issue humdrum-tools/verovio-humdrum-viewer#839
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Sep 24, 2023
1 parent bc40ea9 commit 7d7569a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/iohumdrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5604,13 +5604,16 @@ void HumdrumInput::fillStaffInfo(hum::HTp staffstart, int staffnumber, int staff
if (part->compare(0, 5, "*clef") == 0) {
if (cleftok) {
if (clef == *part) {
// there is already a clef found, and it is the same
// There is already a clef found, and it is the same
// as this one, so ignore the second one.
}
else {
// mark clef as a clef change to print in the layer
part->setValue("auto", "clefChange", 1);
markOtherClefsAsChange(part);
// Mark clef as a clef change to print in the layer:
if (part->isKern()) {
// Don't mark as clef change in **mens.
part->setValue("auto", "clefChange", 1);
markOtherClefsAsChange(part);
}
}
part = part->getNextToken();
continue;
Expand All @@ -5621,7 +5624,7 @@ void HumdrumInput::fillStaffInfo(hum::HTp staffstart, int staffnumber, int staff
cleftok = part;
}
else if (part->find("clefX") != std::string::npos) {
// allow percussion clef to not have a line number since it is unpitched.
// Allow percussion clef to not have a line number since it is unpitched.
clef = *part;
cleftok = part;
}
Expand Down Expand Up @@ -29392,7 +29395,6 @@ void HumdrumInput::markAdjacentNullsWithClef(hum::HTp clef)

void HumdrumInput::markOtherClefsAsChange(hum::HTp clef)
{

int ctrack = clef->getTrack();
int track;

Expand Down

1 comment on commit 7d7569a

@craigsapp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 7d7569a fixes the clef doubling. The problem is that the second clef was being treated as a clef change. In **mens data this should not be necessary, so the clef change was short circuited. In the future if real clef changes are not working, then add an additional check to suppress clef changes of there is zero durations between the starting clef and the original clef (these sorts of clef changes are needed in **kern data). Also *oclef and *clef should not mix when otherwise calculating clef changes, which can be another check.

Please sign in to comment.