Ganging MIXT_STEREOSLIDER16 controls in ossxmix causes left channel to
go to full volume and right channel to be muted although this action is
not apparent from inspection of the slider controls.
The problem is caused by the GangChange function using 8 bit shift and
mask instead of 16 bits.
The attached patch corrects this error and provides two other changes:
1. The function returns without taking any action in the trivial case
where (lval == rval).
2. The previous behaviour raised the channel with the lowest volume to
that of the highest. In some circumstances this could cause annoyance.
The new behaviour sets both channels to a mean value.
regards,
Clive
diff -uar oss-v4.1test0-build080108-src-gpl.bak/cmd/ossxmix/ossxmix.c oss-v4.1test0-build080108-src-gpl/cmd/ossxmix/ossxmix.c
--- oss-v4.1test0-build080108-src-gpl.bak/cmd/ossxmix/ossxmix.c 2008-01-08 21:03:34.000000000 +0000
+++ oss-v4.1test0-build080108-src-gpl/cmd/ossxmix/ossxmix.c 2008-01-17 18:27:16.000000000 +0000
@@ -555,18 +555,26 @@
{
ctlrec_t *srec = (ctlrec_t *) data;
int val, lval, rval;
+ int mask = 0xff, shift = 8;
if (!but->active)
return;
lval = srec->mixext->maxvalue - (int) GTK_ADJUSTMENT (srec->left)->value;
rval = srec->mixext->maxvalue - (int) GTK_ADJUSTMENT (srec->right)->value;
- if (lval < rval)
- lval = rval;
- val = lval | (lval << 8);
+ if (lval == rval)
+ return;
+
+ if (srec->mixext->type == MIXT_STEREOSLIDER16)
+ {
+ shift = 16;
+ mask = 0xffff;
+ }
+ lval = (lval + rval)>>1;
+ val = lval | (lval << shift);
set_value (srec->mixext, val);
- val = srec->mixext->maxvalue - (val & 0xff);
+ val = srec->mixext->maxvalue - (val & mask);
gtk_adjustment_set_value (GTK_ADJUSTMENT (srec->left), val);
gtk_adjustment_set_value (GTK_ADJUSTMENT (srec->right), val);
}
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel