In the mixing routine of my player I naively implement volume & panning as follows:
leftVolume = ( volume * ( 255 - panning ) ) / 256
rightVolume = ( volume * panning ) / 256
left Channel Mix Data += ( leftVolume * sampleData ) / 64
right Channel Mix Data += ( rightVolume * sampleData ) / 64
Where volume is in a 0..64 range and panning in a 0..255 range. In practice the order of the divisions are a bit different to prevent loss of resolution (I use fixed point) but this is the general idea.
Now I always supposed this was "accurate enough", and how "most people do it", but it really isn't, right? Since volumes follow a logarithmic scale. According to
http://weaselaudiolib.sourceforge.net/#panning_law FastTracker 2 uses a logarithmic curve.
Does anybody have some background information about this, like theory, formulas, lookup tables, how to properly implement volume, panning, and so on?
(Edit: corrected the formula, made a copy-paste error there initially )