From 4e983b0cadd15b47c611c6d77410ca9733dda553 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 13 Nov 2006 00:38:13 +0000 Subject: [PATCH] Merged r2906:2907 from 1.2 branch to trunk: power of two channels in dsp backend. --- src/audio/dsp/SDL_dspaudio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 80641b150..fa6a9105a 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -166,6 +166,15 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) devname = ((iscapture) ? inputDevices[0] : outputDevices[0]); } + /* 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 (this->spec.channels > 8) + this->spec.channels = 8; + else if (this->spec.channels > 4) + this->spec.channels = 4; + else if (this->spec.channels > 2) + this->spec.channels = 2; + /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden));