Reimplement panning using lookup tables, based on a patch by Christian Borss