Merged r2906:2907 from 1.2 branch to trunk: power of two channels in dsp backend.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 13 Nov 2006 00:38:13 +0000
changeset 2071579abbb51f80
parent 2070 dbfa1ebd73b0
child 2072 4b3f98a9a2c1
Merged r2906:2907 from 1.2 branch to trunk: power of two channels in dsp backend.
src/audio/dsp/SDL_dspaudio.c
     1.1 --- a/src/audio/dsp/SDL_dspaudio.c	Sat Nov 11 06:48:57 2006 +0000
     1.2 +++ b/src/audio/dsp/SDL_dspaudio.c	Mon Nov 13 00:38:13 2006 +0000
     1.3 @@ -166,6 +166,15 @@
     1.4          devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
     1.5      }
     1.6  
     1.7 +    /* Make sure fragment size stays a power of 2, or OSS fails. */
     1.8 +    /* I don't know which of these are actually legal values, though... */
     1.9 +    if (this->spec.channels > 8)
    1.10 +        this->spec.channels = 8;
    1.11 +    else if (this->spec.channels > 4)
    1.12 +        this->spec.channels = 4;
    1.13 +    else if (this->spec.channels > 2)
    1.14 +        this->spec.channels = 2;
    1.15 +
    1.16      /* Initialize all variables that we clean on shutdown */
    1.17      this->hidden = (struct SDL_PrivateAudioData *)
    1.18          SDL_malloc((sizeof *this->hidden));