GNOME Bugzilla – Bug 347557
mixer interfaces should support gain/balance mode
Last modified: 2009-09-10 07:30:24 UTC
On Solaris, the SunAudio interfaces work as follows: 1) You have input/output gain 2) You have a balance control 3) There are flags to specify what device to send the input and output gain. For example, for output you can pick "built-in speakers", "headphone", "line out", "aux output", etc. However, the mixer interface does not allow the getting or setting of such flags. I have hacked gnome-volume-control to display these flags as checkboxes so the user can pick them. However, it would be better if GStreamer had an interface for finding out what flags exist and allowing you to set them (as booleans). Then g-v-c could be enhanced to show a tab that allows you to set/unset them. I notice in the mixer plugin code a comment that says that the mixer plugin should support flags, but don't notice a bug about it. I thought I'd file a bug explaining a specific use-case where it would be useful.
*** Bug 343615 has been marked as a duplicate of this bug. ***
Note issue #3 above is described in more detail in bug #350667. Issue #1-2 is just a difference in how Sun Audio interfaces work compared to all other hardware. On Solaris, we support a single gain and balance, while other distros seem to support two (right/left) gains. Would be nice GStreamer supported either style.
Note that we currently hack the sunaudio plugin to calculate the single-gain and balance from the two stereo gains. However, due to rounding errors, this sometimes causes the sliders to act a little wonky. Part of the problem is that the GStreamer gains go 0-100 while the SunAudio gain goes from 0-255 and the balance goes from -32 to +32. So converting between these different ranges is part of the reason for the rounding errors. To give an example of what I describe as "wonkyness", if you slide one gain around, the other gain wiggles up and down a little. It might be possible to minimize this sort of wonkyness by making the calculations a bit smarter, or caching the last values and compensating. But it would still be nicer if GStreamer worked either way.
> Part of the problem is that the GStreamer gains go 0-100 while the > SunAudio gain goes from 0-255 and the balance goes from -32 to +32. > So converting between these different ranges is part of the reason > for the rounding errors. I'm not aware of GStreamer having a fixed 0-100 range, I think this is only hardcoded in gstsunaudiomixertrack.c (lines 91-92). You should be able to configure a 0-255 range without problems (if applications like g-v-c or the applet don't handle this right and assume that the max is always 100 that would be a bug in those applications).
Ah, thanks for this tip. I fixed this and created bug #524593 with a patch that fixes the SunAudio mixer plugin to use a more sensible 0-255 range. This makes the code more simple, avoids some rounding errors, and does seem to decrease the "wiggling" so it isn't as bad. However the wiggling is still present. The fact that GStreamer doesn't support a gain/balance mode still causes us to do math to convert between two stereo gains and gain/balance. It would be nice to also support a gain/balance mode. Also, I don't think bug 343615 is really a good duplicate of this bug. It's probably more a duplicate of bug #350667.
"balance" isn't strictly the same as having right/left volume controls. It would probably be a better idea to fix the SunAudio driver to handle separate R/L volume controls.
Since Sun is eventually going to phase out Sun Audio support and replace it with OSS, it probably doesn't make a lot of sense to spend a lot of time on this bug. I don't think that Sun is going to invest much time adding new features to the Sun Audio interface. That said, the OSS replacement of Sun Audio might not happen until as late as 2009. If this enhancement were to get fixed before then, that would be a nice improvement for the user experience. Also, I suspect Solaris 10 (and older) users who want to use GStreamer 0.10 would appreciate this working better, since I believe Sun won't backport OSS to older versions of Solaris. I don't know. It might be worth keeping this bug open just in case it helps inspire someone to improve this. On the other hand, it would probably also be okay to close this bug.
Let's close it then after this long time of no news.