Skip to content

Commit

Permalink
Fix gp5 voltas import
Browse files Browse the repository at this point in the history
Backport of musescore#24981 and fix some clazy warnings, one of which revealed a memory leak
  • Loading branch information
mikekirin authored and Jojo-Schmitz committed Sep 30, 2024
1 parent 4cfc597 commit f8f0620
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions importexport/guitarpro/importgtp-gp5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ bool GuitarPro5::read(QFile* fp)
if (barBits & SCORE_REPEAT_START)
bar.repeatFlags = bar.repeatFlags | Repeat::START;
if (barBits & SCORE_REPEAT_END) { // number of repeats
bar.repeatFlags = bar.repeatFlags |Repeat::END;
bar.repeats = readUChar();
bar.repeatFlags = bar.repeatFlags | Repeat::END;
bar.repeats = readUChar() + 1;
}
if (barBits & SCORE_MARKER) {
bar.marker = readDelphiString(); // new section?
Expand Down Expand Up @@ -1144,7 +1144,7 @@ bool GuitarPro5::readNoteEffects(Note* note)
Articulation* a = new Articulation(chord->score());
a->setSymId(SymId::articStaccatoAbove);
bool add = true;
for (auto a1 : chord->articulations()) {
for (auto& a1 : chord->articulations()) {
if (a1->symId() == SymId::articStaccatoAbove) {
add = false;
break;
Expand Down Expand Up @@ -1173,8 +1173,10 @@ bool GuitarPro5::readNoteEffects(Note* note)
t->setTremoloType(TremoloType::R32);
chord->add(t);
}
else
else {
delete t;
qDebug("Unknown tremolo value");
}
}
// bool skip = false;
if (modMask2 & EFFECT_SLIDE) {
Expand Down Expand Up @@ -1243,7 +1245,9 @@ bool GuitarPro5::readNoteEffects(Note* note)
createSlur(true, note->staffIdx(), note->chord());
}
if (slideKind & SHIFT_SLIDE) {
#if 0
slideKind &= ~SHIFT_SLIDE;
#endif
slideList.push_back(note);
}
#if 0
Expand Down
4 changes: 2 additions & 2 deletions mtest/guitarpro/volta.gp5-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@
</voice>
</Measure>
<Measure>
<endRepeat>2</endRepeat>
<endRepeat>3</endRepeat>
<voice>
<Spanner type="Volta">
<Volta>
Expand Down Expand Up @@ -2456,7 +2456,7 @@
</voice>
</Measure>
<Measure>
<endRepeat>2</endRepeat>
<endRepeat>3</endRepeat>
<voice>
<Spanner type="Volta">
<Volta>
Expand Down

0 comments on commit f8f0620

Please sign in to comment.