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
This commit is contained in:
Vincent Wong 2018-10-21 00:33:29 -07:00 committed by odrling
parent e24ade44ea
commit 7b78a2eb16
1 changed files with 3 additions and 1 deletions

View File

@ -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<AudioMarker*> 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<KaraokeMarker *>(m[0]), new_position);
if (syl < 0) return;