MY EARS! IT HURTS!

Why does my computer keep turning the volume to maximum? It appears to have separate settings for headphones and speakers, yet it doesn't always respect them.