<div class="markdown_content"><p>Lately (last couple of years), I haven't managed to gt that Tick Tock MIDI or any other MIDI to crash and actually I think it was never reliable: I think it only happened if the window was minimised/restored at the moment that the song looped, or something like that.<br/>
But now thanks to Fx Ne I've found there are two BAM songs in Timestream Saga that cause the engine to immediately freeze 100% of the time. I've uploaded one as testfiles/GURGU.mid</p>
<p>I can confirm this affects both music_sdl and music_sdl2. But it didn't crash under wine, despite what I said in 2017.</p>
<p>Also, we have quite a few crashreports for this bug, the stacktrace looks like:</p>
<div class="codehilite"><pre><span></span>----- Stacktrace -----
@ modUnprepare + 0x6 
@ modMessage + 0x8 
@ midiStreamMessage + 0x11 
@ midiOutPrepareHeader + 0x14 
@ [SDL_mixer.dll + 0x151cf]
@ CSynth::PlayBuffer + 0x26 
@ CSynth::PlayBuffer + 0x1c 
@ DriverCallback + 0xd
</pre></div>


<p>or one-line summary: modUnprepare <- modMessage <- midiStreamMessage<br/>
The dlls are midimap.dll, winmm.dll, SDL_mixer.dll, wdmaud.drv.</p>
<p>Now, this stacktrace is interesting, because these function names are googlable. There are implementations of midimap.dll, winmm.dll in wine and ReactOS.<br/>
And I found that code for CSynth::PlayBuffer() (real dll: wdmaud.drv) is included as part of a DirectMusic sample software synthesizer implementation in the Windows DDK:<br/>
<a href="http://joyasystems.com/sample-code/Windows%20Driver%20Samples%2FDirectMusic%20Software%20Synthesizer%20Sample%2FC%2B%2B%2Fcsynth.cpp" rel="nofollow">http://joyasystems.com/sample-code/Windows%20Driver%20Samples%2FDirectMusic%20Software%20Synthesizer%20Sample%2FC%2B%2B%2Fcsynth.cpp</a><br/>
Now this isn't the actual source code for any of those dlls, and I don't know how similar it is to the real thing, but it can give insight to what these functions are doing.</p>
<hr/>
<p><strong> <a class="alink" href="https://sourceforge.net/p/ohrrpgce/bugs/2000/">[bugs:#2000]</a> Occasional Midi crash when looping on Windows using music_sdl backend</strong></p>
<p><strong>Status:</strong> open<br/>
<strong>Milestone:</strong> OHRRPGCE<br/>
<strong>Created:</strong> Tue May 13, 2014 04:48 PM UTC by Bob the Hamster<br/>
<strong>Last Updated:</strong> Sun Feb 19, 2017 04:59 AM UTC<br/>
<strong>Owner:</strong> nobody</p>
<p>Sometimes when a midi file loops, it causes the program to crash. This bug is most noticeable on very short midi files that loop rapidly. This only happens when using the music_sdl backend.</p>
<p>See also old archived bug reports:<br/>
<a href="http://rpg.hamsterrepublic.com/bugzilla/show_bug.cgi?id=797" rel="nofollow">http://rpg.hamsterrepublic.com/bugzilla/show_bug.cgi?id=797</a><br/>
<a href="http://rpg.hamsterrepublic.com/bugzilla/show_bug.cgi?id=976" rel="nofollow">http://rpg.hamsterrepublic.com/bugzilla/show_bug.cgi?id=976</a></p>
<hr/>
<p>Sent from sourceforge.net because ohrrpgce@lists.motherhamster.org is subscribed to <a href="https://sourceforge.net/p/ohrrpgce/bugs/">https://sourceforge.net/p/ohrrpgce/bugs/</a></p>
<p>To unsubscribe from further messages, a project admin can change settings at <a href="https://sourceforge.net/p/ohrrpgce/admin/bugs/options.">https://sourceforge.net/p/ohrrpgce/admin/bugs/options.</a>  Or, if this is a mailing list, you can unsubscribe from the mailing list.</p></div>