Skip to content
Permalink
Browse files
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.
  • Loading branch information
slouken committed Oct 13, 2009
1 parent 5ac5475 commit fb4784dde8a24231cc07a8ec997a3caaf1e0e8de
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/audio/alsa/SDL_alsa_audio.c
@@ -306,16 +306,16 @@ static __inline__ void swizzle_alsa_channels(_THIS)
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 @@ static void ALSA_PlayAudio(_THIS)
continue;
}
sample_buf += status * sample_size;
samps_left -= status;
frames_left -= status;
}
}

0 comments on commit fb4784d

Please sign in to comment.