Auto Gain control circuit idea
If you want to do this, the right way is to use a log rectifier, and a VCA with a mv/dB response. Parts like SSM2020 have both these (twice in fact, for stereo) on a single chip. (It's obsolete now but you can still find them, or maybe there is a more modern equivalent. The datasheet is well worth studying, it shows a number of excellent gain control applications.)

But you are right to be concerned about dynamics of the music. Any which way, you will lose some of that (depending on the time constants in your circuit). AGC circuits are inherently unsatisfactory in this way (although much modern music has been compressed quite excessively). 

For the problem you describe, it would be a simpler and better solution to simply have a "PAD" switch, to slightly attenuate the laptop. You switch in a potential divider with an attenuation of about 0.7 when the laptop is in circuit. I assume both outputs are capable of driving headphones : if so, you could use values of, say, 100R and 200R; the output will see 300R, and the following amplifier will be driven by an impedance of less than 100R, which should be fine.