mirror of https://github.com/adamdruppe/arsd.git
ketmar error recovery
This commit is contained in:
parent
19ca76281d
commit
ba58be47b1
|
@ -344,7 +344,7 @@ final class AudioPcmOutThread : Thread {
|
||||||
if(frequencyCounter)
|
if(frequencyCounter)
|
||||||
frequencyCounter--;
|
frequencyCounter--;
|
||||||
if(frequencyCounter == 0) {
|
if(frequencyCounter == 0) {
|
||||||
val = -val;
|
val = -(val);
|
||||||
frequencyCounter = currentSample.frequency / 2;
|
frequencyCounter = currentSample.frequency / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,8 +621,10 @@ struct AudioOutput {
|
||||||
|
|
||||||
while(data.length) {
|
while(data.length) {
|
||||||
written = snd_pcm_writei(handle, data.ptr, data.length / 2);
|
written = snd_pcm_writei(handle, data.ptr, data.length / 2);
|
||||||
if(written < 0)
|
if(written < 0) {
|
||||||
throw new AlsaException("pcm write", written);
|
written = snd_pcm_recover(handle, cast(int)written, 0);
|
||||||
|
if (written < 0) throw new AlsaException("pcm write", written);
|
||||||
|
}
|
||||||
data = data[written * 2 .. $];
|
data = data[written * 2 .. $];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1382,6 +1384,16 @@ extern(C):
|
||||||
snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);
|
snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);
|
||||||
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
|
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
|
||||||
|
|
||||||
|
int snd_pcm_recover (snd_pcm_t* pcm, int err, int silent);
|
||||||
|
|
||||||
|
alias snd_lib_error_handler_t = void function (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...);
|
||||||
|
int snd_lib_error_set_handler (snd_lib_error_handler_t handler);
|
||||||
|
|
||||||
|
private void alsa_message_silencer (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...) {}
|
||||||
|
//k8: ALSAlib loves to trash stderr; shut it up
|
||||||
|
void silence_alsa_messages () { snd_lib_error_set_handler(&alsa_message_silencer); }
|
||||||
|
shared static this () { silence_alsa_messages(); }
|
||||||
|
|
||||||
// raw midi
|
// raw midi
|
||||||
|
|
||||||
static if(is(ssize_t == uint))
|
static if(is(ssize_t == uint))
|
||||||
|
|
Loading…
Reference in New Issue