Skip to content

Commit

Permalink
fix #25340
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Apr 10, 2014
1 parent d2405f0 commit d995222
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
10 changes: 7 additions & 3 deletions libmscore/edit.cpp
Expand Up @@ -718,7 +718,9 @@ void Score::putNote(const Position& p, bool replace)
AccidentalVal acci = s->measure()->findAccidental(s, staffIdx, line);
int step = absStep(line, clef);
int octave = step/7;
nval.pitch = step2pitch(step) + octave * 12 + acci + instr->transpose().chromatic;
nval.pitch = step2pitch(step) + octave * 12 + acci;
if (!styleB(ST_concertPitch))
nval.pitch += instr->transpose().chromatic;
nval.tpc = step2tpc(step % 7, acci);
}
break;
Expand Down Expand Up @@ -814,8 +816,10 @@ void Score::repitchNote(const Position& p, bool replace)
AccidentalVal acci = s->measure()->findAccidental(s, p.staffIdx, p.line);
int step = absStep(p.line, clef);
int octave = step / 7;
nval.pitch = step2pitch(step) + octave * 12 + acci + st->part()->instr(s->tick())->transpose().chromatic;
nval.tpc = step2tpc(step % 7, acci);
nval.pitch = step2pitch(step) + octave * 12 + acci;
if (!styleB(ST_concertPitch))
nval.pitch += st->part()->instr(s->tick())->transpose().chromatic;
nval.tpc = step2tpc(step % 7, acci);

Chord* chord;
if (_is.cr()->type() == Element::REST) { //skip rests
Expand Down
19 changes: 9 additions & 10 deletions mscore/scoreview.cpp
Expand Up @@ -4787,26 +4787,26 @@ void ScoreView::cmdAddPitch(int note, bool addFlag)
Element* el = score()->selection().element();
if (addFlag && el && el->type() == Element::NOTE) {
Chord* chord = static_cast<Note*>(el)->chord();
Note * n = chord->upNote();
Note* n = chord->upNote();
octave = n->pitch() / 12;
if (note < n->pitch() / (octave * 7))
octave++;
}
else {
int curPitch = -1;
if(is.segment()) {
if (is.segment()) {
Staff* staff = score()->staff(is.track() / VOICES);
Segment* seg = is.segment()->prev1(Segment::SegChordRest | Segment::SegClef);
while(seg) {
if(seg->segmentType() == Segment::SegChordRest) {
if (seg->segmentType() == Segment::SegChordRest) {
Element* p = seg->element(is.track());
if(p && p->type() == Element::CHORD) {
if (p && p->type() == Element::CHORD) {
Chord* ch = static_cast<Chord*>(p);
curPitch = ch->downNote()->pitch();
curPitch = ch->downNote()->epitch();
break;
}
}
else if(seg->segmentType() == Segment::SegClef) {
else if (seg->segmentType() == Segment::SegClef) {
Element* p = seg->element( (is.track() / VOICES) * VOICES); // clef on voice 1
if(p && p->type() == Element::CLEF) {
Clef* clef = static_cast<Clef*>(p);
Expand All @@ -4820,7 +4820,7 @@ void ScoreView::cmdAddPitch(int note, bool addFlag)
}
seg = seg->prev1(Segment::SegChordRest | Segment::SegClef);
}
octave = curPitch / 12;
octave = curPitch / 12;
}

static const int tab[] = { 0, 2, 4, 5, 7, 9, 11 };
Expand Down Expand Up @@ -4849,9 +4849,8 @@ void ScoreView::cmdAddPitch(int note, bool addFlag)
Chord* chord = static_cast<Note*>(el)->chord();
NoteVal val;
val.pitch = line2pitch(pos.line, clef, 0);
// val.tpc = INVALID_TPC;
// val.fret = FRET_NONE;
// val.string = STRING_NONE;
if (!chord->concertPitch())
val.pitch += chord->staff()->part()->instr()->transpose().chromatic;
_score->addNote(chord, val);
_score->endCmd();
return;
Expand Down

0 comments on commit d995222

Please sign in to comment.