From 276192f714d6816088791435c1b70dfa7122cdbd Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 4 Mar 2018 23:34:02 +0100 Subject: Change #6684: Cutting point overrides for music base sets This improves bad looping of title screen song from Windows TTD, and fixes a long silence at the end of "Can't get there from here" from Windows TTD. --- src/music/win32_m.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/music/win32_m.cpp') diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index 51528133b..93991d88b 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -209,10 +209,6 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW while (_midi.current_block < _midi.current_file.blocks.size()) { MidiFile::DataBlock &block = _midi.current_file.blocks[_midi.current_block]; - /* check that block is not in the future */ - if (block.realtime / 1000 > playback_time) { - break; - } /* check that block isn't at end-of-song override */ if (_midi.current_segment.end > 0 && block.ticktime >= _midi.current_segment.end) { if (_midi.current_segment.loop) { @@ -223,6 +219,10 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW } break; } + /* check that block is not in the future */ + if (block.realtime / 1000 > playback_time) { + break; + } byte *data = block.data.Begin(); size_t remaining = block.data.Length(); @@ -315,8 +315,8 @@ void MusicDriver_Win32::PlaySong(const MusicSongInfo &song) return; } - _midi.next_segment.start = 0; - _midi.next_segment.end = 0; + _midi.next_segment.start = song.override_start; + _midi.next_segment.end = song.override_end; _midi.next_segment.loop = false; DEBUG(driver, 2, "Win32-MIDI: PlaySong: setting flag"); -- cgit v1.2.3-54-g00ecf