[AD] PATCH: sound does not work with linux on PPC or other big endian.

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


Hi,

I'm the maintainer of several allegro using packages in Fedora-extras, as I'm currently working on a new package about which I had some doubts if it would work on PPC I asked on the fedora-extras-list if some PPC users could test it. one PPC user was kind enough todo so. This tested resulted in the finding of a endianness bug in allegro.

More specificly in the digital audio alsa driver of allegro, which is the default driver used by allegro, thus an error in this driver normally results in no sound being available at all. The tester didn't have any sound with lacewing, overgod and the game he was testing for me.

The attached patch fixes this endianness bug in allegro. The problem is that it first sets format to NE (Native Endian)* and then checks if format is either 8 bit or LE (Little Endian) which although it works fine on LE machines will of course fail on BE.

* unless 8 bit sound has been specified in allegrorc .


Regards,

Hans
--- allegro-4.2.0/src/unix/alsa9.c~	2006-02-26 09:11:32.000000000 +0100
+++ allegro-4.2.0/src/unix/alsa9.c	2006-02-26 09:11:32.000000000 +0100
@@ -361,7 +361,7 @@
 	 alsa_bits = 8;
 	 break;
 
-      case SND_PCM_FORMAT_U16_LE:
+      case SND_PCM_FORMAT_U16_NE:
 	 if (sizeof(short) != 2) {
 	    ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported sample format"));
 	    goto Error;


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