[SDL] endianness in SDL_audio.c

Patrice Mandin mandin.patrice at wanadoo.fr
Thu Jan 27 07:37:42 PST 2005


Le Thu, 27 Jan 2005 15:40:06 +0100 (CET)
Frode Tennebø <frodet at nvg.ntnu.no> a écrit:

> I had a small problem with an audio stream in LSB while the application 
> ran on an Sparc (big-endian). It took some time tracking it down, but I 
> believe I have found a solution. However, I'm not sure if the original 
> code was intended that way or not, but this Works For Me (tm):
> 
> ft at alne:/usr/junk/ft/src/misc/SDL-1.2.8/src/audio>diff -Naur 
> SDL_audio.c.old SDL_audio.c
> --- SDL_audio.c.old     Mon Dec 13 08:54:31 2004
> +++ SDL_audio.c Thu Jan 27 13:51:51 2005
> @@ -468,7 +468,8 @@
>         /* See if we need to do any conversion */
>         if ( obtained != NULL ) {
>                 memcpy(obtained, &audio->spec, sizeof(audio->spec));
> -       } else if ( desired->freq != audio->spec.freq ||
> +       } 
> +       if ( desired->freq != audio->spec.freq ||
>                      desired->format != audio->spec.format ||
>                     desired->channels != audio->spec.channels ) {
>                 /* Build an audio conversion block */
> 
> Could somebody who knows the audio subsystem comment on the sanity of
> the fix?

You're right somewhere. I think there is also a problem. I build SDL for
Atari (m68k, big-endian), and the loopwave SDL demo program was not
playing sample.wav correctly. And I was wondering where the bug was. More
investigation needed.

-- 
Patrice Mandin
WWW: http://membres.lycos.fr/pmandin/
Programmeur Linux, Atari
Spécialité: Développement, jeux





More information about the SDL mailing list