本文整理汇总了C++中MasterScore::inputState方法的典型用法代码示例。如果您正苦于以下问题:C++ MasterScore::inputState方法的具体用法?C++ MasterScore::inputState怎么用?C++ MasterScore::inputState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterScore
的用法示例。
在下文中一共展示了MasterScore::inputState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noteLimits
void TestNote::noteLimits()
{
MasterScore* score = readScore(DIR + "empty.mscx");
score->inputState().setTrack(0);
score->inputState().setSegment(score->tick2segment(0, false, Segment::Type::ChordRest));
score->inputState().setDuration(TDuration::DurationType::V_QUARTER);
score->inputState().setNoteEntryMode(true);
// over 127 shouldn't crash
score->cmdAddPitch(140, false, false);
// below 0 shouldn't crash
score->cmdAddPitch(-40, false, false);
// stack chords
score->cmdAddPitch(42, false, false);
for (int i = 1; i < 20; i++)
score->cmdAddPitch(42 + i * 7, true, false);
// interval below
score->cmdAddPitch(42, false, false);
for (int i = 0; i < 20; i++) {
std::vector<Note*> nl = score->selection().noteList();
score->cmdAddInterval(-8, nl);
}
// interval above
score->cmdAddPitch(42, false, false);
for (int i = 0; i < 20; i++) {
std::vector<Note*> nl = score->selection().noteList();
score->cmdAddInterval(8, nl);
}
QVERIFY(saveCompareScore(score, "notelimits-test.mscx", DIR + "notelimits-ref.mscx"));
}
示例2: readScore
void TestNote::tpcTranspose2()
{
MasterScore* score = readScore(DIR + "tpc-transpose2.mscx");
score->inputState().setTrack(0);
score->inputState().setSegment(score->tick2segment(0, false, Segment::Type::ChordRest));
score->inputState().setDuration(TDuration::DurationType::V_QUARTER);
score->inputState().setNoteEntryMode(true);
int octave = 5 * 7;
score->cmdAddPitch(octave + 3, false, false);
score->startCmd();
score->cmdConcertPitchChanged(true, true);
score->endCmd();
printf("================\n");
QVERIFY(saveCompareScore(score, "tpc-transpose2-test.mscx", DIR + "tpc-transpose2-ref.mscx"));
}
示例3: tpc
void TestNote::tpc()
{
MasterScore* score = readScore(DIR + "tpc.mscx");
score->inputState().setTrack(0);
score->inputState().setSegment(score->tick2segment(0, false, Segment::Type::ChordRest));
score->inputState().setDuration(TDuration::DurationType::V_QUARTER);
score->inputState().setNoteEntryMode(true);
int octave = 5 * 7;
score->cmdAddPitch(octave + 1, false, false);
score->cmdAddPitch(octave + 2, false, false);
score->cmdAddPitch(octave + 3, false, false);
score->cmdAddPitch(octave + 4, false, false);
score->cmdAddPitch(octave + 5, false, false);
score->cmdAddPitch(octave + 6, false, false);
score->cmdAddPitch(octave + 7, false, false);
score->cmdAddPitch(octave + 8, false, false);
score->cmdConcertPitchChanged(true, true);
QVERIFY(saveCompareScore(score, "tpc-test.mscx", DIR + "tpc-ref.mscx"));
}
示例4: editInstrList
void MuseScore::editInstrList()
{
if (cs == 0)
return;
if (!instrList)
instrList = new InstrumentsDialog(this);
else if (instrList->isVisible()) {
instrList->done(0);
return;
}
instrList->init();
MasterScore* masterScore = cs->masterScore();
instrList->genPartList(masterScore);
masterScore->startCmd();
masterScore->deselectAll();
int rv = instrList->exec();
if (rv == 0) {
masterScore->endCmd();
return;
}
ScoreView* csv = currentScoreView();
if (csv && csv->noteEntryMode()) {
csv->cmd(getAction("escape"));
qApp->processEvents();
updateInputState(csv->score());
}
masterScore->inputState().setTrack(-1);
// keep the keylist of the first pitched staff to apply it to new ones
KeyList tmpKeymap;
Staff* firstStaff = 0;
for (Staff* s : masterScore->staves()) {
KeyList* km = s->keyList();
if (!s->isDrumStaff(Fraction(0,1))) { // TODO
tmpKeymap.insert(km->begin(), km->end());
firstStaff = s;
break;
}
}
Key normalizedC = Key::C;
// normalize the keyevents to concert pitch if necessary
if (firstStaff && !masterScore->styleB(Sid::concertPitch) && firstStaff->part()->instrument()->transpose().chromatic ) {
int interval = firstStaff->part()->instrument()->transpose().chromatic;
normalizedC = transposeKey(normalizedC, interval);
for (auto i = tmpKeymap.begin(); i != tmpKeymap.end(); ++i) {
int tick = i->first;
Key oKey = i->second.key();
tmpKeymap[tick].setKey(transposeKey(oKey, interval));
}
}
// create initial keyevent for transposing instrument if necessary
auto i = tmpKeymap.begin();
if (i == tmpKeymap.end() || i->first != 0)
tmpKeymap[0].setKey(normalizedC);
//
// process modified partitur list
//
QTreeWidget* pl = instrList->partiturList();
Part* part = 0;
int staffIdx = 0;
QTreeWidgetItem* item = 0;
for (int idx = 0; (item = pl->topLevelItem(idx)); ++idx) {
PartListItem* pli = static_cast<PartListItem*>(item);
// check if the part contains any remaining staves
// mark to remove part if not
QTreeWidgetItem* ci = 0;
int staves = 0;
for (int cidx = 0; (ci = pli->child(cidx)); ++cidx) {
StaffListItem* sli = static_cast<StaffListItem*>(ci);
if (sli->op() != ListItemOp::I_DELETE)
++staves;
}
if (staves == 0)
pli->op = ListItemOp::I_DELETE;
}
item = 0;
for (int idx = 0; (item = pl->topLevelItem(idx)); ++idx) {
int rstaff = 0;
PartListItem* pli = static_cast<PartListItem*>(item);
if (pli->op == ListItemOp::I_DELETE)
masterScore->cmdRemovePart(pli->part);
else if (pli->op == ListItemOp::ADD) {
const InstrumentTemplate* t = ((PartListItem*)item)->it;
part = new Part(masterScore);
part->initFromInstrTemplate(t);
masterScore->undo(new InsertPart(part, staffIdx));
pli->part = part;
QList<Staff*> linked;
for (int cidx = 0; pli->child(cidx); ++cidx) {
StaffListItem* sli = static_cast<StaffListItem*>(pli->child(cidx));
Staff* staff = new Staff(masterScore);
staff->setPart(part);
sli->setStaff(staff);
staff->init(t, sli->staffType(), cidx);
//.........这里部分代码省略.........