src/audio/alsa/SDL_alsa_audio.c
branchSDL-1.2
changeset 4348 b312352d8c8d
parent 4347 38f22ed3a433
child 4349 471dac4b41dd
     1.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 17 06:55:17 2009 +0000
     1.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Sat Oct 17 07:04:58 2009 +0000
     1.3 @@ -507,16 +507,18 @@
     1.4  		return(-1);
     1.5  	}
     1.6  
     1.7 -/* This is useful for debugging... */
     1.8 -#ifdef DEBUG_PERIOD_SIZE
     1.9 -{ snd_pcm_uframes_t bufsize; snd_pcm_sframes_t persize; unsigned int periods; int dir;
    1.10 -   SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
    1.11 -   SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir);
    1.12 -   SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir);
    1.13 +	/* This is useful for debugging */
    1.14 +	if (getenv("SDL_AUDIO_ALSA_DEBUG_PERIOD_SIZE")) {
    1.15 +		snd_pcm_uframes_t bufsize;
    1.16 +		snd_pcm_sframes_t persize;
    1.17 +		unsigned int periods; int dir;
    1.18  
    1.19 -   fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
    1.20 -}
    1.21 -#endif
    1.22 +		SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
    1.23 +		SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir);
    1.24 +		SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir);
    1.25 +
    1.26 +		fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
    1.27 +	}
    1.28  
    1.29  	/* Set the software parameters */
    1.30  	snd_pcm_sw_params_alloca(&swparams);