EDIT 2: Fix 1.4b - For those using midi_write_record_begin() there were timing issues with 1.4a, the following replacement DLL was created in 2010 upon request but I no longer have the source code. The DLL was compiled with Visual C++ rather than mingw like 1.4a.
This dll allows you to play midi files, individual midi notes, and to write midi files in format 0. It also allows simple recording where all midi note/command output (not file playing however) is written to a file. The midi input is limited and may be buggy, it is completely untested, as I am unable to. It uses the Windows functions rather than allegro functions so midi_init() is not required. I added the digmid capabilities to this dll after I discovered a way for it to work the way I intended; my other dll is therefore decrepit and useless unless you wish to use both at once.
midi_deviceIn_count midi_deviceIn_name midi_deviceOut_count midi_deviceOut_name midi_input_init midi_input_exit midi_input_buffer_length midi_input_get_buffer midi_init midi_init_file midi_init_ext midi_init_dig midi_exit midi_note_play midi_note_play_timed midi_note_stop midi_command midi_volume_edit midi_return_cmd midi_add midi_play midi_stop_all midi_pos_seek midi_length_beats midi_length_seconds midi_pos_beats midi_pos_seconds midi_set_volume_local midi_set_volume_global midi_write_begin midi_write_end midi_write_MThd midi_write_MTrk_begin midi_write_MTrk_tempo midi_write_MTrk_instrument midi_write_MTrk_noteON midi_write_MTrk_noteOFF_all midi_write_MTrk_noteOFF midi_write_MTrk_end midi_write_MTrk_command midi_write_MTrk_size midi_write_record_begin midi_write_record_end
Includes: DLL, GEX, GML scripts, GM6&GMK example.
Download Mirror (~568k)
For information on the function usage, refer to the scripts of the gm6 version, and the game information. For midi and midi_command() information refer to this useful post by dark_master4. Another Useful Link
-many bug fixes, and minor changes
-added a simple midi record and write mechanism ("midi_write_record_begin" "midi_write_record_end"); after it starts recording, all midi notes/commands played (other then playing midi files) are recorded, and then written to a midi file (This is much easier and completely automatic). The timing is probably 99% accurate.
-added basic midi input functions, they are are untested, and may need to be rewritten. They will definitely be improved after testing.
-MTrk_size was renamed midi_write_MTrk_size, and has an extra parameter, it is no longer written in gml but compiled.
-add more option for initialization
-add midi in/out device functions to get information
-digmid is now mostly supported in this dll, my other dll is decrepit and useless
-updated volume change functions to take 2 parameters each: digital volume, midi volume.
-add midi_return_cmd which returns the last standard (not meta or sysex) midi command executed
-removed non operational midi_note_edit and added midi_volume_edit
The source code is provided and anyone may use as they wish. If you really want to have an update/fix, I may consider it; just send an email to me. Another thing is that this dll will not be useful for all of the platforms that YoYogames "believes" it will port GM, unless gm thereof supports linking to static libraries (this would still need modifciation).
Edited by npc3232, 14 November 2011 - 09:38 AM.