本文整理汇总了C++中Articulation::setUp方法的典型用法代码示例。如果您正苦于以下问题:C++ Articulation::setUp方法的具体用法?C++ Articulation::setUp怎么用?C++ Articulation::setUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articulation
的用法示例。
在下文中一共展示了Articulation::setUp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutArticulations
void ChordRest::layoutArticulations()
{
if (parent() == 0 || _articulations.isEmpty())
return;
qreal _spatium = spatium();
qreal _spStaff = _spatium * staff()->lineDistance(); // scaled to staff line distance for vert. pos. within a staff
if (type() == Element::Type::CHORD) {
if (_articulations.size() == 1) {
static_cast<Chord*>(this)->layoutArticulation(_articulations[0]);
return;
}
if (_articulations.size() == 2) {
//
// staccato | tenuto + marcato
//
Articulation* a1 = _articulations[0];
Articulation* a2 = _articulations[1];
ArticulationType st1 = a1->articulationType();
ArticulationType st2 = a2->articulationType();
if ((st2 == ArticulationType::Tenuto || st2 == ArticulationType::Staccato)
&& (st1 == ArticulationType::Marcato)) {
qSwap(a1, a2);
qSwap(st1, st2);
}
if ((st1 == ArticulationType::Tenuto || st1 == ArticulationType::Staccato)
&& (st2 == ArticulationType::Marcato)) {
QPointF pt = static_cast<Chord*>(this)->layoutArticulation(a1);
pt.ry() += a1->up() ? -_spStaff * .5 : _spStaff * .5;
a2->layout();
a2->setUp(a1->up());
a2->setPos(pt);
a2->adjustReadPos();
return;
}
//
// staccato | tenuto + sforzato
//
if ((st2 == ArticulationType::Tenuto || st2 == ArticulationType::Staccato)
&& (st1 == ArticulationType::Sforzatoaccent)) {
qSwap(a1, a2);
qSwap(st1, st2);
}
if ((st1 == ArticulationType::Tenuto || st1 == ArticulationType::Staccato)
&& (st2 == ArticulationType::Sforzatoaccent)) {
QPointF pt = static_cast<Chord*>(this)->layoutArticulation(a1);
pt.ry() += a1->up() ? -_spStaff * .7 : _spStaff * .7;
a2->layout();
a2->setUp(a1->up());
a2->setPos(pt);
a2->adjustReadPos();
return;
}
}
}
qreal x = centerX();
qreal distance0 = score()->styleS(StyleIdx::propertyDistance).val() * _spatium;
qreal distance1 = score()->styleS(StyleIdx::propertyDistanceHead).val() * _spatium;
qreal distance2 = score()->styleS(StyleIdx::propertyDistanceStem).val() * _spatium;
qreal chordTopY = upPos(); // note position of highest note
qreal chordBotY = downPos(); // note position of lowest note
qreal staffTopY = -distance2;
qreal staffBotY = staff()->height() + distance2;
// avoid collisions of staff articulations with chord notes:
// gap between note and staff articulation is distance0 + 0.5 spatium
if (type() == Element::Type::CHORD) {
Chord* chord = static_cast<Chord*>(this);
Stem* stem = chord->stem();
if (stem) {
qreal y = stem->pos().y() + pos().y();
if (up() && stem->stemLen() < 0.0)
y += stem->stemLen();
else if (!up() && stem->stemLen() > 0.0)
y -= stem->stemLen();
if (beam()) {
qreal bw = score()->styleS(StyleIdx::beamWidth).val() * _spatium;
y += up() ? -bw : bw;
}
if (up())
staffTopY = qMin(staffTopY, qreal(y - 0.5 * _spatium));
else
staffBotY = qMax(staffBotY, qreal(y + 0.5 * _spatium));
}
}
staffTopY = qMin(staffTopY, qreal(chordTopY - distance0 - 0.5 * _spatium));
staffBotY = qMax(staffBotY, qreal(chordBotY + distance0 + 0.5 * _spatium));
qreal dy = 0.0;
int n = _articulations.size();
for (int i = 0; i < n; ++i) {
Articulation* a = _articulations.at(i);
//.........这里部分代码省略.........
示例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);
}