shithub: riscv

Download patch

ref: 29aa4996828e9052b4682e98e6cabc8986548a79
parent: 5a138029db4a59025fe25a06f2a688d62d73aec3
author: cinap_lenrek <[email protected]>
date: Thu Dec 6 19:12:16 EST 2012

audiohda: handle default amp settings

widgets that do not have Wampovrcap have ther default
amplifier parameters stored in the aydio function group.
only if the amp override bit is *not* set, then the widget
stores its own amplifier parameters and we have to query
its node id, otherwise the audio function group node id.

--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -534,8 +534,10 @@
 
 	if((w->cap & Woutampcap) == 0)
 		return;
-
-	r = cmd(w->id, Getparm, Outampcap);
+	if((w->cap & Wampovrcap) == 0)
+		r = cmd(w->fg->id, Getparm, Outampcap);
+	else
+		r = cmd(w->id, Getparm, Outampcap);
 	zerodb = r & 0x7f;
 	
 	for(i=0; i<2; i++){
@@ -559,8 +561,10 @@
 
 	if((w->cap & Winampcap) == 0)
 		return;
-
-	r = cmd(w->id, Getparm, Inampcap);
+	if((w->cap & Wampovrcap) == 0)
+		r = cmd(w->fg->id, Getparm, Inampcap);
+	else
+		r = cmd(w->id, Getparm, Inampcap);
 	zerodb = r & 0x7f;
 	
 	for(i=0; i<2; i++){
@@ -849,7 +853,7 @@
 		return -1;
 
 	dst = findpath(src);
-	if(!dst)
+	if(dst == nil)
 		return -1;
 
 	/* mute all widgets, clear stream */
@@ -1300,6 +1304,17 @@
 			}
 		}
 	}
+
+	k += snprint(s+k, n-k, "path ");
+	for(w=ctlr->amp; w != nil; w = w->from){
+		k += snprint(s+k, n-k, "%3d %s %lux %lux %lux", w->id.nid, widtype[w->type&7], 
+			(ulong)w->cap, (ulong)w->pin, (ulong)w->pincap);
+		if(w == ctlr->src)
+			break;
+		k += snprint(s+k, n-k, " -> ");
+	}
+	k += snprint(s+k, n-k, "\n");
+
 	return k;
 }