midi driver refactoring