Corrected my snd_pcm_writei fix.
Apparently ALSA says "frames" but it means samples...you don't split this into groups by number of channels. The adventure continues. --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404076
This commit is contained in:
parent
41f37eccc5
commit
8df8f52eb1
1 changed files with 7 additions and 8 deletions
|
@ -305,17 +305,16 @@ static __inline__ void swizzle_alsa_channels(_THIS)
|
|||
static void ALSA_PlayAudio(_THIS)
|
||||
{
|
||||
int status;
|
||||
snd_pcm_uframes_t frames_left;
|
||||
snd_pcm_uframes_t samps_left;
|
||||
const Uint8 *sample_buf = (const Uint8 *) mixbuf;
|
||||
const int frame_size = ( ((int) this->spec.channels) *
|
||||
(((int) (this->spec.format & 0xFF)) / 8) );
|
||||
const int sample_size = ((int) (this->spec.format & 0xFF)) / 8;
|
||||
|
||||
swizzle_alsa_channels(this);
|
||||
|
||||
frames_left = ((snd_pcm_uframes_t) this->spec.samples) / this->spec.channels;
|
||||
samps_left = ((snd_pcm_uframes_t) this->spec.samples);
|
||||
|
||||
while ( frames_left > 0 ) {
|
||||
status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, frames_left);
|
||||
while ( samps_left > 0 ) {
|
||||
status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, samps_left);
|
||||
if ( status < 0 ) {
|
||||
if ( status == -EAGAIN ) {
|
||||
SDL_Delay(1);
|
||||
|
@ -337,8 +336,8 @@ static void ALSA_PlayAudio(_THIS)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
sample_buf += status * frame_size;
|
||||
frames_left -= status;
|
||||
sample_buf += status * sample_size;
|
||||
samps_left -= status;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue