# HG changeset patch # User Sam Lantinga # Date 1255426537 0 # Node ID 67e799ffcadf34a62e6bfd677c1f041811708406 # Parent a24454ed4ac4ed1e76d15d6a404f3b856f883961 ALSA's idea of a "frame" is the same as SDL's idea of a "sample". The frame is a single sample on a single channel, and we've defined the frames for each channel as being interleaved. diff -r a24454ed4ac4 -r 67e799ffcadf src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Tue Oct 13 09:24:05 2009 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Tue Oct 13 09:35:37 2009 +0000 @@ -306,16 +306,16 @@ static void ALSA_PlayAudio(_THIS) { int status; - snd_pcm_uframes_t samps_left; + snd_pcm_uframes_t frames_left; const Uint8 *sample_buf = (const Uint8 *) mixbuf; const int sample_size = ((int) (this->spec.format & 0xFF)) / 8; swizzle_alsa_channels(this); - samps_left = ((snd_pcm_uframes_t) this->spec.samples); + frames_left = ((snd_pcm_uframes_t) this->spec.samples); - while ( samps_left > 0 ) { - status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, samps_left); + while ( frames_left > 0 ) { + status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, frames_left); if ( status < 0 ) { if ( status == -EAGAIN ) { SDL_Delay(1); @@ -338,7 +338,7 @@ continue; } sample_buf += status * sample_size; - samps_left -= status; + frames_left -= status; } }