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:
parent
8544a1dc55
commit
f3f194293a
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue