'MIDI' was not declared in this scope

You need to correct the code you didn't post.

HTH