mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +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);
|
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
|
// 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)
|
void VLSong::ExtendNote(size_t measure, VLFraction at)
|
||||||
{
|
{
|
||||||
VLNoteList::iterator i = fMeasures[measure].fMelody.begin();
|
VLNoteList::iterator i = fMeasures[measure].fMelody.begin();
|
||||||
VLFraction t(0);
|
VLNoteList::iterator end= fMeasures[measure].fMelody.end();
|
||||||
|
|
||||||
for (;;) {
|
for (VLFraction t(0); i != end && t+i->fDuration <= at; ++i)
|
||||||
if (t == at) {
|
t += i->fDuration;
|
||||||
|
|
||||||
|
if (i == end)
|
||||||
|
--i;
|
||||||
if (i->fPitch == VLNote::kNoPitch)
|
if (i->fPitch == VLNote::kNoPitch)
|
||||||
return; // Don't extend rests
|
return; // Don't extend rests
|
||||||
do {
|
|
||||||
|
for (;;) {
|
||||||
VLNoteList::iterator j=i;
|
VLNoteList::iterator j=i;
|
||||||
++j;
|
++j;
|
||||||
if (j != fMeasures[measure].fMelody.end()) {
|
if (j != fMeasures[measure].fMelody.end()) {
|
||||||
|
@ -1052,6 +1066,7 @@ void VLSong::ExtendNote(size_t measure, VLFraction at)
|
||||||
i = k;
|
i = k;
|
||||||
continue; // Go for another spin
|
continue; // Go for another spin
|
||||||
} else {
|
} else {
|
||||||
|
for (;;) {
|
||||||
bool wasTied = k->fTied & VLNote::kTiedWithNext;
|
bool wasTied = k->fTied & VLNote::kTiedWithNext;
|
||||||
//
|
//
|
||||||
// Extend previous note
|
// Extend previous note
|
||||||
|
@ -1060,26 +1075,14 @@ void VLSong::ExtendNote(size_t measure, VLFraction at)
|
||||||
k->fTied = VLNote::kTiedWithPrev;
|
k->fTied = VLNote::kTiedWithPrev;
|
||||||
i->fTied |= VLNote::kTiedWithNext;
|
i->fTied |= VLNote::kTiedWithNext;
|
||||||
k->fLyrics.clear();
|
k->fLyrics.clear();
|
||||||
if (wasTied) {
|
if (!wasTied)
|
||||||
//
|
break;
|
||||||
// Extend further
|
|
||||||
//
|
|
||||||
i = k;
|
i = k;
|
||||||
continue;
|
k = fMeasures[++measure].fMelody.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (0);
|
break;
|
||||||
//
|
|
||||||
// Finished extending
|
|
||||||
//
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VLFraction tEnd = t+i->fDuration;
|
|
||||||
if (tEnd > at)
|
|
||||||
break; // Past the point, quit
|
|
||||||
t = tEnd;
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user