From b294b6396505a0bc2fe4faf130964b06965c1ffb Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sat, 8 May 2021 13:26:32 +0200 Subject: [PATCH] Fix #320973: Support .cap and .capx import of (Griffschrift's) X-noteheads --- src/importexport/capella/internal/capella.cpp | 11 +++++++++-- src/importexport/capella/internal/capella.h | 1 + src/importexport/capella/internal/capxml.cpp | 10 ++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/importexport/capella/internal/capella.cpp b/src/importexport/capella/internal/capella.cpp index 0ddfb1da10a1e..b0e8b9220f6b2 100644 --- a/src/importexport/capella/internal/capella.cpp +++ b/src/importexport/capella/internal/capella.cpp @@ -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) { @@ -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); } } diff --git a/src/importexport/capella/internal/capella.h b/src/importexport/capella/internal/capella.h index 303d65088a9e4..65dd8bc72d090 100644 --- a/src/importexport/capella/internal/capella.h +++ b/src/importexport/capella/internal/capella.h @@ -605,6 +605,7 @@ struct CNote { signed char pitch; int explAlteration; // 1 force, 2 suppress int headType; + int headGroup; int alteration; int silent; }; diff --git a/src/importexport/capella/internal/capxml.cpp b/src/importexport/capella/internal/capxml.cpp index e8bb94b05b695..6618e799aacc7 100644 --- a/src/importexport/capella/internal/capxml.cpp +++ b/src/importexport/capella/internal/capxml.cpp @@ -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") { @@ -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);