示例#1
0
void Articulation::setSubtype(const QString& s)
      {
      if (s.isEmpty()) {
            qDebug("Articulation::setSubtype: empty subtype");
            setArticulationType(Articulation_Fermata);            // something to debug...
            return;
            }

      if (s[0].isDigit()) {         // for backward compatibility
            setArticulationType(ArticulationType(s.toInt()));
            return;
            }
      int st;
      for (st = 0; st < ARTICULATIONS; ++st) {
            if (articulationList[st].name == s)
                  break;
            }
      if (st == ARTICULATIONS) {
            struct {
                  const char* name;
                  bool up;
                  ArticulationType type;
                  } al[] = {
                  { "umarcato",         true,  Articulation_Marcato },
                  { "dmarcato",         false, Articulation_Marcato },
                  { "ufermata",         true,  Articulation_Fermata },
                  { "dfermata",         false, Articulation_Fermata },
                  { "ushortfermata",    true,  Articulation_Shortfermata },
                  { "dshortfermata",    false, Articulation_Shortfermata },
                  { "ulongfermata",     true,  Articulation_Longfermata },
                  { "dlongfermata",     false, Articulation_Longfermata },
                  { "uverylongfermata", true,  Articulation_Verylongfermata },
                  { "dverylongfermata", false, Articulation_Verylongfermata },
                  // watch out, bug in 1.2 uportato and dportato are reversed
                  { "dportato",         true,  Articulation_Portato },
                  { "uportato",         false, Articulation_Portato },
                  { "ustaccatissimo",   true,  Articulation_Staccatissimo },
                  { "dstaccatissimo",   false, Articulation_Staccatissimo }
                  };

            int i;
            int n = sizeof(al) / sizeof(*al);
            for (i = 0; i < n; ++i) {
                  if (s == al[i].name) {
                        _up = al[i].up;
                        _direction = (_up ? MScore::UP : MScore::DOWN);
                        st  = int(al[i].type);
                        break;
                        }
                  }
            if (i == n) {
                  st = 0;
                  qDebug("Articulation: unknown <%s>", qPrintable(s));
                  }
            }
      setArticulationType(ArticulationType(st));
      }
示例#2
0
void Articulation::read(XmlReader& e)
      {
      setArticulationType(ArticulationType::Fermata);    // default // backward compatibility (no type = ufermata in 1.2)
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "subtype")
                  setSubtype(e.readElementText());
            else if (tag == "channel") {
                  _channelName = e.attribute("name");
                  e.readNext();
                  }
            else if (tag == "anchor") {
                  _anchor = ArticulationAnchor(e.readInt());
                  anchorStyle = PropertyStyle::UNSTYLED;
                  }
            else if (tag == "direction")
                  setProperty(P_ID::DIRECTION, Ms::getProperty(P_ID::DIRECTION, e));
            else if ( tag == "ornamentStyle")
                  setProperty(P_ID::ORNAMENT_STYLE, Ms::getProperty(P_ID::ORNAMENT_STYLE, e));
            else if ( tag == "play")
                  setPlayArticulation(e.readBool());
            else if (tag == "timeStretch")
                  _timeStretch = e.readDouble();
            else if (tag == "offset") {
                  if (score()->mscVersion() > 114)
                        Element::readProperties(e);
                  else
                        e.skipCurrentElement(); // ignore manual layout in older scores
                  }
            else if (!Element::readProperties(e))
                  e.unknown();
            }
      }
示例#3
0
Articulation::Articulation(Score* s)
   : Element(s)
      {
      _direction = MScore::AUTO;
      _up = true;
      setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE);
      setArticulationType(Articulation_Fermata);
       }
Articulation::Articulation(Score* s)
   : Element(s)
      {
      _direction = MScore::Direction::AUTO;
      _up = true;
      setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE);
      setArticulationType(ArticulationType::Fermata);
       }
示例#5
0
Articulation::Articulation(Score* s)
   : Element(s)
      {
      _direction = MScore::Direction::AUTO;
      _up = true;
      setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE);
      setArticulationType(ArticulationType::Fermata);
      _ornamentStyle    = MScore::OrnamentStyle::DEFAULT;
      setPlayArticulation(true);
      }
示例#6
0
void Articulation::read(XmlReader& e)
      {
      setArticulationType(Articulation_Fermata);    // default // backward compatibility (no type = ufermata in 1.2)
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "subtype")
                  setSubtype(e.readElementText());
            else if (tag == "channel") {
                  _channelName = e.attribute("name");
                  e.readNext();
                  }
            else if (tag == "anchor")
                  _anchor = ArticulationAnchor(e.readInt());
            else if (tag == "direction") {
                  setProperty(P_DIRECTION, Ms::getProperty(P_DIRECTION, e));
                  }
            else if (tag == "timeStretch")
                  _timeStretch = e.readDouble();
            else if (!Element::readProperties(e))
                  e.unknown();
            }
      }
示例#7
0
void Articulation::setSubtype(const QString& s)
      {
      if (s.isEmpty()) {
            qDebug("Articulation::setSubtype: empty subtype");
            setArticulationType(ArticulationType::Fermata);            // something to debug...
            return;
            }

      if (s[0].isDigit()) {         // for backward compatibility
            setArticulationType(ArticulationType(s.toInt()));
            return;
            }
      int st;
      for (st = 0; st < int(ArticulationType::ARTICULATIONS); ++st) {
            if (articulationList[st].name == s)
                  break;
            }
      if (st == int(ArticulationType::ARTICULATIONS)) {
            struct {
                  const char* name;
                  bool up;
                  ArticulationType type;
                  } al[] = {
                  { "fadein",                 true,  ArticulationType::FadeIn },
                  { "fadeout",                true,  ArticulationType::FadeOut },
                  { "volumeswell",            true,  ArticulationType::VolumeSwell },
                  { "wigglesawtooth",         true,  ArticulationType::WiggleSawtooth },
                  { "wigglesawtoothwide",     true,  ArticulationType::WiggleSawtoothWide },
                  { "wigglevibratolargefaster",  true,  ArticulationType::WiggleVibratoLargeFaster },
                  { "wigglevibratolargeslowest", true,  ArticulationType::WiggleVibratoLargeSlowest },
                  { "umarcato",               true,  ArticulationType::Marcato },
                  { "dmarcato",               false, ArticulationType::Marcato },
                  { "ufermata",               true,  ArticulationType::Fermata },
                  { "dfermata",               false, ArticulationType::Fermata },
                  { "ushortfermata",          true,  ArticulationType::Shortfermata },
                  { "dshortfermata",          false, ArticulationType::Shortfermata },
                  { "ulongfermata",           true,  ArticulationType::Longfermata },
                  { "dlongfermata",           false, ArticulationType::Longfermata },
                  { "uverylongfermata",       true,  ArticulationType::Verylongfermata },
                  { "dverylongfermata",       false, ArticulationType::Verylongfermata },
                  // watch out, bug in 1.2 uportato and dportato are reversed
                  { "dportato",               true,  ArticulationType::Portato },
                  { "uportato",               false, ArticulationType::Portato },
                  { "ustaccatissimo",         true,  ArticulationType::Staccatissimo },
                  { "dstaccatissimo",         false, ArticulationType::Staccatissimo }
                  };

            int i;
            int n = sizeof(al) / sizeof(*al);
            for (i = 0; i < n; ++i) {
                  if (s == al[i].name) {
                        _up = al[i].up;
                        _direction = (_up ? MScore::Direction::UP : MScore::Direction::DOWN);
                        st  = int(al[i].type);
                        break;
                        }
                  }
            if (i == n) {
                  st = 0;
                  qDebug("Articulation: unknown <%s>", qPrintable(s));
                  }
            }
      setArticulationType(ArticulationType(st));
      }