On Sun, 15 Nov 2009, Bjorn Danielsson wrote: > The default audio volume has been 95% (aka 62000/65535) since > early days, if I recall correctly. This has worked great for > me for many years, but a while back I installed new equipment > (a Humax HD PVR-1000C cable decoder running Linux so it should > be easy to "assimilate" in theory but I haven't had any time to > spend on that yet) and now I get audio clipping when I connect > the analog outputs to the pvrusb2 composite+stereo ports. > > Lowering the pvrusb2 volume parameter helps, and lowering the > outgoing volume on the source helps too. Lowering both helps > almost too much. > > The only reason why I am posting this here is because I wonder > if anyone else has had reason to reduce the pvrusb2 default audio > volume because of clipping, or reduce the input volume, or both.
This unfortunately is a tougher problem than it should be. The V4L specification basically requires that the driver pass-through asked-for settings (such as audio volume) directly into the hardware, with no translation or other compensation. The reasoning was to ensure that the application gets acccess to the "full range" of possible values. Unfortunately the range of "reasonable" values does not necessarily map to what the hardware can actually do, and this mapping can depend on lots of different aspects of the hardware. Thus the cx25840 module by itself can't really "know" what the reasonable range is because that answer depends on the surrounding parts on the board which of course the device can't know. The only element which really can "know" is the pvrusb2 driver itself, but in order to make this really work right, the pvrusb2 driver should be scaling those settings based on its knowledge of the specific hardware. Without this, effectively we've exported a very hardware-specific attribute (concept of reasonable audio level) out to the application, where it really has no chance to guess correctly. Really, what this is all about is another aspect of where the driver has to correct abstract the behavior of the hardware to the application so that the application should not have to "care" about exactly what kind of hardware it is using. That is after all the whole point behind using a consistent, well defined, constant API across many types of hardware. The V4L spec does suggest that the "default" value be set to something reasonable. This is supposed to be a hint to the application (unfortunately it's a 1-dimensional thing that basically becomes useless once the app decides it wants to change that level). That is why the pvrusb2 driver starts with the value at 62000. This really isn't a good solution, because on the original 29xxx device 62000 might make sense but on a 24xxx device perhaps 60000 is better. This is a real issue because the audio hardware between those two device types is *completely* different. And we're probably just lucky that an HVR-1950's level of "reasonable" audio level might actually match the older 24xxx device. I've had to reduce the level during experimentation here, but honestly I haven't been very motivated to update the driver with a new default because it really isn't the right solution. Unfortunately the "right" solution (i.e. the one that lets the driver abstract & scale the audio level setting correctly) is not allowed by the V4L spec. Also, at this late stage of the game if I change the default level, probably it's going to cause issues for all those MythTV users who have already compensated for the existing settings (yet another reason why this "hint with the default" scheme really sucks). -Mike -- Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8 _______________________________________________ pvrusb2 mailing list [email protected] http://www.isely.net/cgi-bin/mailman/listinfo/pvrusb2
