oops, forgot to make the gain a 16-bit var