summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-20 20:45:17 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-20 20:45:17 +0000
commita75eb317520c72ab129ba2164550d68ed07ad560 (patch)
tree441c8fda5fd264434e0ef186c34194d39272072d /sys/src
parentc470e77eae8d37cb084e1b195cba5643b88f8ea7 (diff)
devaudio: attach
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/9/port/devaudio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/src/9/port/devaudio.c b/sys/src/9/port/devaudio.c
index 2af6d9779..a7ff2133a 100644
--- a/sys/src/9/port/devaudio.c
+++ b/sys/src/9/port/devaudio.c
@@ -116,7 +116,7 @@ audioclone(Chan *c, Audio *adev)
static Chan*
audioattach(char *spec)
{
- static int first = 1;
+ static int attached = 0;
Audiochan *ac;
Audio *adev;
Chan *c;
@@ -127,7 +127,7 @@ audioattach(char *spec)
else
i = 0;
for(adev = audiodevs; adev; adev = adev->next)
- if(i-- == 0)
+ if(adev->ctlrno == i)
break;
if(adev == nil)
error(Enodev);
@@ -138,9 +138,10 @@ audioattach(char *spec)
if((ac = audioclone(c, adev)) == nil)
error(Enomem);
- if(first && adev->volwrite){
- first = 0;
-
+ i = 1<<adev->ctlrno;
+ if((attached & i) == 0 && adev->volwrite){
+ attached |= i;
+
strcpy(ac->buf, "speed 44100");
if(!waserror()){
adev->volwrite(adev, ac->buf, strlen(ac->buf), 0);