Skip to content

Commit

Permalink
Enable the ALSA debug code via environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 17, 2009
1 parent 002bd85 commit 4d9eeb3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -507,16 +507,18 @@ static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec)
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);

fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
}
#endif
/* 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;

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);
Expand Down

0 comments on commit 4d9eeb3

Please sign in to comment.