本文整理汇总了C++中Segment::annotations方法的典型用法代码示例。如果您正苦于以下问题:C++ Segment::annotations方法的具体用法?C++ Segment::annotations怎么用?C++ Segment::annotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segment
的用法示例。
在下文中一共展示了Segment::annotations方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: append
void TrackList::append(Element* e)
{
if (e->isDurationElement()) {
Fraction d = static_cast<DurationElement*>(e)->duration();
_duration += d;
bool accumulateRest = e->type() == Element::Type::REST && !isEmpty()
&& back()->type() == Element::Type::REST;
Segment* s = accumulateRest ? static_cast<Rest*>(e)->segment() : 0;
if (s && !s->score()->isSpannerStartEnd(s->tick(), e->track()) && !s->annotations().size()) {
// akkumulate rests
Rest* rest = static_cast<Rest*>(back());
Fraction d = rest->duration();
d += static_cast<Rest*>(e)->duration();
rest->setDuration(d);
}
else
{
Element* element = e->clone();
QList<Element*>::append(element);
if (e->type() == Element::Type::TUPLET) {
Tuplet* srcTuplet = static_cast<Tuplet*>(e);
Tuplet* dstTuplet = static_cast<Tuplet*>(element);
foreach(const DurationElement* de, srcTuplet->elements())
dstTuplet->add(de->clone());
}
else {
示例2: testDelete
void TestInstrumentChange::testDelete()
{
Score* score = test_pre("delete");
Measure* m = score->firstMeasure()->nextMeasure();
Segment* s = m->first(Segment::Type::ChordRest);
InstrumentChange* ic = static_cast<InstrumentChange*>(s->annotations()[0]);
score->deleteItem(ic);
score->doLayout();
test_post(score, "delete");
}
示例3: harmonyCount
int Part::harmonyCount()
{
if (!score())
return 0;
int count = 0;
Segment::Type st = Segment::Type::ChordRest;
for (Segment* seg = score()->firstMeasure()->first(st); seg; seg = seg->next1(st)) {
for (Element* e : seg->annotations()) {
if (e->type() == Element::Type::HARMONY && e->track() >= startTrack() && e->track() < endTrack())
count++;
}
}
return count;
}
示例4: testCopy
void TestInstrumentChange::testCopy()
{
Score* score = test_pre("copy");
Measure* m = score->firstMeasure()->nextMeasure();
Segment* s = m->first(Segment::Type::ChordRest);
InstrumentChange* ic = static_cast<InstrumentChange*>(s->annotations()[0]);
m = m->nextMeasure();
s = m->first(Segment::Type::ChordRest);
InstrumentChange* nic = new InstrumentChange(*ic);
nic->setParent(s);
nic->setTrack(4);
score->undoAddElement(nic);
score->doLayout();
test_post(score, "copy");
}
示例5: testChange
void TestInstrumentChange::testChange()
{
Score* score = test_pre("change");
Measure* m = score->firstMeasure()->nextMeasure();
Segment* s = m->first(Segment::Type::ChordRest);
InstrumentChange* ic = static_cast<InstrumentChange*>(s->annotations()[0]);
Instrument* ni = score->staff(1)->part()->instr();
ic->setInstrument(*ni);
score->startCmd();
ic->setText("Instrument Oboe");
score->undo(new ChangeInstrument(ic, ic->instrument()));
score->endCmd();
score->doLayout();
test_post(score, "change");
}
示例6: lookupDynamic
Dynamic* lookupDynamic(Element* e)
{
Dynamic* d = 0;
Segment* s = 0;
if (e && e->isChord())
s = toChord(e)->segment();
if (s) {
for (Element* ee : s->annotations()) {
if (ee->isDynamic() && ee->track() == e->track() && ee->placeBelow()) {
d = toDynamic(ee);
break;
}
}
}
if (d) {
if (!d->autoplace())
d = 0;
}
return d;
}
示例7: testMixer
void TestInstrumentChange::testMixer()
{
Score* score = test_pre("mixer");
Measure* m = score->firstMeasure()->nextMeasure();
Segment* s = m->first(Segment::Type::ChordRest);
InstrumentChange* ic = static_cast<InstrumentChange*>(s->annotations()[0]);
int idx = score->staff(0)->channel(s->tick(), 0);
Channel* c = &score->staff(0)->part()->instr(s->tick())->channel(idx);
MidiPatch* mp = new MidiPatch;
mp->bank = 0;
mp->drum = false;
mp->name = "Viola";
mp->prog = 41;
mp->synti = "Fluid";
score->startCmd();
ic->setText("Mixer Viola");
score->undo(new ChangePatch(c, mp));
score->endCmd();
score->doLayout();
test_post(score, "mixer");
}