# HG changeset patch # User steve # Date 1007488448 0 # Node ID 66134af212789dbd541f07afc1e82063ac91074d # Parent a3739b590cf2ad2a6f9c5ecb793aaa8da43c50e4 fixed to check that SNDCTL_DSP_CHANNELS actually grants the requested number of channels diff -r a3739b590cf2 -r 66134af21278 libao2/ao_oss.c --- a/libao2/ao_oss.c Tue Dec 04 17:24:25 2001 +0000 +++ b/libao2/ao_oss.c Tue Dec 04 17:54:08 2001 +0000 @@ -129,8 +129,9 @@ // We only use SNDCTL_DSP_CHANNELS for >2 channels, in case some drivers don't have it ao_data.channels = channels; if (ao_data.channels > 2) { - if (ioctl (audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1) { - printf("audio_setup: Failed to set audio device to %d channels\n", ao_data.channels); + if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1 || + ao_data.channels != channels ) { + printf("audio_setup: Failed to set audio device to %d channels\n", channels); return 0; } } @@ -141,7 +142,7 @@ return 0; } } - printf("audio_setup: using %d channels (requested: %d)\n", ao_data.channels, ao_data.channels); + printf("audio_setup: using %d channels (requested: %d)\n", ao_data.channels, channels); // set rate ao_data.samplerate=rate; ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);