ref: d41f67c2b9cf3f915b12d113bd5952ce90062c8a
parent: 0b268440b9d557f64cba6f7db644a6536fa2b158
author: cinap_lenrek <[email protected]>
date: Fri Feb 1 10:23:38 EST 2013
audio: fix delay control, increase default buffer delay to 40ms just doing a single sleep isnt enougth, as we get woken up for every block!
--- a/sys/src/9/pc/audioac97.c
+++ b/sys/src/9/pc/audioac97.c
@@ -381,7 +381,8 @@
}
p += n;
}
- sleep(&ring->r, outrate, ctlr);
+ while(outrate(ctlr) == 0)
+ sleep(&ring->r, outrate, ctlr);
return p - (uchar*)vp;
}
--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -1288,7 +1288,8 @@
p += n;
}
hdakick(ctlr);
- sleep(&ring->r, outrate, ctlr);
+ while(outrate(ctlr) == 0)
+ sleep(&ring->r, outrate, ctlr);
return p - (uchar*)vp;
}
--- a/sys/src/9/pc/audiosb16.c
+++ b/sys/src/9/pc/audiosb16.c
@@ -549,7 +549,8 @@
}
p += n;
}
- sleep(&ctlr->vous, ratebuf, ctlr);
+ while(ratebuf(ctlr) == 0)
+ sleep(&ctlr->vous, ratebuf, ctlr);
return p - (uchar*)vp;
}
--- a/sys/src/9/port/devaudio.c
+++ b/sys/src/9/port/devaudio.c
@@ -146,7 +146,7 @@
if((attached & i) == 0){
static char *settings[] = {
"speed 44100",
- "delay 882", /* 20 ms */
+ "delay 1764", /* 40 ms */
"master 100",
"audio 100",
"head 100",
--- a/sys/src/cmd/nusb/audio/audio.c
+++ b/sys/src/cmd/nusb/audio/audio.c
@@ -14,7 +14,7 @@
int maxfreq;
};
-int audiodelay = 882;
+int audiodelay = 1764; /* 40 ms */
int audiofreq = 44100;
int audiochan = 2;
int audiores = 16;