Skip to content

Commit

Permalink
gp-import: fixed segments while removing extra rests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpavlov96 committed Jul 7, 2023
1 parent cd01c6e commit abd58f6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/importexport/guitarpro/internal/gtp/gpconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,14 @@ void GPConverter::fixEmptyMeasures()
// Keep only one rest element in a bar and make its duration V_MEASURE
// that way layout can recognize this bar as "empty"
// and properly render mmrests
size_t lastIndex = segItemPairs.size() - 1;
if (segItemPairs.empty()) {
continue;
}
for (size_t i = 0; i < lastIndex; ++i) {
for (size_t i = 1; i < segItemPairs.size(); ++i) {
segItemPairs.at(i).first->remove(segItemPairs.at(i).second);
}
Rest* rest = toRest(segItemPairs.at(lastIndex).second);

Rest* rest = toRest(segItemPairs.at(0).second);
rest->setTicks(_lastMeasure->ticks());
rest->setDurationType(DurationType::V_MEASURE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
<tempo>1.683333</tempo>
<text><sym>metNoteQuarterUp</sym> = 101</text>
</Tempo>
<location>
<fractions>1/1</fractions>
</location>
<Rest>
<durationType>measure</durationType>
<duration>12/8</duration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
<tempo>1.683333</tempo>
<text><sym>metNoteQuarterUp</sym> = 101</text>
</Tempo>
<location>
<fractions>1/1</fractions>
</location>
<Rest>
<durationType>measure</durationType>
<duration>12/8</duration>
Expand Down
6 changes: 0 additions & 6 deletions src/importexport/guitarpro/tests/data/mmrest.gp-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
</Measure>
<Measure>
<voice>
<location>
<fractions>3/4</fractions>
</location>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
Expand All @@ -126,9 +123,6 @@
</Measure>
<Measure>
<voice>
<location>
<fractions>3/4</fractions>
</location>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
Expand Down

0 comments on commit abd58f6

Please sign in to comment.