From c48150008bbf43580c5eec958d6f4b43a4d8adb2 Mon Sep 17 00:00:00 2001 From: Vincent Wong Date: Sun, 21 Oct 2018 00:33:29 -0700 Subject: [PATCH] AudioTimingControllerKaraoke: move timing correction above MoveMarker Having the timing correction in MoveMarker is extremely surprising behavior if any other part of the code uses MoveMarker expecting it to work correctly as advertised --- src/audio_timing_karaoke.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audio_timing_karaoke.cpp b/src/audio_timing_karaoke.cpp index b848ef582..510c272c0 100644 --- a/src/audio_timing_karaoke.cpp +++ b/src/audio_timing_karaoke.cpp @@ -379,7 +379,7 @@ int AudioTimingControllerKaraoke::MoveMarker(KaraokeMarker *marker, int new_posi marker->Move(new_position); size_t syl = marker - &markers.front() + 1; - kara->SetStartTime(syl, (new_position + 5) / 10 * 10); + kara->SetStartTime(syl, new_position); labels[syl - 1].range = TimeRange(labels[syl - 1].range.begin(), new_position); labels[syl].range = TimeRange(new_position, labels[syl].range.end()); @@ -406,6 +406,8 @@ void AudioTimingControllerKaraoke::AnnounceChanges(int syl) { } void AudioTimingControllerKaraoke::OnMarkerDrag(std::vector const& m, int new_position, int) { + // Fix rounding error + new_position = (new_position + 5) / 10 * 10; int old_position = m[0]->GetPosition(); int syl = MoveMarker(static_cast(m[0]), new_position); if (syl < 0) return;