Skip to content

Commit

Permalink
Fix #320973: Support .cap and .capx import of (Griffschrift's) X-note…
Browse files Browse the repository at this point in the history
…heads
  • Loading branch information
Jojo-Schmitz authored and vpereverzev committed May 25, 2021
1 parent 3049f72 commit b294b63
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/importexport/capella/internal/capella.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const

chord->add(note);
note->setPitch(pitch);
note->setHeadGroup(NoteHead::Group(n.headGroup));
// TODO: compute tpc from pitch & line
note->setTpcFromPitch();
if (o->rightTie) {
Expand Down Expand Up @@ -2053,13 +2054,19 @@ void ChordObj::read()
}
unsigned char b = cap->readByte();
n.headType = b & 7;
if (n.headType == 6) {
n.headType = 0;
n.headGroup = int(NoteHead::Group::HEAD_CROSS);
} else {
n.headGroup = int(NoteHead::Group::HEAD_NORMAL);
}
n.alteration = ((b >> 3) & 7) - 2; // -2 -- +2
if (b & 0x40) {
n.explAlteration = 1;
}
n.silent = b & 0x80;
qDebug("ChordObj::read() note pitch %d explAlt %d head %d alt %d silent %d",
n.pitch, n.explAlteration, n.headType, n.alteration, n.silent);
qDebug("ChordObj::read() note pitch %d explAlt %d head group %d %d alt %d silent %d",
n.pitch, n.explAlteration, n.headType, n.headGroup, n.alteration, n.silent);
notes.append(n);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/importexport/capella/internal/capella.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ struct CNote {
signed char pitch;
int explAlteration; // 1 force, 2 suppress
int headType;
int headGroup;
int alteration;
int silent;
};
Expand Down
10 changes: 8 additions & 2 deletions src/importexport/capella/internal/capxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ void ChordObj::readCapxNotes(XmlReader& e)
if (e.name() == "head") {
QString pitch = e.attribute("pitch");
QString sstep;
QString shape = e.attribute("shape");
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "alter") {
Expand All @@ -494,13 +495,18 @@ void ChordObj::readCapxNotes(XmlReader& e)
e.unknown();
}
}
qDebug("ChordObj::readCapxNotes: pitch '%s' altstep '%s'",
qPrintable(pitch), qPrintable(sstep));
qDebug("ChordObj::readCapxNotes: pitch '%s' altstep '%s' shape '%s'",
qPrintable(pitch), qPrintable(sstep), qPrintable(shape));
int istep = sstep.toInt();
CNote n;
n.pitch = pitchStr2Char(pitch);
n.explAlteration = 0;
n.headType = 0;
if (shape == "none") {
n.headGroup = int(NoteHead::Group::HEAD_CROSS);
} else {
n.headGroup = int(NoteHead::Group::HEAD_NORMAL);
}
n.alteration = istep;
n.silent = 0;
notes.append(n);
Expand Down

0 comments on commit b294b63

Please sign in to comment.