Fixes #2151.
Resolves ppy/osu#1988.
Tidy things up, move logic out of SampleInfo.
And make it more general.