comparison src/audio/alsa/SDL_alsa_audio.c @ 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
comparison
equal deleted inserted replaced
4347:38f22ed3a433 4348:b312352d8c8d
505 SDL_SetError("Couldn't set hardware audio parameters: %s", SDL_NAME(snd_strerror)(status)); 505 SDL_SetError("Couldn't set hardware audio parameters: %s", SDL_NAME(snd_strerror)(status));
506 ALSA_CloseAudio(this); 506 ALSA_CloseAudio(this);
507 return(-1); 507 return(-1);
508 } 508 }
509 509
510 /* This is useful for debugging... */ 510 /* This is useful for debugging */
511 #ifdef DEBUG_PERIOD_SIZE 511 if (getenv("SDL_AUDIO_ALSA_DEBUG_PERIOD_SIZE")) {
512 { snd_pcm_uframes_t bufsize; snd_pcm_sframes_t persize; unsigned int periods; int dir; 512 snd_pcm_uframes_t bufsize;
513 SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize); 513 snd_pcm_sframes_t persize;
514 SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir); 514 unsigned int periods; int dir;
515 SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir); 515
516 516 SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
517 fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize); 517 SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, &dir);
518 } 518 SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, &dir);
519 #endif 519
520 fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
521 }
520 522
521 /* Set the software parameters */ 523 /* Set the software parameters */
522 snd_pcm_sw_params_alloca(&swparams); 524 snd_pcm_sw_params_alloca(&swparams);
523 status = SDL_NAME(snd_pcm_sw_params_current)(pcm_handle, swparams); 525 status = SDL_NAME(snd_pcm_sw_params_current)(pcm_handle, swparams);
524 if ( status < 0 ) { 526 if ( status < 0 ) {