//________________________________________________________________________ void notevisitor::print (ostream& out) const { if (isGrace()) out << "grace "; if (isCue()) out << "cue "; int type = getType(); if (type == kUndefinedType) out << "type undefined"; else if (type == kUnpitched) { out << "unpitched note - duration " << getDuration() << " "; } else if (type == kRest) { out << "rest - duration " << getDuration() << " "; } else if (type == kPitched) { out << "note " << getStep(); int alter = int(getAlter()); float diff = getAlter() - alter; if (diff >= 0.5) alter++; else if (diff <= -0.5) alter--; while (alter < 0) { out << 'b'; alter++; } while (alter > 0) { out << '#'; alter--; } out << getOctave() << " (" << getMidiPitch() << ")"; out << " - duration " << getDuration() << " "; } else out << "unknown type " << type << " "; if (inChord()) out << "in chord "; if (getTie() & StartStop::start) out << "- tie start "; if (getTie() & StartStop::stop) out << "- tie stop "; string instr = getInstrument(); if (!instr.empty()) out << "instrument " << instr << " "; if (getDynamics() >= 0) out << "dynamics " << getDynamics(); }
void ChordRest::writeProperties(Xml& xml) const { DurationElement::writeProperties(xml); // // Beam::Mode default: // REST - Beam::Mode::NONE // CHORD - Beam::Mode::AUTO // if ((type() == Element::Type::REST && _beamMode != Beam::Mode::NONE) || (type() == Element::Type::CHORD && _beamMode != Beam::Mode::AUTO)) { QString s; switch(_beamMode) { case Beam::Mode::AUTO: s = "auto"; break; case Beam::Mode::BEGIN: s = "begin"; break; case Beam::Mode::MID: s = "mid"; break; case Beam::Mode::END: s = "end"; break; case Beam::Mode::NONE: s = "no"; break; case Beam::Mode::BEGIN32: s = "begin32"; break; case Beam::Mode::BEGIN64: s = "begin64"; break; case Beam::Mode::INVALID: s = "?"; break; } xml.tag("BeamMode", s); } writeProperty(xml, P_ID::SMALL); if (actualDurationType().dots()) xml.tag("dots", actualDurationType().dots()); writeProperty(xml, P_ID::STAFF_MOVE); if (actualDurationType().isValid()) xml.tag("durationType", actualDurationType().name()); if (!duration().isZero() && (!actualDurationType().fraction().isValid() || (actualDurationType().fraction() != duration()))) xml.fTag("duration", duration()); foreach(const Articulation* a, _articulations) a->write(xml); #ifndef NDEBUG if (_beam && (MScore::testMode || !_beam->generated())) xml.tag("Beam", _beam->id()); #else if (_beam && !_beam->generated()) xml.tag("Beam", _beam->id()); #endif foreach(Lyrics* lyrics, _lyricsList) { if (lyrics) lyrics->write(xml); } if (!isGrace()) { Fraction t(globalDuration()); if (staff()) t *= staff()->timeStretch(xml.curTick); xml.curTick += t.ticks(); } }
void ChordRest::writeProperties(Xml& xml) const { DurationElement::writeProperties(xml); // // Beam::Mode default: // REST - Beam::Mode::NONE // CHORD - Beam::Mode::AUTO // if ((type() == Element::Type::REST && _beamMode != Beam::Mode::NONE) || (type() == Element::Type::CHORD && _beamMode != Beam::Mode::AUTO)) { QString s; switch(_beamMode) { case Beam::Mode::AUTO: s = "auto"; break; case Beam::Mode::BEGIN: s = "begin"; break; case Beam::Mode::MID: s = "mid"; break; case Beam::Mode::END: s = "end"; break; case Beam::Mode::NONE: s = "no"; break; case Beam::Mode::BEGIN32: s = "begin32"; break; case Beam::Mode::BEGIN64: s = "begin64"; break; case Beam::Mode::INVALID: s = "?"; break; } xml.tag("BeamMode", s); } writeProperty(xml, P_ID::SMALL); if (actualDurationType().dots()) xml.tag("dots", actualDurationType().dots()); writeProperty(xml, P_ID::STAFF_MOVE); if (actualDurationType().isValid()) xml.tag("durationType", actualDurationType().name()); if (!duration().isZero() && (!actualDurationType().fraction().isValid() || (actualDurationType().fraction() != duration()))) xml.fTag("duration", duration()); foreach(const Articulation* a, _articulations) a->write(xml); #ifndef NDEBUG if (_beam && (MScore::testMode || !_beam->generated())) xml.tag("Beam", _beam->id()); #else if (_beam && !_beam->generated()) xml.tag("Beam", _beam->id()); #endif foreach(Lyrics* lyrics, _lyricsList) { if (lyrics) lyrics->write(xml); } if (!isGrace()) { Fraction t(globalDuration()); if (staff()) t *= staff()->timeStretch(xml.curTick); xml.curTick += t.ticks(); } for (auto i : score()->spanner()) { // TODO: dont search whole list Spanner* s = i.second; if (s->generated() || s->type() != Element::Type::SLUR || !xml.canWrite(s)) continue; if (s->startElement() == this) { int id = xml.spannerId(s); xml.tagE(QString("Slur type=\"start\" id=\"%1\"").arg(id)); } else if (s->endElement() == this) { int id = xml.spannerId(s); xml.tagE(QString("Slur type=\"stop\" id=\"%1\"").arg(id)); } } }