本文整理汇总了C++中Chord::downNote方法的典型用法代码示例。如果您正苦于以下问题:C++ Chord::downNote方法的具体用法?C++ Chord::downNote怎么用?C++ Chord::downNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chord
的用法示例。
在下文中一共展示了Chord::downNote方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undoChangeVoice
void TestTools::undoChangeVoice()
{
QString readFile(DIR + "undoChangeVoice.mscx");
QString writeFile1("undoChangeVoice01-test.mscx");
QString reference1(DIR + "undoChangeVoice01-ref.mscx");
QString writeFile2("undoChangeVoice02-test.mscx");
QString reference2(DIR + "undoChangeVoice02-ref.mscx");
Score* score = readScore(readFile);
score->doLayout();
// do
score->deselectAll();
// select bottom note of all voice 1 chords
for (Segment* s = score->firstSegment(Segment::Type::ChordRest); s; s = s->next1()) {
ChordRest* cr = static_cast<ChordRest*>(s->element(0));
if (cr && cr->type() == Element::Type::CHORD) {
Chord* c = static_cast<Chord*>(cr);
score->select(c->downNote(), SelectType::ADD);
}
}
// change voice
score->changeVoice(1);
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undo()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
示例2: drumNoteSelected
void DrumTools::drumNoteSelected(int val)
{
Element* element = drumPalette->element(val);
Chord* ch = static_cast<Chord*>(element);
Note* note = ch->downNote();
int ticks = MScore::defaultPlayDuration;
int pitch = note->pitch();
seq->startNote(staff->part()->instr()->channel(0), pitch, 80, ticks, 0.0);
_score->inputState().setDrumNote(note->pitch());
}
示例3: selectedDrumNote
int DrumTools::selectedDrumNote()
{
int idx = drumPalette->getSelectedIdx();
if (idx < 0)
return -1;
Element* element = drumPalette->element(idx);
if (element && element->type() == Element::Type::CHORD) {
Chord* ch = static_cast<Chord*>(element);
Note* note = ch->downNote();
return note->pitch();
}
else {
return -1;
}
}
示例4: gripAnchor
QPointF Arpeggio::gripAnchor(int n) const
{
Chord* c = chord();
if (c == 0)
return QPointF();
if (n == 0)
return c->upNote()->pagePos();
else if (n == 1) {
Note* dnote = c->downNote();
int btrack = track() + (_span - 1) * VOICES;
ChordRest* bchord = static_cast<ChordRest*>(c->segment()->element(btrack));
if (bchord && bchord->type() == CHORD)
dnote = static_cast<Chord*>(bchord)->downNote();
return dnote->pagePos();
}
return QPointF();
}
示例5: selectedDrumNote
int DrumTools::selectedDrumNote()
{
int idx = drumPalette->getSelectedIdx();
if (idx < 0)
return -1;
Element* element = drumPalette->element(idx);
if (element && element->type() == ElementType::CHORD) {
Chord* ch = static_cast<Chord*>(element);
Note* note = ch->downNote();
auto pitchCell = drumPalette->cellAt(idx);
pitchName->setText(pitchCell->name);
return note->pitch();
}
else {
return -1;
}
}
示例6: drumNoteSelected
void DrumTools::drumNoteSelected(int val)
{
Element* element = drumPalette->element(val);
if(element && element->type() == CHORD) {
Chord* ch = static_cast<Chord*>(element);
Note* note = ch->downNote();
int ticks = MScore::defaultPlayDuration;
int pitch = note->pitch();
seq->startNote(staff->part()->instr()->channel(0).channel, pitch, 80, ticks, 0.0);
_score->inputState().setTrack(element->track());
_score->inputState().setDrumNote(pitch);
getAction("voice-1")->setChecked(element->voice() == 0);
getAction("voice-2")->setChecked(element->voice() == 1);
getAction("voice-3")->setChecked(element->voice() == 2);
getAction("voice-4")->setChecked(element->voice() == 3);
}
}
示例7: layout
void Stem::layout()
{
qreal l = _len + _userLen;
if (up())
l = -l;
Staff* st = staff();
qreal lw5 = point(score()->styleS(ST_stemWidth)) * .5;
QPointF p1(0.0, 0.0);
QPointF p2(0.0, l);
if (st) {
// if TAB, use simplified positioning
if (st->isTabStaff()) {
p1.rx() = -lw5;
p2.rx() = -lw5;
}
// for any other staff type, use standard positioning
else if (chord()) {
// adjust P1 for note head
Chord* c = chord();
if (c->up()) {
Note* n = c->downNote();
p1 = symbols[score()->symIdx()][n->noteHead()].attach(n->magS());
p1.rx() = -lw5;
p2.rx() = -lw5;
}
else {
Note* n = c->upNote();
p1 = -symbols[score()->symIdx()][n->noteHead()].attach(n->magS());
p1.rx() = lw5;
p2.rx() = lw5;
}
}
}
line.setP1(p1);
line.setP2(p2);
// compute bounding rectangle
QRectF r(line.p1(), line.p2());
setbbox(r.normalized().adjusted(-lw5, -lw5, lw5, lw5));
}
示例8: drumNoteSelected
void DrumTools::drumNoteSelected(int val)
{
Element* element = drumPalette->element(val);
if (element && element->type() == ElementType::CHORD) {
Chord* ch = static_cast<Chord*>(element);
Note* note = ch->downNote();
int ticks = MScore::defaultPlayDuration;
int pitch = note->pitch();
seq->startNote(staff->part()->instrument()->channel(0)->channel(), pitch, 80, ticks, 0.0);
int track = (_score->inputState().track() / VOICES) * VOICES + element->track();
_score->inputState().setTrack(track);
_score->inputState().setDrumNote(pitch);
getAction("voice-1")->setChecked(element->voice() == 0);
getAction("voice-2")->setChecked(element->voice() == 1);
getAction("voice-3")->setChecked(element->voice() == 2);
getAction("voice-4")->setChecked(element->voice() == 3);
auto pitchCell = drumPalette->cellAt(val);
pitchName->setText(pitchCell->name);
}
}
示例9: slurPos
void Slur::slurPos(SlurPos* sp)
{
qreal _spatium = spatium();
Element* e1 = startElement();
Element* e2 = endElement();
if (e2 == 0) {
sp->p1 = e1->pagePos();
sp->p1.rx() += e1->width();
sp->p2 = sp->p1;
sp->p2.rx() += 5 * _spatium;
sp->system1 = static_cast<ChordRest*>(e1)->measure()->system();
sp->system2 = sp->system1;
return;
}
if ((e1->type() != CHORD) || (e2->type() != CHORD)) {
sp->p1 = e1->pagePos();
sp->p2 = e2->pagePos();
sp->p1.rx() += e1->width();
sp->p2.rx() += e2->width();
sp->system1 = static_cast<ChordRest*>(e1)->measure()->system();
sp->system2 = static_cast<ChordRest*>(e2)->measure()->system();
return;
}
Chord* sc = static_cast<Chord*>(e1);
Chord* ec = static_cast<Chord*>(e2);
Note* note1 = _up ? sc->upNote() : sc->downNote();
Note* note2 = _up ? ec->upNote() : ec->downNote();
sp->system1 = sc->measure()->system();
sp->system2 = ec->measure()->system();
sp->p1 = sc->pagePos() - sp->system1->pagePos();
sp->p2 = ec->pagePos() - sp->system2->pagePos();
qreal xo, yo;
Stem* stem1 = sc->stem();
Stem* stem2 = ec->stem();
enum SlurAnchor {
SA_NONE, SA_STEM
};
SlurAnchor sa1 = SA_NONE;
SlurAnchor sa2 = SA_NONE;
if ((sc->up() == ec->up()) && !sc->beam() && !ec->beam() && (_up == sc->up())) {
if (stem1)
sa1 = SA_STEM;
if (stem2)
sa2 = SA_STEM;
}
qreal __up = _up ? -1.0 : 1.0;
qreal hw = note1->headWidth();
switch (sa1) {
case SA_STEM:
sp->p1 += sc->stemPosBeam() - sc->pagePos() + sc->stem()->p2();
sp->p1 += QPointF(0.35 * _spatium, 0.25 * _spatium);
break;
case SA_NONE:
break;
}
switch(sa2) {
case SA_STEM:
sp->p2 += ec->stemPosBeam() - ec->pagePos() + ec->stem()->p2();
sp->p2 += QPointF(-0.35 * _spatium, 0.25 * _spatium);
break;
case SA_NONE:
break;
}
//
// default position:
// horizontal: middle of note head
// vertical: _spatium * .4 above/below note head
//
//------p1
bool stemPos = false; // p1 starts at chord stem side
yo = note1->pos().y() + _spatium * .9 * __up;
xo = hw * .5;
if (stem1) {
Beam* beam1 = sc->beam();
if (beam1 && (beam1->elements().back() != sc) && (sc->up() == _up)) {
qreal sh = stem1->height() + _spatium;
yo = sc->downNote()->pos().y() + sh * __up;
xo = stem1->pos().x();
stemPos = true;
}
else {
if (sc->up() && _up)
xo = hw + _spatium * .3;
//
// handle case: stem up - stem down
// stem down - stem up
//
if ((sc->up() != ec->up()) && (sc->up() == _up)) {
Note* n1 = sc->up() ? sc->downNote() : sc->upNote();
Note* n2 = ec->up() ? ec->downNote() : ec->upNote();
qreal yd = n2->pos().y() - n1->pos().y();
//.........这里部分代码省略.........
示例10: layout
void Fingering::layout()
{
if (parent()) {
Fraction tick = parent()->tick();
const Staff* st = staff();
if (st && st->isTabStaff(tick) && !st->staffType(tick)->showTabFingering()) {
setbbox(QRectF());
return;
}
}
TextBase::layout();
rypos() = 0.0; // handle placement below
if (autoplace() && note()) {
Note* n = note();
Chord* chord = n->chord();
bool voices = chord->measure()->hasVoices(chord->staffIdx());
bool tight = voices && chord->notes().size() == 1 && !chord->beam() && tid() != Tid::STRING_NUMBER;
qreal headWidth = n->bboxRightPos();
// update offset after drag
qreal rebase = 0.0;
if (offsetChanged() != OffsetChange::NONE)
rebase = rebaseOffset();
// temporarily exclude self from chord shape
setAutoplace(false);
if (layoutType() == ElementType::CHORD) {
Stem* stem = chord->stem();
Segment* s = chord->segment();
Measure* m = s->measure();
qreal sp = spatium();
qreal md = minDistance().val() * sp;
SysStaff* ss = m->system()->staff(chord->vStaffIdx());
Staff* vStaff = chord->staff(); // TODO: use current height at tick
if (n->mirror())
rxpos() -= n->ipos().x();
rxpos() += headWidth * .5;
if (placeAbove()) {
if (tight) {
if (chord->stem())
rxpos() -= 0.8 * sp;
rypos() -= 1.5 * sp;
}
else {
QRectF r = bbox().translated(m->pos() + s->pos() + chord->pos() + n->pos() + pos());
SkylineLine sk(false);
sk.add(r.x(), r.bottom(), r.width());
qreal d = sk.minDistance(ss->skyline().north());
qreal yd = 0.0;
if (d > 0.0 && isStyled(Pid::MIN_DISTANCE))
yd -= d + height() * .25;
// force extra space above staff & chord (but not other fingerings)
qreal top;
if (chord->up() && chord->beam() && stem) {
top = stem->y() + stem->bbox().top();
}
else {
Note* un = chord->upNote();
top = qMin(0.0, un->y() + un->bbox().top());
}
top -= md;
qreal diff = (bbox().bottom() + ipos().y() + yd + n->y()) - top;
if (diff > 0.0)
yd -= diff;
if (offsetChanged() != OffsetChange::NONE) {
// user moved element within the skyline
// we may need to adjust minDistance, yd, and/or offset
bool inStaff = placeAbove() ? r.bottom() + rebase > 0.0 : r.top() + rebase < staff()->height();
rebaseMinDistance(md, yd, sp, rebase, inStaff);
}
rypos() += yd;
}
}
else {
if (tight) {
if (chord->stem())
rxpos() += 0.8 * sp;
rypos() += 1.5 * sp;
}
else {
QRectF r = bbox().translated(m->pos() + s->pos() + chord->pos() + n->pos() + pos());
SkylineLine sk(true);
sk.add(r.x(), r.top(), r.width());
qreal d = ss->skyline().south().minDistance(sk);
qreal yd = 0.0;
if (d > 0.0 && isStyled(Pid::MIN_DISTANCE))
yd += d + height() * .25;
// force extra space below staff & chord (but not other fingerings)
qreal bottom;
if (!chord->up() && chord->beam() && stem) {
bottom = stem->y() + stem->bbox().bottom();
}
else {
Note* dn = chord->downNote();
bottom = qMax(vStaff->height(), dn->y() + dn->bbox().bottom());
//.........这里部分代码省略.........