Use the plug: ALSA devices for surround sound formats, which have automatic sample format/rate conversion. SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Tue, 13 Oct 2009 09:59:20 +0000
branchSDL-1.2
changeset 4334afadcd7d2319
parent 4333 55717a755897
child 4335 a1a337237d42
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
src/audio/alsa/SDL_alsa_audio.c
     1.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Tue Oct 13 09:56:15 2009 +0000
     1.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Tue Oct 13 09:59:20 2009 +0000
     1.3 @@ -43,9 +43,6 @@
     1.4  /* The tag name used by ALSA audio */
     1.5  #define DRIVER_NAME         "alsa"
     1.6  
     1.7 -/* The default ALSA audio driver */
     1.8 -#define DEFAULT_DEVICE	"default"
     1.9 -
    1.10  /* Whether we should set the buffer size or the period size */
    1.11  /*#define SET_PERIOD_SIZE*/
    1.12  /*#define DEBUG_PERIOD_SIZE*/
    1.13 @@ -172,9 +169,17 @@
    1.14  	
    1.15  	device = SDL_getenv("AUDIODEV");	/* Is there a standard variable name? */
    1.16  	if ( device == NULL ) {
    1.17 -		if (channels == 6) device = "surround51";
    1.18 -		else if (channels == 4) device = "surround40";
    1.19 -		else device = DEFAULT_DEVICE;
    1.20 +		switch (channels) {
    1.21 +		case 6:
    1.22 +			device = "plug:surround51";
    1.23 +			break;
    1.24 +		case 4:
    1.25 +			device = "plug:surround40";
    1.26 +			break;
    1.27 +		default:
    1.28 +			device = "default";
    1.29 +			break;
    1.30 +		}
    1.31  	}
    1.32  	return device;
    1.33  }