Skip to content

Commit

Permalink
pad measure with rests if incomplete for GP3-5
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 5, 2015
1 parent a27e320 commit 96d5ceb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
5 changes: 5 additions & 0 deletions mscore/importgtp-gp4.cpp
Expand Up @@ -684,6 +684,7 @@ void GuitarPro4::read(QFile* fp)
tuplets[staffIdx] = 0;

for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
Fraction measureLen = 0;
int tick = measure->tick();
int beats = readInt();
int track = staffIdx * VOICES;
Expand Down Expand Up @@ -853,6 +854,10 @@ void GuitarPro4::read(QFile* fp)
restsForEmptyBeats(segment, measure, cr, l, track, tick);
createSlur(hasSlur, staffIdx, cr);
tick += cr->actualTicks();
measureLen += cr->actualFraction();
}
if (measureLen < measure->len()) {
score->setRest(tick, track, measure->len() - measureLen, false, nullptr, false);
}
}
if (bar == 1 && !mixChange)
Expand Down
11 changes: 9 additions & 2 deletions mscore/importgtp-gp5.cpp
Expand Up @@ -301,10 +301,17 @@ qDebug(" 3beat read 0x%02x", rrr);
void GuitarPro5::readMeasure(Measure* measure, int staffIdx, Tuplet** tuplets, bool mixChange)
{
for (int voice = 0; voice < 2; ++voice) {
Fraction measureLen = 0;
int tick = measure->tick();
int beats = readInt();
for (int beat = 0; beat < beats; ++beat)
tick += readBeat(tick, voice, measure, staffIdx, tuplets, mixChange);
for (int beat = 0; beat < beats; ++beat) {
int ticks = readBeat(tick, voice, measure, staffIdx, tuplets, mixChange);
tick += ticks;
measureLen += Fraction::fromTicks(ticks);
}
if (measureLen < measure->len()) {
score->setRest(tick, staffIdx * VOICES + voice, measure->len() - measureLen, false, nullptr, false);
}
}
}

Expand Down
17 changes: 16 additions & 1 deletion mscore/importgtp.cpp
Expand Up @@ -908,13 +908,14 @@ void GuitarPro1::read(QFile* fp)
tuplets[staffIdx] = 0;

for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
Fraction measureLen = 0;
int track = staffIdx * VOICES;
int tick = measure->tick();
int beats = readInt();
for (int beat = 0; beat < beats; ++beat) {
// int pause = 0;
uchar beatBits = readUChar();
bool dotted = beatBits & BEAT_DOTTED;
int track = staffIdx * VOICES;
if (beatBits & BEAT_PAUSE)
/*pause =*/ readUChar();
int len = readChar();
Expand Down Expand Up @@ -999,6 +1000,10 @@ void GuitarPro1::read(QFile* fp)
}
restsForEmptyBeats(segment, measure, cr, l, track, tick);
tick += cr->actualTicks();
measureLen += cr->actualFraction();
}
if (measureLen < measure->len()) {
score->setRest(tick, track, measure->len() - measureLen, false, nullptr, false);
}
}
if (bar == 1 && !mixChange)
Expand Down Expand Up @@ -1366,6 +1371,7 @@ void GuitarPro2::read(QFile* fp)
tuplets[staffIdx] = 0;

for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
Fraction measureLen = 0;
int track = staffIdx * VOICES;
int tick = measure->tick();
int beats = readInt();
Expand Down Expand Up @@ -1458,6 +1464,10 @@ void GuitarPro2::read(QFile* fp)
}
restsForEmptyBeats(segment, measure, cr, l, track, tick);
tick += cr->actualTicks();
measureLen += cr->actualFraction();
}
if (measureLen < measure->len()) {
score->setRest(tick, track, measure->len() - measureLen, false, nullptr, false);
}
}
if (bar == 1 && !mixChange)
Expand Down Expand Up @@ -1981,6 +1991,7 @@ void GuitarPro3::read(QFile* fp)
tuplets[staffIdx] = 0;

for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
Fraction measureLen = 0;
int track = staffIdx * VOICES;
int tick = measure->tick();
int beats = readInt();
Expand Down Expand Up @@ -2114,6 +2125,10 @@ void GuitarPro3::read(QFile* fp)

restsForEmptyBeats(segment, measure, cr, l, track, tick);
tick += cr->actualTicks();
measureLen += cr->actualFraction();
}
if (measureLen < measure->len()) {
score->setRest(tick, track, measure->len() - measureLen, false, nullptr, false);
}
}
if (bar == 1 && !mixChange)
Expand Down

0 comments on commit 96d5ceb

Please sign in to comment.