i used to play guitar and likes to record a lot, not so much nowadays though (because kids, jobs, that kind of stuff) and i approach that gain switch like i use overdrive pedals and preamps, i know it is not scientifically correct, but it sounds good to my ears
my personal basic rule of thumb is that anything under 32 ohms should use the first gain settings (if for instance we use the usual three gaon switch on DAPs like Fiios or Cayins) , and 32 up to 100 can use up to second gain, and third gain settings for 100 and up. also of course to decrease the volume down first before hitting the gain up so not to damage the earphones and more importantly the ears (reminder to
@Colors too, because i forgot to mention this before). some might not like the "dirty" sound resulted from the overdriving the signal, but i like it in some cases.