Copy replaygain application logic from adrian-bl/vanilla