Return invalid argument if input source invalid
Fix bug where MIDI sequence was not correctly returned

This bug was originally reported by @thrusound, actually I'm not sure
how MIDI parsing even worked correctly before this fix. =/

Also split MIDI setup into a separate function; this has no reason to be
in the same function which configures the output source.

Added a bit of extra logging here so that if the program returns early,
there is at least some message as to why.