Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- a/src/audio/dsp/SDL_dspaudio.c Tue Nov 07 15:17:31 2006 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Sun Nov 12 21:23:57 2006 +0000 @@ -168,6 +168,15 @@ int frag_spec; Uint16 test_format; + /* 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 (spec->channels > 8) + spec->channels = 8; + else if (spec->channels > 4) + spec->channels = 4; + else if (spec->channels > 2) + spec->channels = 2; + /* Open the audio device */ audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); if ( audio_fd < 0 ) {