We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 568

Summary: Native MIDI freezes.
Product: SDL_mixer Reporter: Lukasz Pawelczyk <havner>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: havner, manuel.montezelo, sezeroz
Version: 1.2.8   
Hardware: x86   
OS: Linux   

Description Lukasz Pawelczyk 2008-03-15 08:46:58 UTC
When using SDL_mixer compiled with native midi support it freezes software that uses it. The only two examples I know that can use it this way are: dxx-rebirth and doomsday. I suspect its a bug in SDL_mixer cause both play fine when using timidity backend.

I'm using Audigy 2 ZS on alsa 1.0.14 with OSS emulation. Have no other problems with Native midi support on my system (both, by using alsa-synth and /dev/sequencer). Playmidi (which code I think is used in SDL_mixer) plays fine as well.
Comment 1 Lukasz Pawelczyk 2008-03-16 17:52:46 UTC
I didn't try to fix it, but I wrote alternative sequncer support for SDL-mixer based on alsa-seq. The code needs some cleanups but it already works very well. Would you be interested in its inclusion to SDL-mixer? I also got several questions about internal sdl-mixer functions behaviour. Error handling etc so this would fully follow sdl-mixer policy. Where could I ask them?
Comment 2 Sam Lantinga 2009-10-03 02:58:01 UTC
Sure, I'd love to get a patch for ALSA native midi.  You can ask the questions here, or send e-mail to the SDL mailing list.

Thanks!
Comment 3 Lukasz Pawelczyk 2009-10-03 04:35:12 UTC
Wow, that was a long time ago :-)

Ok, I'll try to get this patch out of attic, dust it off a little and see what can be done with it.

This patch is based on aplaymidi code which is GPL based but I had permission from it's author back then to relicense it to LGPL if it's going to be included in SDL_mixer.
Comment 4 Lukasz Pawelczyk 2009-10-27 07:57:33 UTC
Small update.

I've been working ont his code for the past few days. In general it is very close to be ready (finished lots of things that were left in my TODO 1.5 year ago). The only thing I'm still working on is gracefully stopping of ALSA events. I had some thread race previously that could crash ALSA on some occasions. I've managed to eliminate it but still as I look at that code there is very very rare case that could cause it to crash (although it didn't happen for me in practice).

Anyway I hope this will be ready soon.
Comment 5 manuel.montezelo 2011-12-28 09:49:56 UTC
Debian bug reports [1] and [2] seem related with this problem:

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498984
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=298982
Comment 6 Sam Lantinga 2011-12-31 11:01:35 UTC
I've removed the native MIDI code from SDL_mixer, since it was GPL and the new licensing is zlib.

Lukasz, if you have that ALSA patch ready, please submit a new bug with it attached and let me know! :)