changeset 2071:579abbb51f80

Merged r2906:2907 from 1.2 branch to trunk: power of two channels in dsp backend.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 13 Nov 2006 00:38:13 +0000
parents dbfa1ebd73b0
children 4b3f98a9a2c1
files src/audio/dsp/SDL_dspaudio.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/dsp/SDL_dspaudio.c	Sat Nov 11 06:48:57 2006 +0000
+++ b/src/audio/dsp/SDL_dspaudio.c	Mon Nov 13 00:38:13 2006 +0000
@@ -166,6 +166,15 @@
         devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
     }
 
+    /* Make sure fragment size stays a power of 2, or OSS fails. */
+    /* I don't know which of these are actually legal values, though... */
+    if (this->spec.channels > 8)
+        this->spec.channels = 8;
+    else if (this->spec.channels > 4)
+        this->spec.channels = 4;
+    else if (this->spec.channels > 2)
+        this->spec.channels = 2;
+
     /* Initialize all variables that we clean on shutdown */
     this->hidden = (struct SDL_PrivateAudioData *)
         SDL_malloc((sizeof *this->hidden));