macdguy/playablepiano — pull request #1 by FPtje (2014-09-12 18:22:14+00:00)
Title: Preliminary MIDI support

This pull request adds support for the [http://facepunch.com/showthread.php?t=1421522](gmcl_midi) module. In short it does the following:
1. Load the module if it is present
2. When the player starts sitting in the piano, it tries to open a connection to the first MIDI device if it exists.
3. When a note is played on the MIDI device, it is sent to the server.

Some notes:
- A player might want to change MIDI instruments, as there can be more than one connected to the PC
- All notes played by a MIDI device are muted clientside. This is because notes play with a slight delay, this can get REALLY annoying when you actually want to play a song. Players can see that the MIDI device works with the note sprites. This works for now, but you want to look for a clearer way to show that it works
- We must decide what to do regarding the security of loading a clientside module. One could recompile the module and bypass `sv_allowcslua` with it.
- The MIDI implementation should be tested on multiplayer synchronisation. With an actual keyboard notes are much more easily played in rapid succession. Net messages have no QoS, so other clients might not hear the same thing the piano player does. Gmcl_midi tells Lua *exactly* when a MIDI event was received. This information is currently not being used, but it could be used perfectly to synchronize the notes properly with other players if necessary.