Fix handling of codas

This commit is contained in:
Matthias Neeracher 2011-09-04 22:21:58 +02:00
parent 273ee8ee73
commit 8eaa0fb1a5

View File

@ -1756,8 +1756,8 @@ VLSong::iterator::iterator(const VLSong & song, bool end)
bool repeat; bool repeat;
fMeasure = 0; fMeasure = 0;
if (fSong.fCoda > 0 if (fSong.fCoda > 0
&& !fSong.DoesEndRepeat(fMeasure) && !fSong.DoesEndRepeat(fSong.fCoda)
&& !fSong.DoesEndEnding(fMeasure, &repeat) && !fSong.DoesEndEnding(fSong.fCoda, &repeat)
) )
fStatus.push_back(Repeat(fMeasure, 2)); fStatus.push_back(Repeat(fMeasure, 2));
AdjustStatus(); AdjustStatus();
@ -1791,11 +1791,16 @@ void VLSong::iterator::AdjustStatus()
} else if (!repeat) { } else if (!repeat) {
fStatus.pop_back(); fStatus.pop_back();
} }
if (fSong.fCoda > 0 && fMeasure==fSong.fGoToCoda) if (fSong.fCoda > 0 && fMeasure==fSong.fGoToCoda) {
if (fStatus.size() && fStatus.back().fVolta == fStatus.back().fTimes-1) { for (size_t repeat = 0; repeat < fStatus.size(); ++repeat)
if (fStatus[repeat].fVolta != fStatus[repeat].fTimes-1)
goto notAtCoda;
fStatus.clear();
fMeasure = fSong.fCoda; fMeasure = fSong.fCoda;
return; return;
notAtCoda:
;
} }
if (fMeasure == fSong.CountMeasures()-fSong.EmptyEnding() if (fMeasure == fSong.CountMeasures()-fSong.EmptyEnding()
|| (fSong.fCoda > 0 && fMeasure == fSong.fCoda) || (fSong.fCoda > 0 && fMeasure == fSong.fCoda)