Skip to content

Commit

Permalink
Block fruity channel values in dspaudio, or the fragment size won't be a
Browse files Browse the repository at this point in the history
 power of 2.
  • Loading branch information
icculus committed Nov 12, 2006
1 parent ff46959 commit 313b1f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/audio/dsp/SDL_dspaudio.c
Expand Up @@ -168,6 +168,15 @@ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
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 ) {
Expand Down

0 comments on commit 313b1f0

Please sign in to comment.