From 7d2e20993f4bb7548b74205b395d477a9606971d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 13 Oct 2009 09:59:20 +0000 Subject: [PATCH] Use the plug: ALSA devices for surround sound formats, which have automatic sample format/rate conversion. Based on feedback from the ALSA development mailing list: http://mailman.alsa-project.org/pipermail/alsa-devel/2009-October/022267.html --HG-- branch : SDL-1.2 --- src/audio/alsa/SDL_alsa_audio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 812cd6fca..b04075e91 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -43,9 +43,6 @@ /* The tag name used by ALSA audio */ #define DRIVER_NAME "alsa" -/* The default ALSA audio driver */ -#define DEFAULT_DEVICE "default" - /* Whether we should set the buffer size or the period size */ /*#define SET_PERIOD_SIZE*/ /*#define DEBUG_PERIOD_SIZE*/ @@ -172,9 +169,17 @@ static const char *get_audio_device(int channels) device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ if ( device == NULL ) { - if (channels == 6) device = "surround51"; - else if (channels == 4) device = "surround40"; - else device = DEFAULT_DEVICE; + switch (channels) { + case 6: + device = "plug:surround51"; + break; + case 4: + device = "plug:surround40"; + break; + default: + device = "default"; + break; + } } return device; }