Gain on an amplifier to meant to be matched to the output voltage of your headunit. Think 3 volt, 4 volt, 5 volt pre out specs you see on headunit specs. This is how gain works for a given pre out(5 volt) theoretically. However most head units clip(start to distort) at around 80% of your volume so your 5 volt pre out wont give 5 volts Cleanly. You will most likely get 4 volts out at something like 33/40 on your volume knob and would thus set your gain to 4 volts. (these things can be measured with a GOOD Multimeter. )
80% of your total volume is (max volume) X 0.8.
Example is 40(is your max volume so, 40 X .8=32