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.
This commit is contained in:
Niels Martin Hansen
2018-03-04 23:34:02 +01:00
committed by Michael Lutz
parent 836d25e738
commit 276192f714
6 changed files with 56 additions and 19 deletions

View File

@@ -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");