summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-01-27 14:00:42 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-01-27 14:00:42 +0100
commit866ee3ab5d0818194cca8c04d1f3ec2ff1d148c9 (patch)
treebef9e6b9cbad7b8d49177c0fd493140b7f7912c9 /sys
parent47bb182b5bf5b6c7f1e5f92eefad5791bafce94c (diff)
audioac97, audiohda: dont block on close, just pad the last block with zeros
Diffstat (limited to 'sys')
-rw-r--r--sys/src/9/pc/audioac97.c5
-rw-r--r--sys/src/9/pc/audiohda.c11
2 files changed, 7 insertions, 9 deletions
diff --git a/sys/src/9/pc/audioac97.c b/sys/src/9/pc/audioac97.c
index 3149458ad..477324870 100644
--- a/sys/src/9/pc/audioac97.c
+++ b/sys/src/9/pc/audioac97.c
@@ -390,16 +390,15 @@ ac97close(Audio *adev, int mode)
{
Ctlr *ctlr;
Ring *ring;
- uchar z[1];
if(mode == OREAD)
return;
- z[0] = 0;
ctlr = adev->ctlr;
ring = &ctlr->outring;
while(ring->wi % Blocksize)
- ac97write(adev, z, sizeof(z), 0);
+ if(writering(ring, (uchar*)"", 1) <= 0)
+ break;
}
static Pcidev*
diff --git a/sys/src/9/pc/audiohda.c b/sys/src/9/pc/audiohda.c
index b29cb04e8..d7e862eb9 100644
--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -1296,7 +1296,7 @@ static void
hdaclose(Audio *adev, int mode)
{
Ctlr *ctlr;
- uchar z[1];
+ Ring *ring;
ctlr = adev->ctlr;
if(mode == OREAD || mode == ORDWR){
@@ -1304,11 +1304,10 @@ hdaclose(Audio *adev, int mode)
streamstop(ctlr, &ctlr->sin);
}
if(mode == OWRITE || mode == ORDWR){
- if(ctlr->sout.active){
- z[0] = 0;
- while(ctlr->sout.ring.wi % Blocksize)
- hdawrite(adev, z, sizeof(z), 0);
- }
+ ring = &ctlr->sout.ring;
+ while(ring->wi % Blocksize)
+ if(writering(ring, (uchar*)"", 1) <= 0)
+ break;
}
}