Fix rounding errors that resulted in karaoke syllables drifting

This commit is contained in:
Thomas Goyne 2012-10-09 20:39:43 -07:00
parent 004b41f0eb
commit 9009c963e3
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ wxString AssKaraoke::Syllable::GetText(bool k_tag) const {
wxString ret; wxString ret;
if (k_tag) if (k_tag)
ret = wxString::Format("{%s%d}", tag_type, duration / 10); ret = wxString::Format("{%s%d}", tag_type, (duration + 5) / 10);
size_t idx = 0; size_t idx = 0;
for (std::map<size_t, wxString>::const_iterator ovr = ovr_tags.begin(); ovr != ovr_tags.end(); ++ovr) { for (std::map<size_t, wxString>::const_iterator ovr = ovr_tags.begin(); ovr != ovr_tags.end(); ++ovr) {

View File

@ -375,7 +375,7 @@ int AudioTimingControllerKaraoke::MoveMarker(KaraokeMarker *marker, int new_posi
marker->Move(new_position); marker->Move(new_position);
size_t syl = marker - &markers.front() + 1; size_t syl = marker - &markers.front() + 1;
kara->SetStartTime(syl, new_position); kara->SetStartTime(syl, (new_position + 5) / 10 * 10);
labels[syl - 1].range = TimeRange(labels[syl - 1].range.begin(), new_position); labels[syl - 1].range = TimeRange(labels[syl - 1].range.begin(), new_position);
labels[syl].range = TimeRange(new_position, labels[syl].range.end()); labels[syl].range = TimeRange(new_position, labels[syl].range.end());