comparison src/audio/dsp/SDL_dspaudio.c @ 3895:aeb55f698ee3 SDL-1.2

Block fruity channel values in dspaudio, or the fragment size won't be a power of 2.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 12 Nov 2006 21:23:57 +0000
parents 97d0966f4bf7
children a1b03ba2fcd0
comparison
equal deleted inserted replaced
3894:5a20cffc7027 3895:aeb55f698ee3
166 int format; 166 int format;
167 int value; 167 int value;
168 int frag_spec; 168 int frag_spec;
169 Uint16 test_format; 169 Uint16 test_format;
170 170
171 /* Make sure fragment size stays a power of 2, or OSS fails. */
172 /* I don't know which of these are actually legal values, though... */
173 if (spec->channels > 8)
174 spec->channels = 8;
175 else if (spec->channels > 4)
176 spec->channels = 4;
177 else if (spec->channels > 2)
178 spec->channels = 2;
179
171 /* Open the audio device */ 180 /* Open the audio device */
172 audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); 181 audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
173 if ( audio_fd < 0 ) { 182 if ( audio_fd < 0 ) {
174 SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); 183 SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
175 return(-1); 184 return(-1);