Re: [AD] alsamidi fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
With current CVS, the ALSA driver still tells me that

play: rawmidi.c:306: snd_rawmidi_open: Assertion `(inputp || outputp) && name' failed.
Shutting down Allegro due to signal #6
Aborted (core dumped)

unless I specify a config file. So it looks like some of the default settings simply aren't good enough.

It seems to be a problem with Allegro. The code we use to call snd_rawmidi_open is this:

device = get_config_string(uconvert_ascii("sound", tmp1),
			   uconvert_ascii("alsa_rawmidi_device", tmp2),
			   "default");

err = snd_rawmidi_open(NULL, &handle, device, 0);

And, having checked out alsa-lib's sources, the assert's failing from what is basically this:
assert((NULL || &handle) && device);
Now, AFAIK, '&handle' can never be NULL, which means 'device' must be NULL, which means get_config_string is returning NULL.

I've attached a patch that should fix this issue, but it seems the problem is really in get_config_string, which shouldn't be returning NULL, AFAICT.

- Kitty Cat
Index: src/unix/alsamidi.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/unix/alsamidi.c,v
retrieving revision 1.20
diff -u -r1.20 alsamidi.c
--- src/unix/alsamidi.c	4 Jul 2004 13:44:49 -0000	1.20
+++ src/unix/alsamidi.c	21 Jul 2004 12:53:08 -0000
@@ -104,7 +104,9 @@
 #if ALLEGRO_ALSA_VERSION == 9
       device = get_config_string(uconvert_ascii("sound", tmp1),
 				 uconvert_ascii("alsa_rawmidi_device", tmp2),
-				 "default");
+				 NULL);
+      if (!device)
+	 device = "default";
 
       err = snd_rawmidi_open(NULL, &handle, device, 0);
 #else  /* ALLEGRO_ALSA_VERSION == 5 */


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/