Excerpt from !239 (merged), submitted separately to relieve some review burden. Some comments might not make a lot of sense unless !239 (merged) is merged first though, but it is well applicable to HSP/HFP too.
Use software volume to compensate for lack in hardware granularity, provide stereo balance, and >100% amplification.
This compensates discrepancies between requested volume and actual volume represented by the 127-step A2DP range or 15-step HSP/HFP range, including setting volume above 100% without any additional logic; the delta simply becomes larger. The delta is calculated per channel against "mono" hardware volume on the remote to also take care of differences in balance. The remote uses the maximum volume of all channels and software is used to attenuate below that (or above, if one or more channels are set above 100%).
Note that this does NOT take the actual volume on the remote into account yet! Most headphones don't use the full range, and instead round to the nearest multiple of some arbitrarily chosen step size. They do reply with this value, which we should consequently retrieve and deal with.
Fixes #1245 (closed)