当前位置: 首页>>代码示例>>C++>>正文


C++ Lyrics::setText方法代码示例

本文整理汇总了C++中Lyrics::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ Lyrics::setText方法的具体用法?C++ Lyrics::setText怎么用?C++ Lyrics::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lyrics的用法示例。


在下文中一共展示了Lyrics::setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: d

int GuitarPro5::readBeat(int tick, int voice, Measure* measure, int staffIdx, Tuplet** tuplets, bool /*mixChange*/)
      {
      uchar beatBits = readUChar();
      bool dotted    = beatBits & BEAT_DOTTED;

      slide = -1;
      int track = staffIdx * VOICES + voice;
      if (slides.contains(track))
            slide = slides.take(track);

      int pause = -1;
      if (beatBits & BEAT_PAUSE)
            pause = readUChar();

      // readDuration
      int len   = readChar();
      int tuple = 0;
      if (beatBits & BEAT_TUPLET)
            tuple = readInt();

      Segment* segment = measure->getSegment(Segment::Type::ChordRest, tick);
      if (beatBits & BEAT_CHORD) {
            int numStrings = score->staff(staffIdx)->part()->instr()->stringData()->strings();
            skip(17);
            QString name = readPascalString(21);
            skip(4);
            // no header to be read in the GP5 format - default to true.
            readChord(segment, staffIdx * VOICES, numStrings, name, true);
            skip(32);
            }
      Lyrics* lyrics = 0;
      if (beatBits & BEAT_LYRICS) {
            QString txt = readDelphiString();
            lyrics = new Lyrics(score);
            lyrics->setText(txt);
            }
      gpLyrics.beatCounter++;
      if (gpLyrics.beatCounter >= gpLyrics.fromBeat && gpLyrics.lyricTrack == staffIdx+1) {
            int index = gpLyrics.beatCounter - gpLyrics.fromBeat;
            if (index < gpLyrics.lyrics.size()) {
                  lyrics = new Lyrics(score);
                  lyrics->setText(gpLyrics.lyrics[index]);
                  }
            }
      int beatEffects = 0;
      if (beatBits & BEAT_EFFECTS)
            beatEffects = readBeatEffects(track, segment);

      if (beatBits & BEAT_MIX_CHANGE)
            readMixChange(measure);

      int strings = readUChar();   // used strings mask

      Fraction l    = len2fraction(len);

      // Some beat effects could add a Chord before this
      ChordRest* cr = segment->cr(track);
      if (voice != 0 && pause == 0 && strings == 0)
            cr = 0;
      else {
            if (strings == 0) {
                  if (cr) {
                        segment->remove(cr);
                        delete cr;
                        cr = 0;
                        }
                  cr = new Rest(score);
                  }
            else  {
                  if (!cr)
                        cr = new Chord(score);
                  }
            cr->setTrack(track);

            TDuration d(l);
            d.setDots(dotted ? 1 : 0);

            if (dotted)
                  l = l + (l/2);

            if (tuple) {
                  Tuplet* tuplet = tuplets[staffIdx * 2 + voice];
                  if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
                        tuplet = new Tuplet(score);
                        // int track = staffIdx * 2 + voice;
                        tuplets[staffIdx * 2 + voice] = tuplet;
                        tuplet->setTrack(cr->track());
                        setTuplet(tuplet, tuple);
                        tuplet->setParent(measure);
                        }
                  tuplet->setTrack(cr->track());
                  tuplet->setBaseLen(l);
                  tuplet->setDuration(l * tuplet->ratio().denominator());
                  cr->setTuplet(tuplet);
                  tuplet->add(cr);
                  }

            cr->setDuration(l);
            if (cr->type() == Element::Type::REST && (pause == 0 || l == measure->len()))
                  cr->setDurationType(TDuration::DurationType::V_MEASURE);
//.........这里部分代码省略.........
开发者ID:jpirie,项目名称:MuseScore,代码行数:101,代码来源:importgtp-gp5.cpp

示例2: readNote


//.........这里部分代码省略.........
            closeSlur(1, tick, staff, voice);
        else if (an[i] == '{')
            openSlur(2, tick, staff, voice);
        else if (an[i] == '}')
            closeSlur(2, tick, staff, voice);
        else if (an[i] == 'z')
            openSlur(3, tick, staff, voice);
        else if (an[i] == 'x')
            closeSlur(3, tick, staff, voice);
        else if (an[i] == '.') {
            Articulation* atr = new Articulation(score);
            atr->setArticulationType(Articulation_Staccato);
            chord->add(atr);
        }
        else if (an[i] == '_') {
            Articulation* atr = new Articulation(score);
            atr->setArticulationType(Articulation_Tenuto);
            chord->add(atr);
        }
        else if (an[i] == 'v') {
            Articulation* atr = new Articulation(score);
            atr->setArticulationType(Articulation_Upbow);
            chord->add(atr);
        }
        else if (an[i] == 'n') {
            Articulation* atr = new Articulation(score);
            atr->setArticulationType(Articulation_Downbow);
            chord->add(atr);
        }
        else if (an[i] == 't') {
            Articulation* atr = new Articulation(score);
            atr->setArticulationType(Articulation_Trill);
            chord->add(atr);
        }
        else if (an[i] == 'F') {
            Articulation* atr = new Articulation(score);
            atr->setUp(true);
            atr->setArticulationType(Articulation_Fermata);
            chord->add(atr);
        }
        else if (an[i] == 'E') {
            Articulation* atr = new Articulation(score);
            atr->setUp(false);
            atr->setArticulationType(Articulation_Fermata);
            chord->add(atr);
        }
        else if (an[i] == 'O') {
            // Articulation* atr = new Articulation(score);
            // atr->setArticulationType(Articulation_Downbow);
            // chord->add(atr);
            qDebug("%06d: open string '%c' not implemented", tick, an[i].toLatin1());
        }
        else if (an[i] == '&') {
            // skip editorial level
            if (i <= an.size() && an[i+1].isDigit())
                ++i;
        }
        else if (an[i] == 'p')
            dynamics += "p";
        else if (an[i] == 'm')
            dynamics += "m";
        else if (an[i] == 'f')
            dynamics += "f";
        else if (an[i] == '-')        // tie
            ;
        else if (an[i] == '*')        // start tuplet
            ;
        else if (an[i] == '!')        // stop tuplet
            ;
        else if (an[i] == '+')        // cautionary accidental
            ;
        else if (an[i] == 'X')        // ???
            ;
        else if (an[i] == ' ')
            ;
        else {
            qDebug("%06d: notation '%c' not implemented", tick, an[i].toLatin1());
        }
    }
    if (!dynamics.isEmpty()) {
        Dynamic* dyn = new Dynamic(score);
        dyn->setDynamicType(dynamics);
        dyn->setTrack(gstaff * VOICES);
        Segment* s = measure->getSegment(Segment::SegChordRest, tick);
        s->add(dyn);
    }

    QString txt = s.mid(43, 36);
    if (!txt.isEmpty()) {
        QStringList sl = txt.split("|");
        int no = 0;
        foreach(QString w, sl) {
            w = diacritical(w);
            Lyrics* l = new Lyrics(score);
            l->setText(w);
            l->setNo(no++);
            l->setTrack(gstaff * VOICES);
            Segment* segment = measure->tick2segment(tick);
            segment->add(l);
        }
开发者ID:joergsichermann,项目名称:MuseScore,代码行数:101,代码来源:musedata.cpp


注:本文中的Lyrics::setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。