No description
Find a file
Sam Lantinga 2c65409ade Here are patches for SDL12 and SDL_mixer for 4 or 6 channel
surround sound on Linux using the Alsa driver.  To use them, naturally
you need a sound card that will do 4 or 6 channels and probably also a
recent version of the Alsa drivers and library.   Since the  only  SDL
output  driver  that  knows  about  surround sound is the Alsa driver,
you���ll want to choose it, using:

     export SDL_AUDIODRIVER=alsa

     There are no syntactic changes to the  programming  API.  No  new
library calls, no differences in arguments.

     There are two semantic changes:

(1) For library calls with number of channels as an argument, formerly
     you  could  use only 1 or 2 for the number of channels.   Now you
     can also use 4 or 6.

(2) The two "left" and "right" arguments to Mix_SetPanning,   for  the
     case of 4 or 6 channels,  no longer simply control the volumes of
     the left and right channels. Now the "left" argument is converted
     to an angle and Mix_SetPosition is called,  and the "right" argu-
     ment is ignored.

     With two exceptions,  so far as I know,  the modified  SDL12  and
SDL_mixer work the same way as the original versions,  when opened for
1  or  2  channel output.   The two exceptions are bugs which I fixed.
Well, the first, anyway, is a bug for sure.   When rate conversions up
or down by a factor of two are applied (in  src/audio/SDL_audiocvt.c),
streams with different numbers of channels (that is,  mono and stereo)
are treated the same way:  either each sample is copied or every other
sample is omitted.  This is ok for mono, but for stereo,  it is frames
that should be copied or omitted, where by "frame" I mean a portion of
the stream containing one sample for each channel. (In the SDL source,
confusingly,   sometimes  frames are called "samples".)   So for these
rate conversions,  stereo streams have to be treated differently,  and
they are, in my modified version.

     The other problem that might be characterized  as  a  bug  arises
when  SDL_mixer  is passed a multichannel chunk which does not have an
integral number of frames.   Due to the way the  effect_position  code
loops  over frames,  when the chunk ends with a partial frame,  memory
outside the chunk buffer will be accessed.   In the  case  of  stereo,
it���s possible that because malloc may give more memory than requested,
this potential problem never actually causes a segment fault.  I don���t
know.   For 6 channel chunks,  I do know,  and it does  cause  segment
faults.


     If SDL_mixer is passed defective chunks and this causes a segment
fault, arguably, that���s not a bug in SDL_mixer.  Still, whether or not
it counts as a bug, it���s easy to protect against, so why not?  I added
code in mixer.c to discard any partial frame at the end of a chunk.

     Then what about when SDL or SDL_mixer is opened for 4 or 6  chan-
nel  output?    What  happens  with  the  parts of the current library
designed for stereo?  I don���t know whether I���ve covered all the bases,
but I���ve tried:

(1) For playing 2 channel waves, or other cases where SDL knows it has
     to match up a 2 channel source with a 4 or 6 channel output, I���ve
     added code in SDL_audiocvt.c to make the necessary conversions.

(2) For playing midis using timidity,  I���ve converted timidity to do 4
     or 6 channel output, upon request.

(3) For playing mods using mikmod,  I put ad hoc code  in  music.c  to
     convert  the  stereo  output that mikmod produces to 4 or 6 chan-
     nels.   Obviously it would be better to change the mikmod code to
     mix down into 4 or 6 channels,  but I have a hard time  following
     the code in mikmod, so I didn���t do that.

(4) For  playing mp3s,  I put ad hoc code in smpeg to copy channels in
     the case when 4 or 6 channel output is needed.

(5) There seems to be no problem with .ogg files - stereo .oggs can be
     up converted as .wavs are.

(6) The  effect_position  code  in SDL_mixer is now generalized to in-
     clude the cases of 4 and 6 channel streams.

     I���ve done a very limited amount of compatibility testing for some
of  the games using SDL I happen to have.   For details,  see the file
TESTS.

     I���ve put into a separate archive,  Surround-SDL-testfiles.tgz,  a
couple of 6 channel wave files for testing and a 6 channel  ogg  file.
If you have the right hardware and version of Alsa, you should be able
to  play  the  wave  files  with  the Alsa utility aplay (and hear all
channels, except maybe lfe, for chan-id.wav, since it���s rather faint).
Don���t expect aplay to give good sound,   though.    There���s  something
wrong with the current version of aplay.

     The canyon.ogg file is to test loading of 6 channel oggs.   After
patching and compiling, you can play it with playmus.   (My version of
ogg123 will not play it,  and I had to patch mplayer to get it to play
6 channel oggs.)

Greg Lee <greg@ling.lll.hawaii.edu>
Thus, July 1, 2004

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40943
2004-08-21 12:27:02 +00:00
docs *** empty log message *** 2004-05-16 18:09:20 +00:00
include Use the canonical glext.h on MacOS X as well (#define NO_SDL_GLEXT if you don't want this) 2004-08-20 22:32:05 +00:00
src Here are patches for SDL12 and SDL_mixer for 4 or 6 channel 2004-08-21 12:27:02 +00:00
test Added an option to show the logo at the cursor position for debugging 2004-08-20 22:33:11 +00:00
.cvsignore Fixed "dist" make target for newer versions of automake 2003-12-14 06:25:53 +00:00
acinclude.m4 Date: Tue, 01 Jun 2004 15:27:44 +0300 2004-08-21 04:20:00 +00:00
autogen.sh *** empty log message *** 2002-04-13 14:44:33 +00:00
Borland.html *** empty log message *** 2003-07-01 01:18:27 +00:00
Borland.zip *** empty log message *** 2003-07-01 01:18:27 +00:00
BUGS *** empty log message *** 2004-08-20 19:42:44 +00:00
config.guess Updated libtool support so Mingw32 builds work. 2003-10-06 07:13:16 +00:00
config.sub Date: Sat, 24 Apr 2004 15:13:32 +0300 2004-05-06 15:55:06 +00:00
configure.in Date: Tue, 01 Jun 2004 15:27:44 +0300 2004-08-21 04:20:00 +00:00
COPYING
CREDITS Lots of people have contributed cash. :) 2004-02-15 22:04:46 +00:00
CWprojects.sea.bin Update the version on the SDL shared library. Use SDL stub library for tests. 2004-02-14 06:04:41 +00:00
docs.html *** empty log message *** 2004-02-17 18:21:46 +00:00
EpocBuildFiles.zip Added support for building SDL for EPOC/SymbianOS 6.0 (thanks Hannu!) 2001-12-14 12:37:34 +00:00
INSTALL Date: Tue, 2 Mar 2004 11:34:54 +0100 2004-03-02 13:01:02 +00:00
ltmain.sh Date: Sat, 24 Apr 2004 15:13:32 +0300 2004-05-06 15:55:06 +00:00
Makefile.am Remove automake junk before generating a snapshot 2004-02-16 04:37:56 +00:00
Makefile.dc Added initial support for Dreamcast (thanks HERO!) 2002-10-05 16:50:56 +00:00
MPWmake.sea.bin Updated projects with cpuinfo API 2004-02-10 17:34:38 +00:00
PBProjects.tar.gz The tenth time is the charm... 2004-05-20 10:05:59 +00:00
README QNX is now officially supported! Thanks to Mike Gorchak! 2003-08-30 17:09:59 +00:00
README-SDL.txt
README.AmigaOS
README.CVS *** empty log message *** 2004-05-16 22:37:59 +00:00
README.DC Added initial support for Dreamcast (thanks HERO!) 2002-10-05 16:50:56 +00:00
README.Epoc Added support for building SDL for EPOC/SymbianOS 6.0 (thanks Hannu!) 2001-12-14 12:37:34 +00:00
README.MacOS Date: Sat, 8 Sep 2001 04:42:23 +0200 2001-09-11 19:00:18 +00:00
README.MacOSX Instructive comments from Max Horn 2004-03-04 05:39:17 +00:00
README.MiNT Atari CD-ROM support 2003-09-27 08:20:26 +00:00
README.NanoX Date: Sat, 24 Aug 2002 22:20:01 -0600 2002-08-25 06:21:49 +00:00
README.PicoGUI Added initial support for PicoGUI (thanks Micah!) 2002-08-01 23:24:13 +00:00
README.QNX Date: Sat, 24 Apr 2004 15:13:32 +0300 2004-05-06 15:55:06 +00:00
README.Qtopia Added a README for Qtopia 2002-06-01 18:43:51 +00:00
README.WinCE Updated for embedded Visual C++ 4.0 2002-08-20 00:20:06 +00:00
sdl-config.in Fixed static linking on MacOS X (thanks Max!) 2004-02-11 07:09:11 +00:00
sdl.m4 Updated for the latest version of automake 2004-01-29 16:14:09 +00:00
SDL.qpg.in Date: Tue, 2 Mar 2004 08:52:20 +0200 2004-03-02 12:38:27 +00:00
SDL.spec.in *** empty log message *** 2002-05-31 04:45:46 +00:00
strip_fPIC.sh Fixed to work on Solaris x86 2001-05-10 20:19:50 +00:00
TODO *** empty log message *** 2001-08-18 10:33:55 +00:00
VisualC.html Added Visual C++ 7 (.NET) projects (thanks James!) 2002-10-08 15:43:40 +00:00
VisualC.zip Fixed "dist" make target for newer versions of automake 2003-12-14 06:25:53 +00:00
VisualC7.zip *** empty log message *** 2004-07-18 19:44:06 +00:00
VisualCE.zip Updated for embedded Visual C++ 4.0 2002-08-20 00:20:06 +00:00
WhatsNew *** empty log message *** 2004-01-08 16:01:07 +00:00

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 1.2

---
http://www.libsdl.org/

This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.

SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Java, Lua, ML,
Objective C, Perl, PHP, Pike, Python, and Ruby.

The current version supports Linux, Windows, BeOS, MacOS, MacOS X,
FreeBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.  The code contains
support for Windows CE, AmigaOS, Dreamcast, Atari, NetBSD, AIX, OSF/Tru64,
RISC OS, and SymbianOS, but these are not officially supported.

This library is distributed under GNU LGPL version 2, which can be
found in the file  "COPYING".  This license allows you to use SDL
freely in commercial programs as long as you link with the dynamic
library.

The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation is available in HTML format in "./docs/index.html"

The test programs in the "test" subdirectory are in the public domain.

Frequently asked questions are answered online:
	http://www.libsdl.org/faq.php

If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
	http://www.libsdl.org/mailing-list.php

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)