Midi C Library for creating a Game
I'm creating a simple midi based game in C and I am wondering if there are any libraries to load开发者_Python百科 a midi file, play and also manipulate it by getting the note values.
Thanks in advance!
Check SDL. More especifically, SDL_mixer.
Description: SDL_mixer is a sample multi-channel audio mixer library. It supports any number of simultaneously playing channels of 16 bit stereo audio, plus a single channel of music, mixed by the popular MikMod MOD, Timidity MIDI, Ogg Vorbis, and SMPEG MP3 libraries.
If you want to manipulate the MIDI and process its contents yourself rather than just playing it, SDL_Mixer
might not be what you want. In this case I would just read the spec and write your own code. MIDI is an extremely simple format and you can probably write whatever code you need in 15 minutes or so... :-)
I realize this question has already been answered, but I would have to agree with @R.. in that SDL is probably overkill for what you are trying to do. You should also take a look at jdksmidi, a much smaller MIDI library written in C++.
精彩评论