diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2018-06-06 20:58:06 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2018-06-15 23:09:17 +0200 |
commit | a1b7812c7e5e7a25a9eb51fd397b19606451f8e6 (patch) | |
tree | 5c226ff9e73dc4c0cd9ddc2ea4989f84960f0d97 /src/music | |
parent | 11a846e3d517c367112287f797065341e5e5c158 (diff) | |
download | openttd-a1b7812c7e5e7a25a9eb51fd397b19606451f8e6.tar.xz |
Change: Improved looping of title song
Diffstat (limited to 'src/music')
-rw-r--r-- | src/music/dmusic.cpp | 6 | ||||
-rw-r--r-- | src/music/win32_m.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index 3f5ca2255..d48f51e85 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -832,8 +832,8 @@ static void MidiThreadProc(void *) /* end? */ if (current_block == current_file.blocks.size()) { if (current_segment.loop) { - current_block = 0; - clock->GetTime(&playback_start_time); + current_block = current_segment.start_block; + playback_start_time = block_time - current_file.blocks[current_block].realtime * MIDITIME_TO_REFTIME; } else { _playback.do_stop = true; } @@ -1237,7 +1237,7 @@ void MusicDriver_DMusic::PlaySong(const MusicSongInfo &song) _playback.next_segment.start = song.override_start; _playback.next_segment.end = song.override_end; - _playback.next_segment.loop = false; + _playback.next_segment.loop = song.loop; _playback.do_start = true; SetEvent(_thread_event); diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index 3c059ebed..a32318db1 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -302,8 +302,8 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW /* end? */ if (_midi.current_block == _midi.current_file.blocks.size()) { if (_midi.current_segment.loop) { - _midi.current_block = 0; - _midi.playback_start_time = timeGetTime(); + _midi.current_block = _midi.current_segment.start_block; + _midi.playback_start_time = timeGetTime() - _midi.current_file.blocks[_midi.current_block].realtime / 1000; } else { _midi.do_stop = true; } @@ -322,7 +322,7 @@ void MusicDriver_Win32::PlaySong(const MusicSongInfo &song) _midi.next_segment.start = song.override_start; _midi.next_segment.end = song.override_end; - _midi.next_segment.loop = false; + _midi.next_segment.loop = song.loop; DEBUG(driver, 2, "Win32-MIDI: PlaySong: setting flag"); _midi.do_stop = _midi.playing; |