Skip to content
Extraits de code Groupes Projets
Valider 8a1ba236 rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Truncate syllables which extend past the end of the line rather than...

Truncate syllables which extend past the end of the line rather than normalizing all of the syllable lengths
parent ef4cd5f5
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -143,17 +143,15 @@ void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) { ...@@ -143,17 +143,15 @@ void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
if (last_end < end_time) if (last_end < end_time)
syls.back().duration += end_time - last_end; syls.back().duration += end_time - last_end;
else if (last_end > end_time) { else if (last_end > end_time) {
// Shrink each syllable proportionately // Truncate any syllables that extend past the end of the line
int start_time = active_line->Start;
double scale_factor = double(end_time - start_time) / (last_end - start_time);
for (size_t i = 0; i < size(); ++i) { for (size_t i = 0; i < size(); ++i) {
syls[i].start_time = start_time + scale_factor * (syls[i].start_time - start_time); if (syls[i].start_time > end_time) {
syls[i].start_time = end_time;
syls[i].duration = 0;
}
else {
syls[i].duration = std::min(syls[i].duration, end_time - syls[i].start_time);
} }
for (int i = size(); i > 0; --i) {
syls[i - 1].duration = end_time - syls[i - 1].start_time;
end_time = syls[i - 1].start_time;
} }
} }
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter