# HG changeset patch # User Ryan C. Gordon # Date 1163366637 0 # Node ID aeb55f698ee370cc5b0c89300944547649163206 # Parent 5a20cffc7027b94b8721d0a8eb7c5c4bdd78c34e Block fruity channel values in dspaudio, or the fragment size won't be a power of 2. diff -r 5a20cffc7027 -r aeb55f698ee3 src/audio/dsp/SDL_dspaudio.c --- 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 ) {