mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Fix note extending
This commit is contained in:
parent
d5af21ff96
commit
c42e5faa30
|
@ -850,6 +850,16 @@ void VLSong::swap(VLSong & other)
|
|||
std::swap(fCoda, other.fCoda);
|
||||
}
|
||||
|
||||
void VLSong::clear()
|
||||
{
|
||||
fProperties.resize(1);
|
||||
fMeasures.clear();
|
||||
fRepeats.clear();
|
||||
|
||||
fGoToCoda = -1;
|
||||
fCoda = -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Deal with chords - a bit simpler
|
||||
//
|
||||
|
@ -1025,13 +1035,17 @@ void VLSong::DelNote(size_t measure, VLFraction at)
|
|||
void VLSong::ExtendNote(size_t measure, VLFraction at)
|
||||
{
|
||||
VLNoteList::iterator i = fMeasures[measure].fMelody.begin();
|
||||
VLFraction t(0);
|
||||
VLNoteList::iterator end= fMeasures[measure].fMelody.end();
|
||||
|
||||
for (;;) {
|
||||
if (t == at) {
|
||||
for (VLFraction t(0); i != end && t+i->fDuration <= at; ++i)
|
||||
t += i->fDuration;
|
||||
|
||||
if (i == end)
|
||||
--i;
|
||||
if (i->fPitch == VLNote::kNoPitch)
|
||||
return; // Don't extend rests
|
||||
do {
|
||||
|
||||
for (;;) {
|
||||
VLNoteList::iterator j=i;
|
||||
++j;
|
||||
if (j != fMeasures[measure].fMelody.end()) {
|
||||
|
@ -1052,6 +1066,7 @@ void VLSong::ExtendNote(size_t measure, VLFraction at)
|
|||
i = k;
|
||||
continue; // Go for another spin
|
||||
} else {
|
||||
for (;;) {
|
||||
bool wasTied = k->fTied & VLNote::kTiedWithNext;
|
||||
//
|
||||
// Extend previous note
|
||||
|
@ -1060,26 +1075,14 @@ void VLSong::ExtendNote(size_t measure, VLFraction at)
|
|||
k->fTied = VLNote::kTiedWithPrev;
|
||||
i->fTied |= VLNote::kTiedWithNext;
|
||||
k->fLyrics.clear();
|
||||
if (wasTied) {
|
||||
//
|
||||
// Extend further
|
||||
//
|
||||
if (!wasTied)
|
||||
break;
|
||||
i = k;
|
||||
continue;
|
||||
k = fMeasures[++measure].fMelody.begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
//
|
||||
// Finished extending
|
||||
//
|
||||
return;
|
||||
}
|
||||
VLFraction tEnd = t+i->fDuration;
|
||||
if (tEnd > at)
|
||||
break; // Past the point, quit
|
||||
t = tEnd;
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user