本文整理汇总了C++中Chord::setNoteType方法的典型用法代码示例。如果您正苦于以下问题:C++ Chord::setNoteType方法的具体用法?C++ Chord::setNoteType怎么用?C++ Chord::setNoteType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chord
的用法示例。
在下文中一共展示了Chord::setNoteType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: note
void MsScWriter::note(const QString pitch, const QVector<Bww::BeamType> beamList,
const QString type, const int dots,
bool tieStart, bool /*TODO tieStop */,
StartStop triplet,
bool grace)
{
qDebug() << "MsScWriter::note()"
<< "type:" << type
<< "dots:" << dots
<< "grace" << grace
;
if (!stepAlterOctMap.contains(pitch)
|| !typeMap.contains(type)) {
// TODO: error message
return;
}
StepAlterOct sao = stepAlterOctMap.value(pitch);
int ticks = 4 * MScore::division / type.toInt();
if (dots) ticks = 3 * ticks / 2;
qDebug() << "ticks:" << ticks;
TDuration durationType(TDuration::V_INVALID);
durationType.setVal(ticks);
qDebug() << "duration:" << durationType.name();
if (triplet != ST_NONE) ticks = 2 * ticks / 3;
BeamMode bm = (beamList.at(0) == Bww::BM_BEGIN) ? BEAM_BEGIN : BEAM_AUTO;
Direction sd = AUTO;
// create chord
Chord* cr = new Chord(score);
//ws cr->setTick(tick);
cr->setBeamMode(bm);
cr->setTrack(0);
if (grace) {
cr->setNoteType(NOTE_GRACE32);
cr->setDurationType(TDuration::V_32ND);
sd = UP;
}
else {
if (durationType.type() == TDuration::V_INVALID)
durationType.setType(TDuration::V_QUARTER);
cr->setDurationType(durationType);
sd = DOWN;
}
cr->setDuration(durationType.fraction());
cr->setDots(dots);
cr->setStemDirection(sd);
// add note to chord
Note* note = new Note(score);
note->setTrack(0);
xmlSetPitch(note, sao.s.toAscii(), sao.a, sao.o);
if (tieStart) {
Tie* tie = new Tie(score);
note->setTieFor(tie);
tie->setStartNote(note);
tie->setTrack(0);
}
cr->add(note);
// add chord to measure
Segment* s = currentMeasure->getSegment(cr, tick);
s->add(cr);
if (!grace) {
doTriplet(cr, triplet);
int tickBefore = tick;
tick += ticks;
Fraction nl(Fraction::fromTicks(tick - currentMeasure->tick()));
currentMeasure->setLen(nl);
qDebug() << "MsScWriter::note()"
<< "tickBefore:" << tickBefore
<< "tick:" << tick
<< "nl:" << nl.print()
;
}
}