Block fruity channel values in dspaudio, or the fragment size won't be a SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Sun, 12 Nov 2006 21:23:57 +0000
branchSDL-1.2
changeset 3895aeb55f698ee3
parent 3894 5a20cffc7027
child 3896 1a327643e741
Block fruity channel values in dspaudio, or the fragment size won't be a
power of 2.
src/audio/dsp/SDL_dspaudio.c
     1.1 --- a/src/audio/dsp/SDL_dspaudio.c	Tue Nov 07 15:17:31 2006 +0000
     1.2 +++ b/src/audio/dsp/SDL_dspaudio.c	Sun Nov 12 21:23:57 2006 +0000
     1.3 @@ -168,6 +168,15 @@
     1.4  	int frag_spec;
     1.5  	Uint16 test_format;
     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 (spec->channels > 8)
    1.10 +        spec->channels = 8;
    1.11 +    else if (spec->channels > 4)
    1.12 +        spec->channels = 4;
    1.13 +    else if (spec->channels > 2)
    1.14 +        spec->channels = 2;
    1.15 +
    1.16  	/* Open the audio device */
    1.17  	audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
    1.18  	if ( audio_fd < 0 ) {