mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Allow nested repeats
This commit is contained in:
parent
11dab83982
commit
8a9e650e75
|
@ -1436,22 +1436,35 @@ void VLSong::DelEnding(size_t beginMeasure, size_t endMeasure)
|
||||||
bool VLSong::CanBeRepeat(size_t beginMeasure, size_t endMeasure, int * times)
|
bool VLSong::CanBeRepeat(size_t beginMeasure, size_t endMeasure, int * times)
|
||||||
{
|
{
|
||||||
for (size_t r=0; r<fRepeats.size(); ++r) {
|
for (size_t r=0; r<fRepeats.size(); ++r) {
|
||||||
if (fRepeats[r].fEndings[0].fBegin == beginMeasure) {
|
const VLRepeat & rep = fRepeats[r];
|
||||||
|
if (rep.fEndings[0].fBegin == beginMeasure) {
|
||||||
//
|
//
|
||||||
// Look for exact match & return
|
// Look for exact match & return
|
||||||
//
|
//
|
||||||
if (times)
|
if (times)
|
||||||
*times = fRepeats[r].fTimes;
|
*times = fRepeats[r].fTimes;
|
||||||
if (fRepeats[r].fEndings[0].fEnd == endMeasure)
|
if (rep.fEndings[0].fEnd == endMeasure)
|
||||||
return true;
|
return true;
|
||||||
if (fRepeats[r].fEndings.size() > 1) {
|
if (rep.fEndings.size() > 1) {
|
||||||
if (fRepeats[r].fEndings[1].fBegin == endMeasure)
|
if (rep.fEndings[1].fBegin == endMeasure)
|
||||||
return true;
|
return true;
|
||||||
if (fRepeats[r].fEndings[1].fEnd == endMeasure)
|
if (rep.fEndings[1].fEnd == endMeasure)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
// Inclusions and surroundings are OK. Beginnings may match, but
|
||||||
|
// endings must not.
|
||||||
|
//
|
||||||
|
if (rep.fEndings[0].fBegin >= beginMeasure
|
||||||
|
&& rep.fEndings[0].fEnd < endMeasure
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
if (rep.fEndings[0].fBegin <= beginMeasure
|
||||||
|
&& rep.fEndings[0].fEnd > endMeasure
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
//
|
||||||
// Look for overlap and reject
|
// Look for overlap and reject
|
||||||
//
|
//
|
||||||
if (fRepeats[r].fEndings[0].fBegin >= beginMeasure
|
if (fRepeats[r].fEndings[0].fBegin >= beginMeasure
|
||||||
|
|
Loading…
Reference in New Issue
Block a user