• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Score类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TDuration

void TestMidi::midi02()
      {
      MCursor c;
      c.setTimeSig(Fraction(3,4));
      c.createScore("test2a");
      c.addPart("voice");
      c.move(0, 0);     // move to track 0 tick 0

      c.addKeySig(Key(2));
      c.addTimeSig(Fraction(3,4));
      c.addChord(60, TDuration(TDuration::DurationType::V_QUARTER));
      c.addChord(61, TDuration(TDuration::DurationType::V_QUARTER));
      c.addChord(62, TDuration(TDuration::DurationType::V_QUARTER));
      Score* score = c.score();

      score->doLayout();
      score->rebuildMidiMapping();
      c.saveScore();
      saveMidi(score, "test2.mid");

      Score* score2 = new Score(mscore->baseStyle());
      score2->setName("test2b");

      QCOMPARE(importMidi(score2, "test2.mid"), Score::FileError::FILE_NO_ERROR);

      score2->doLayout();
      score2->rebuildMidiMapping();
      MCursor c2(score2);
      c2.saveScore();

      QVERIFY(compareScores(score, score2));

      delete score;
      delete score2;
      }
开发者ID:jpirie,项目名称:MuseScore,代码行数:35,代码来源:tst_midi.cpp


示例2: readScore

void TestBarline::barline04()
      {
      Score* score = readScore(DIR + "barline04.mscx");
      QVERIFY(score);
      score->doLayout();

      score->startCmd();
      // 'go' to 5th measure
      Measure* msr = score->firstMeasure();
      for (int i=0; i < 4; i++)
            msr = msr->nextMeasure();
      // check span data of measure-initial start-repeat bar line
      Segment* seg = msr->findSegment(SegmentType::StartRepeatBarLine, msr->tick());
      QVERIFY2(seg != nullptr, "No SegStartRepeatBarLine segment in measure 5.");

      BarLine* bar = static_cast<BarLine*>(seg->element(0));
      QVERIFY2(bar != nullptr, "No start-repeat barline in measure 5.");

      bar->undoChangeProperty(Pid::BARLINE_SPAN, 2);
      bar->undoChangeProperty(Pid::BARLINE_SPAN_FROM, 2);
      bar->undoChangeProperty(Pid::BARLINE_SPAN_TO, 6);
      score->endCmd();

      QVERIFY2(bar->spanStaff() && bar->spanFrom() == 2 && bar->spanTo() == 6,
            "Wrong span data in start-repeat barline of measure 5.");

      // check start-repeat bar ine in second staff is gone
      QVERIFY2(seg->element(1) == nullptr, "Extra start-repeat barline in 2nd staff of measure 5.");

//      QVERIFY(saveCompareScore(score, "barline04.mscx", DIR + "barline04-ref.mscx"));
      delete score;
      }
开发者ID:Jojo-Schmitz,项目名称:MuseScore,代码行数:32,代码来源:tst_barline.cpp


示例3: QDialog

EditStaff::EditStaff(Staff* s, QWidget* parent)
   : QDialog(parent)
      {
      staff = s;
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

      Part* part = staff->part();
      instrument = *part->instr();
      Score* score = part->score();

      // hide string data controls if instrument has no strings
      stringDataFrame->setVisible(instrument.stringData() && instrument.stringData()->strings() > 0);
      fillStaffTypeCombo();
      small->setChecked(staff->small());
      invisible->setChecked(staff->invisible());
      spinExtraDistance->setValue(s->userDist() / score->spatium());
      color->setColor(s->color());
      partName->setText(part->partName());

      updateInstrument();

      connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(bboxClicked(QAbstractButton*)));
      connect(changeInstrument, SIGNAL(clicked()), SLOT(showInstrumentDialog()));
      connect(editShortName,    SIGNAL(clicked()), SLOT(editShortNameClicked()));
      connect(editLongName,     SIGNAL(clicked()), SLOT(editLongNameClicked()));
      connect(minPitchASelect,  SIGNAL(clicked()), SLOT(minPitchAClicked()));
      connect(maxPitchASelect,  SIGNAL(clicked()), SLOT(maxPitchAClicked()));
      connect(minPitchPSelect,  SIGNAL(clicked()), SLOT(minPitchPClicked()));
      connect(maxPitchPSelect,  SIGNAL(clicked()), SLOT(maxPitchPClicked()));
      connect(editStringData,   SIGNAL(clicked()), SLOT(editStringDataClicked()));
      }
开发者ID:MmAlder,项目名称:MuseScore,代码行数:32,代码来源:editstaff.cpp


示例4: TDuration

void TestMidi::midi3()
      {
      MCursor c;
      c.createScore("test3a");
      c.addPart("voice");
      c.move(0, 0);     // move to track 0 tick 0

      c.addKeySig(1);
      c.addTimeSig(Fraction(4,4));
      c.addChord(60, TDuration(TDuration::V_QUARTER));
      c.addChord(61, TDuration(TDuration::V_QUARTER));
      c.addChord(62, TDuration(TDuration::V_QUARTER));
      c.addChord(63, TDuration(TDuration::V_QUARTER));
      Score* score = c.score();

      score->doLayout();
      score->rebuildMidiMapping();
      c.saveScore();
      saveMidi(score, "test3.mid");

      Score* score2 = new Score(mscore->baseStyle());
      score2->setName("test3b");
      QVERIFY(importMidi(score2, "test3.mid"));

      score2->doLayout();
      score2->rebuildMidiMapping();
      MCursor c2(score2);
      c2.saveScore();

      QVERIFY(compareScores(score, score2));

      delete score;
      delete score2;
      }
开发者ID:coliveira,项目名称:MuseScore,代码行数:34,代码来源:tst_midi.cpp


示例5: unitTests

void unitTests() {

    HighScore scores;
    scores.addScore("Robert", 10);
    scores.addScore("Phillip", 30);
    scores.addScore("Michael", 20);
    Score* s = scores.getScores().at(0);

    assert(s->getName() == "Phillip");
    scores.addScore("Rebecca", 5);
    s = scores.getScores().back();
    assert(s->getName() == "Rebecca");
    scores.save();

    HighScore testScores;
    testScores.load();
    testScores.addScore("Rhonda", 65);
    s = testScores.getScores().at(0);

    assert(s->getName() == "Rhonda");
    assert(s->getScore() == 65);
    testScores.save();
    remove ("highscores.txt");

    //model test for starting a new game.
    Model::instance()->singleGameStart("easy", false);
    assert(Model::instance()->getById(0) != NULL);

    assert(Model::instance()->load());
}
开发者ID:DomtronVox,项目名称:space-factory,代码行数:30,代码来源:mainwindow.cpp


示例6: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //populate highscores list
    HighScore* scores = new HighScore();
    if(scores->load()){
        for(unsigned int i = 0; i < scores->getScores().size(); ++i ) {
            Score *score = scores->getScores().at(i);
            QString QName = QString::fromStdString(score->getName());
            QString QScore = QString::number(score->getScore());
            ui->lstScores->addItem(QName + " -- " + QScore);

        }
    }
    else                //no file exists
        scores->save(); //creates new highscores file file

    //connect(ui->btnNewGame, SIGNAL(click()), this, SLOT(openGameWindow()));
    //set the help and score screens to be invisible
    ui->brwHelp->hide();
    ui->boxHighScores->hide();
}
开发者ID:DomtronVox,项目名称:space-factory,代码行数:25,代码来源:mainwindow.cpp


示例7: xknm

double HyperGeoTotalCache::log2Tail (int x, int k, int n, int m, 
                                    ScoreParameters** p)
{
   XKNM xknm (x, k, n, m);
   Score* cachedScore = _cache->find (xknm);
   if (cachedScore == NULL) {
      //
      // 
      double score = 
         HyperGeometric::logTailhyge (x, m, k, n);

      //
      // change from ln to 2-base log
      static const double LN_2 = ::log (static_cast <double> (2));
      double log2score = score / LN_2;

      cachedScore = new Score (xknm, log2score); 
      _cache->add (cachedScore);
   }

   if (p != NULL)
      *p = cachedScore;
   
   return cachedScore->score ();
}
开发者ID:BackupTheBerlios,项目名称:snap-svn,代码行数:25,代码来源:HyperGeoCache.cpp


示例8: convert

void PowerTabOldImporter::load(const boost::filesystem::path &filename,
                               Score &score)
{
    PowerTabDocument::Document document;
    document.Load(filename);

    // TODO - handle font settings, etc.
    ScoreInfo info;
    convert(document.GetHeader(), info);
    score.setScoreInfo(info);
    score.setLineSpacing(document.GetTablatureStaffLineSpacing());
    ScoreUtils::addStandardFilters(score);
    
    assert(document.GetNumberOfScores() == 2);

    // Convert the guitar score.
    Score guitarScore;
    convert(*document.GetScore(0), guitarScore);

    // Convert and then merge the bass score.
    Score bassScore;
    convert(*document.GetScore(1), bassScore);
    ScoreMerger::merge(score, guitarScore, bassScore);

    // Reformat the score, since the guitar and bass score from v1.7 may have
    // had different spacing.
    ScoreUtils::polishScore(score);
}
开发者ID:powertab,项目名称:powertabeditor,代码行数:28,代码来源:powertaboldimporter.cpp


示例9: Satisfy

bool FilterCriteria::Satisfy(const DNALength& alnLength, const float& pctSimilarity,
                             const float& pctAccuracy, const Score& score) const
{
    if (alnLength < _minAlnLength) {
        if (_verbose > 0)
            std::cout << "Alignment length " << alnLength << " is too short." << std::endl;
        return false;
    }
    if (pctSimilarity < _minPctSimilarity) {
        if (_verbose > 0)
            std::cout << "Percentage similarity " << pctSimilarity << " is too low." << std::endl;
        return false;
    }
    if (pctAccuracy < _minPctAccuracy) {
        if (_verbose > 0)
            std::cout << "Percentage accuracy " << pctAccuracy << " is too low." << std::endl;
        return false;
    }
    if (_useScore and not score.BetterThanOrEqual(_scoreCutoff)) {
        if (_verbose)
            std::cout << "Alignment score " << score.Value() << " worse than cut off." << std::endl;
        return false;
    }

    return true;
}
开发者ID:PacificBiosciences,项目名称:blasr_libcpp,代码行数:26,代码来源:FilterCriteria.cpp


示例10: readScore

void TestSpanners::spanners05()
{
    MasterScore* score = readScore(DIR + "glissando-cloning02.mscx");
    QVERIFY(score);
    score->doLayout();

    // create parts
    // (copied and adapted from void TestParts::createParts() in mtest/libmscore/parts/tst_parts.cpp)
    QList<Part*> parts;
    parts.append(score->parts().at(0));
    Score* nscore = new Score(score);

    Excerpt ex(score);
    ex.setPartScore(nscore);
    ex.setTitle(parts.front()->longName());
    ex.setParts(parts);
    ::createExcerpt(&ex);
    QVERIFY(nscore);

    nscore->setName(parts.front()->partName());
    score->undo(new AddExcerpt(nscore));

    QVERIFY(saveCompareScore(score, "glissando-cloning02.mscx", DIR + "glissando-cloning02-ref.mscx"));
    delete score;
}
开发者ID:sidewayss,项目名称:MuseScore,代码行数:25,代码来源:tst_spanners.cpp


示例11: detectSwing

void detectSwing(Staff *staff, MidiOperation::Swing swingType)
      {
      Score *score = staff->score();
      const int strack = staff->idx() * VOICES;
      SwingDetector swingDetector(swingType);

      for (Segment *seg = score->firstSegment(Segment::SegChordRest); seg;
                                      seg = seg->next1(Segment::SegChordRest)) {
            for (int voice = 0; voice < VOICES; ++voice) {
                  ChordRest *cr = static_cast<ChordRest *>(seg->element(strack + voice));
                  if (!cr)
                        continue;
                  swingDetector.add(cr);
                  }
            }
      if (swingDetector.wasSwingApplied()) {
                        // add swing label to the score
            StaffText* st = new StaffText(score);
            st->setTextStyleType(TEXT_STYLE_STAFF);
            st->setText(swingCaption(swingType));
            Segment* seg = score->firstSegment(Segment::SegChordRest);
            st->setParent(seg);
            st->setTrack(strack);   // voice == 0
            score->addElement(st);
            }
      }
开发者ID:BlueMockingbird,项目名称:MuseScore,代码行数:26,代码来源:importmidi_swing.cpp


示例12: createTupletNotes

void createTupletNotes(
            Staff *staff,
            const std::multimap<ReducedFraction, TupletData> &tuplets)
      {
      Score* score = staff->score();
      const int track = staff->idx() * VOICES;

      for (const auto &tupletEvent: tuplets) {
            const auto &tupletData = tupletEvent.second;
            if (tupletData.elements.empty())
                  continue;

            Tuplet* tuplet = new Tuplet(score);
            const auto &tupletRatio = tupletLimits(tupletData.tupletNumber).ratio;
            tuplet->setRatio(tupletRatio.fraction());

            tuplet->setDuration(tupletData.len.fraction());
            const TDuration baseLen = tupletData.len.fraction() / tupletRatio.denominator();
            tuplet->setBaseLen(baseLen);

            tuplet->setTrack(track);
            tuplet->setTick(tupletData.onTime.ticks());
            tuplet->setVoice(tupletData.voice);
            Measure* measure = score->tick2measure(tupletData.onTime.ticks());
            tuplet->setParent(measure);

            for (DurationElement *el: tupletData.elements) {
                  tuplet->add(el);
                  el->setTuplet(tuplet);
                  }
            }
      }
开发者ID:Angeldude,项目名称:MuseScore,代码行数:32,代码来源:importmidi_tuplet_tonotes.cpp


示例13: printEmptyLine

void Table::printTable()
{
	printEmptyLine();
	printHouseNamesLine();
	for (int i = 0; i < n; i++) {
		string line("");
		line += (algoNames[i].size() >= PLACE_FOR_ALGO) ? SEPRATE_CHAR + algoNames[i].substr(0, PLACE_FOR_ALGO)
			: SEPRATE_CHAR + algoNames[i] + string(PLACE_FOR_ALGO - algoNames[i].size(), ' ');
		int sum = 0;
		for (int j = 0; j < m; j++) {
			Score score = robots[j*n + i]->getScore();
			int result = score.calcResult();
			sum += result;
			string res = std::to_string(result);
			int placeForSpaces = PLACE_FOR_HOUSE - res.size();
			line += SEPRATE_CHAR + string(placeForSpaces, ' ') +res;
		}
		double avg=sum/(double)m;
		string res = std::to_string(avg);
		int placeForSpace = PLACE_FOR_HOUSE - res.size() + 4; //because we want 2 digit and to_string is 6 digit
		line += SEPRATE_CHAR + string(placeForSpace, ' ') + res.substr(0,res.size() - 4) + SEPRATE_CHAR;
		printEmptyLine();
		cout << line << endl;
	}
	printEmptyLine();
}
开发者ID:rotemga,项目名称:ex2_cpp,代码行数:26,代码来源:Table.cpp


示例14: collision

bool Snake::collision(Score& _hScore)
{
	// Snake eats the bait
	if(Pixels[0]->getFrontDot() == food.getFrontDot())
	{
		_hScore.addScore();
		_hScore.levelControl();
		addPixel();
		feedRefresh();
	}


	// If the snake hits the tail
	for(int i=1; i<numberOfPixel; i++)
	{
		if(	Pixels[0]->getFrontDot() == Pixels[i]->getFrontDot() )
			return true;
	}


	// If the snake hits the wall
	if(		Pixels[0]->getFrontDot().getX() >= 0 && Pixels[0]->getFrontDot().getX() < 800
		&&	Pixels[0]->getFrontDot().getY() >= 0 && Pixels[0]->getFrontDot().getY() < 540 )
	{
		return false;
	}
	else
		return true;
}
开发者ID:ByNeo,项目名称:Snake2D,代码行数:29,代码来源:Snake.cpp


示例15: readScore

Score* TestInstrumentChange::test_pre(const char* p)
      {
      QString p1 = DIR + p + ".mscx";
      Score* score = readScore(p1);
      score->doLayout();
      return score;
      }
开发者ID:AdrianShe,项目名称:MuseScore,代码行数:7,代码来源:tst_instrumentchange.cpp


示例16: Score

ScorePanel::ScorePanel()
{
    sf::Vector2u const& windowSize = sGame->GetWindow()->getSize();
    const float cellSize = (float)windowSize.x / 24;

    // Create scores
    const uint16 beginScore = (uint16)eScores::START + 1;
    const uint16 endScore = (uint16)eScores::END;
    for (uint16 i = beginScore; i < endScore; ++i)
    {
        Score* score = new Score((eScores)i, 0);

        // set basic position
        if (i == beginScore)
        {
            const float y = windowSize.y - (cellSize * 1.25f);
            score->GetText()->setPosition(cellSize, y);
        }
        else
        {
            // back text value position 
            Score* prevScore = m_scores.back();
            // set x to backscore + (cell size * 2)
            float posX = prevScore->GetValueText()->getPosition().x + (cellSize * 2);
            float posY = prevScore->GetValueText()->getPosition().y;

            score->GetText()->setPosition(sf::Vector2f(posX, posY));
        }

        CorrectValuePosition(score);
        m_scores.push_back(score);
    }
}
开发者ID:rescr1pt,项目名称:simplebubble,代码行数:33,代码来源:PlayScene.cpp


示例17: visible

void MeasureProperties::apply()
      {
      Score* score = m->score();

      for (int staffIdx = 0; staffIdx < score->nstaves(); ++staffIdx) {
            MStaff* ms = m->mstaff(staffIdx);
            bool v = visible(staffIdx);
            bool s = slashStyle(staffIdx);
            if (ms->visible() != v || ms->slashStyle() != s)
                  score->undo(new ChangeMStaffProperties(ms, v, s));
            }

      m->undoChangeProperty(P_ID::REPEAT_COUNT, repeatCount());
      m->undoChangeProperty(P_ID::BREAK_MMR, breakMultiMeasureRest->isChecked());
      m->undoChangeProperty(P_ID::USER_STRETCH, layoutStretch->value());
      m->undoChangeProperty(P_ID::MEASURE_NUMBER_MODE, measureNumberMode->currentIndex());
      m->undoChangeProperty(P_ID::NO_OFFSET, measureNumberOffset->value());
      m->undoChangeProperty(P_ID::IRREGULAR, isIrregular());

      if (m->len() != len()) {
            ScoreRange range;
            range.read(m->first(), m->last());
            if (range.canWrite(len()))
                  m->adjustToLen(len());
            else if (!MScore::noGui) {
                  QMessageBox::warning(0,
                     QT_TRANSLATE_NOOP("MeasureProperties", "MuseScore"),
                     QT_TRANSLATE_NOOP("MeasureProperties", "cannot change measure length:\n"
                     "tuplet would cross measure")
                     );
                  }
            }
      score->update();
      }
开发者ID:eplanet,项目名称:MuseScore,代码行数:34,代码来源:measureproperties.cpp


示例18: viewSplitter

QSplitter* ScoreTab::viewSplitter(int n) const
{
    TabScoreView* tsv = static_cast<TabScoreView*>(tab->tabData(n).value<void*>());
    if (tsv == 0) {
        // qDebug("ScoreTab::viewSplitter %d is zero", n);
        return 0;
    }
    Score* score = tsv->score;
    if (tsv->part) {
        QList<Excerpt*>& excerpts = score->excerpts();
        if (!excerpts.isEmpty() && ((tsv->part - 1) < excerpts.size()))
            score = excerpts.at(tsv->part - 1)->partScore();
    }

    int nn = stack->count();
    for (int i = 0; i < nn; ++i) {
        QSplitter* sp = static_cast<QSplitter*>(stack->widget(i));
        if (sp->count() == 0)
            return 0;
        ScoreView* v = static_cast<ScoreView*>(sp->widget(0));
        if (v->score() == score)
            return sp;
    }
    return 0;
}
开发者ID:flelax,项目名称:MuseScore,代码行数:25,代码来源:scoretab.cpp


示例19: BetterThan

bool Score::BetterThan(const Score& another) const
{
    if (this->_value == another.Value()) return false;
    if (this->_sign == ScoreSign::POSITIVE)
        return (this->_value > another.Value());
    else
        return (this->_value < another.Value());
}
开发者ID:PacificBiosciences,项目名称:blasr_libcpp,代码行数:8,代码来源:FilterCriteria.cpp


示例20: convertGuitarIns

void PowerTabOldImporter::convertGuitarIns(
        const PowerTabDocument::Score &oldScore, Score &score)
{
    // For each guitar, keep track of its current staff.
    std::array<int, PowerTabDocument::Score::MAX_NUM_GUITARS> activePlayers;
    activePlayers.fill(-1);

    for (size_t i = 0; i < oldScore.GetSystemCount(); ++i)
    {
        std::vector<PowerTabDocument::Score::GuitarInPtr> guitarIns;
        oldScore.GetGuitarInsInSystem(guitarIns, oldScore.GetSystem(i));
        if (guitarIns.empty())
            continue;

        size_t currentPosition = guitarIns.front()->GetPosition();

        // In v1.7, each staff has separate guitar ins. In the new format,
        // player changes occur at the system level so we need to combine
        // the guitar ins from several staves.
        for (auto &guitarIn : guitarIns)
        {
            // For now, ignore guitar ins that only affect rhythm slashes.
            if (!guitarIn->HasStaffGuitarsSet())
                continue;

            // After combining all guitar in's at a position, write out a player
            // change.
            if (guitarIn->GetPosition() != currentPosition)
            {
                score.getSystems()[i].insertPlayerChange(getPlayerChange(
                    activePlayers, static_cast<int>(currentPosition)));
            }

            // Clear out any players that are currently active for this staff.
            const int staff = guitarIn->GetStaff();
            for (auto &activePlayer : activePlayers)
            {
                if (activePlayer == staff)
                    activePlayer = -1;
            }

            // Set the active players for this staff.
            std::bitset<8> activeGuitars(guitarIn->GetStaffGuitars());
            for (size_t k = 0; k < activePlayers.size(); ++k)
            {
                if (activeGuitars[k])
                    activePlayers[k] = staff;
            }

            currentPosition = guitarIn->GetPosition();
        }

        // After processing all of the guitar ins in the system, write out a
        // final player change.
        score.getSystems()[i].insertPlayerChange(
            getPlayerChange(activePlayers, static_cast<int>(currentPosition)));
    }
}
开发者ID:powertab,项目名称:powertabeditor,代码行数:58,代码来源:powertaboldimporter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ScoreComponentCollection类代码示例发布时间:2022-05-31
下一篇:
C++ ScopedPrinter类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap