MidiSource: Fix memory leak and simplify code
MidiSource: Improve pitch shifting accuracy

Also drop note events whose keys are shifted out of range
instead of clamping them.