Fix and repair incorrect tie information

This commit is contained in:
Matthias Neeracher 2007-05-06 06:59:55 +00:00
parent 9f52fc0010
commit 0a45e471b0
2 changed files with 17 additions and 1 deletions

View File

@ -1699,7 +1699,9 @@ std::string VLSong::GetWord(size_t stanza, size_t measure, VLFraction at)
VLFraction now(0);
while (note != end) {
if (now >= at && note->fPitch != VLNote::kNoPitch) {
if (now >= at && note->fPitch != VLNote::kNoPitch
&& !(note->fTied & VLNote::kTiedWithPrev)
) {
if (word.size())
word += '-';
if (stanza <= note->fLyrics.size()) {
@ -1794,6 +1796,8 @@ void VLSong::SetWord(size_t stanza, size_t measure, VLFraction at, std::string w
note->fLyrics[stanza-1].fKind = kind;
if (type == '-')
kind |= VLSyllable::kHasPrev;
else
kind &= ~VLSyllable::kHasPrev;
}
now += note->fDuration;
++note;

View File

@ -604,6 +604,8 @@ int8_t sStepToPitch[] = {
VLRepeat repeat;
bool inRepeat = false;
uint8_t prevKind[20];
memset(prevKind, 0, 20);
for (NSXMLElement * measure; measure = [e nextObject]; ) {
VLProperties & prop = song->fProperties.front();
@ -622,6 +624,16 @@ int8_t sStepToPitch[] = {
for (NSXMLElement * note; note = [n nextObject]; ) {
VLLyricsNote n = [self readNote:note withUnit:unit];
//
// Sanitize syllabic information which was corrupt in early
// versions.
//
for (size_t i = 0; i<n.fLyrics.size(); ++i)
if (n.fLyrics[i].fText.size()) {
if (!(prevKind[i] & VLSyllable::kHasNext))
n.fLyrics[i].fKind &= ~VLSyllable::kHasPrev;
prevKind[i] = n.fLyrics[i].fKind;
}
song->AddNote(n, m, at);
at += n.fDuration;
}