File diff r23519:04e2cd195801 → r23520:20bbc807b0eb
src/music/dmusic.cpp
Show inline comments
 
@@ -683,13 +683,13 @@ static void MidiThreadProc(void *)
 
				/* find first block after start time and pretend playback started earlier
 
				 * this is to allow all blocks prior to the actual start to still affect playback,
 
				 * as they may contain important controller and program changes */
 
				size_t preload_bytes = 0;
 
				for (size_t bl = 0; bl < current_file.blocks.size(); bl++) {
 
					MidiFile::DataBlock &block = current_file.blocks[bl];
 
					preload_bytes += block.data.Length();
 
					preload_bytes += block.data.size();
 
					if (block.ticktime >= current_segment.start) {
 
						if (current_segment.loop) {
 
							DEBUG(driver, 2, "DMusic: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime) / 1000.0, (int)preload_bytes);
 
							current_segment.start_block = bl;
 
							break;
 
						} else {
 
@@ -749,13 +749,13 @@ static void MidiThreadProc(void *)
 

	
 
				/* Timestamp of the current block. */
 
				block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME;
 
				DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
 

	
 
				byte *data = block.data.Begin();
 
				size_t remaining = block.data.Length();
 
				size_t remaining = block.data.size();
 
				byte last_status = 0;
 
				while (remaining > 0) {
 
					/* MidiFile ought to have converted everything out of running status,
 
					 * but handle it anyway just to be safe */
 
					byte status = data[0];
 
					if (status & 0x80) {