Fix underflow detection for alsa

The old method always returned _RUNNING on some machines.
This new method seems to produce the expected behaviour.

Note: -32 is probably -EPIPE, but the appropriate constant was not
available at this time.
This commit is contained in:
Mathijs van de Nes 2016-02-28 17:01:13 +01:00
parent 8544a1dc55
commit f3f194293a
1 changed files with 2 additions and 2 deletions

View File

@ -317,8 +317,8 @@ impl Voice {
pub fn underflowed(&self) -> bool {
let channel = self.channel.lock().expect("channel underflow");
let state = unsafe { alsa::snd_pcm_state(*channel) };
state == alsa::SND_PCM_STATE_XRUN
let available = unsafe { alsa::snd_pcm_avail(*channel) };
available == -32
}
}