mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Still need to skip tied notes
This commit is contained in:
parent
b8206f9f13
commit
d16a8be705
|
@ -1388,78 +1388,79 @@ void VLSong::SetWord(size_t stanza, size_t measure, VLFraction at, std::string w
|
||||||
VLFraction now(0);
|
VLFraction now(0);
|
||||||
|
|
||||||
while (note != meas.fMelody.end()) {
|
while (note != meas.fMelody.end()) {
|
||||||
switch (state) {
|
if (note->fPitch != VLNote::kNoPitch
|
||||||
case kFindFirst:
|
&& !(note->fTied & VLNote::kTiedWithPrev)
|
||||||
if (now < at || note->fPitch == VLNote::kNoPitch
|
)
|
||||||
|| (note->fTied & VLNote::kTiedWithPrev)
|
switch (state) {
|
||||||
)
|
case kFindFirst:
|
||||||
break; // Not yet there, skip this note
|
if (now < at)
|
||||||
state = kOverwrite;
|
break; // Not yet there, skip this note
|
||||||
// Fall through
|
state = kOverwrite;
|
||||||
case kOverwrite: {
|
// Fall through
|
||||||
if (note->fLyrics.size()<stanza)
|
case kOverwrite: {
|
||||||
note->fLyrics.resize(stanza);
|
if (note->fLyrics.size()<stanza)
|
||||||
size_t sep = word.find_first_of(" \t-");
|
note->fLyrics.resize(stanza);
|
||||||
size_t esp;
|
size_t sep = word.find_first_of(" \t-");
|
||||||
std::string syll;
|
size_t esp;
|
||||||
char type= 0;
|
std::string syll;
|
||||||
if (sep == std::string::npos) {
|
char type= 0;
|
||||||
esp = sep;
|
if (sep == std::string::npos) {
|
||||||
syll= word;
|
esp = sep;
|
||||||
} else {
|
syll= word;
|
||||||
esp = word.find_first_not_of(" \t-", sep);
|
} else {
|
||||||
syll= word.substr(0, sep);
|
esp = word.find_first_not_of(" \t-", sep);
|
||||||
if (esp != std::string::npos) {
|
syll= word.substr(0, sep);
|
||||||
size_t tpos = word.substr(sep, esp-sep).find('-');
|
if (esp != std::string::npos) {
|
||||||
type = (tpos != std::string::npos) ? '-' : ' ';
|
size_t tpos = word.substr(sep, esp-sep).find('-');
|
||||||
word.erase(0, esp);
|
type = (tpos != std::string::npos) ? '-' : ' ';
|
||||||
|
word.erase(0, esp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (type) {
|
||||||
|
default:
|
||||||
|
//
|
||||||
|
// Last syllable in text
|
||||||
|
//
|
||||||
|
kind &= ~VLSyllable::kHasNext;
|
||||||
|
state = kCleanup;
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
//
|
||||||
|
// Last syllable in word
|
||||||
|
//
|
||||||
|
kind &= ~VLSyllable::kHasNext;
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
kind |= VLSyllable::kHasNext;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
note->fLyrics[stanza-1].fText = syll;
|
||||||
|
note->fLyrics[stanza-1].fKind = kind;
|
||||||
|
if (type == '-')
|
||||||
|
kind |= VLSyllable::kHasPrev;
|
||||||
|
else
|
||||||
|
kind &= ~VLSyllable::kHasPrev;
|
||||||
|
break; }
|
||||||
|
case kCleanup:
|
||||||
|
if (nextMeas) {
|
||||||
|
*nextMeas = measure;
|
||||||
|
nextMeas = 0;
|
||||||
|
}
|
||||||
|
if (nextAt) {
|
||||||
|
*nextAt = now;
|
||||||
|
nextAt = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
switch (type) {
|
|
||||||
default:
|
|
||||||
//
|
//
|
||||||
// Last syllable in text
|
// Delete all subsequent syllables with kHasPrev set
|
||||||
//
|
//
|
||||||
kind &= ~VLSyllable::kHasNext;
|
if (note->fLyrics.size() >= stanza
|
||||||
state = kCleanup;
|
&& (note->fLyrics[stanza-1].fKind & VLSyllable::kHasPrev)
|
||||||
break;
|
) {
|
||||||
case ' ':
|
note->fLyrics[stanza-1].fText = "";
|
||||||
//
|
note->fLyrics[stanza-1].fKind = 0;
|
||||||
// Last syllable in word
|
} else
|
||||||
//
|
return;
|
||||||
kind &= ~VLSyllable::kHasNext;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
kind |= VLSyllable::kHasNext;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
note->fLyrics[stanza-1].fText = syll;
|
|
||||||
note->fLyrics[stanza-1].fKind = kind;
|
|
||||||
if (type == '-')
|
|
||||||
kind |= VLSyllable::kHasPrev;
|
|
||||||
else
|
|
||||||
kind &= ~VLSyllable::kHasPrev;
|
|
||||||
break; }
|
|
||||||
case kCleanup:
|
|
||||||
if (nextMeas) {
|
|
||||||
*nextMeas = measure;
|
|
||||||
nextMeas = 0;
|
|
||||||
}
|
|
||||||
if (nextAt) {
|
|
||||||
*nextAt = now;
|
|
||||||
nextAt = 0;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Delete all subsequent syllables with kHasPrev set
|
|
||||||
//
|
|
||||||
if (note->fLyrics.size() >= stanza
|
|
||||||
&& (note->fLyrics[stanza-1].fKind & VLSyllable::kHasPrev)
|
|
||||||
) {
|
|
||||||
note->fLyrics[stanza-1].fText = "";
|
|
||||||
note->fLyrics[stanza-1].fKind = 0;
|
|
||||||
} else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
now += note->fDuration;
|
now += note->fDuration;
|
||||||
++note;
|
++note;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user