changeset 3319:66134af21278

fixed to check that SNDCTL_DSP_CHANNELS actually grants the requested number of channels
author steve
date Tue, 04 Dec 2001 17:54:08 +0000
parents a3739b590cf2
children ac8b70dd5e45
files libao2/ao_oss.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);