changeset 4348:b312352d8c8d SDL-1.2

Enable the ALSA debug code via environment variable
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Oct 2009 07:04:58 +0000
parents 38f22ed3a433
children 471dac4b41dd
files src/audio/alsa/SDL_alsa_audio.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 17 06:55:17 2009 +0000
+++ b/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 17 07:04:58 2009 +0000
@@ -507,16 +507,18 @@
 		return(-1);
 	}
 
-/* This is useful for debugging... */
-#ifdef DEBUG_PERIOD_SIZE
-{ snd_pcm_uframes_t bufsize; snd_pcm_sframes_t persize; unsigned int periods; int dir;
-   SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
-   SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir);
-   SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir);
+	/* This is useful for debugging */
+	if (getenv("SDL_AUDIO_ALSA_DEBUG_PERIOD_SIZE")) {
+		snd_pcm_uframes_t bufsize;
+		snd_pcm_sframes_t persize;
+		unsigned int periods; int dir;
 
-   fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
-}
-#endif
+		SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
+		SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir);
+		SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir);
+
+		fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
+	}
 
 	/* Set the software parameters */
 	snd_pcm_sw_params_alloca(&swparams);