modularize the resampler/mixer

ml modules and functors would have made this less headache-inducing!