Advertisement

Playing MIDI FIles in C++

Started by September 02, 2000 07:37 PM
10 comments, last by Enigma_Studios 24 years, 3 months ago
I am looking for some free source code that lets me play MIDI files in programs, that i can distribute with no extra charges. If it is easy to write a C++ MIDI player, how do I do this???
It''s easier to play midi using some drivers, like SBFMDRV.EXE (I''m just reading some old programming books, so it might be incorrect). You use the FM Synthesizer. I don''t know if that still works in Windows, as this is a DOS programming book. I don''t see anything in here on MIDI code, but there''s plenty on VOC!

Advertisement
MIDI Functions
The following functions are used with MIDI.

    midiConnectmidiDisconnectmidiInAddBuffermidiInClosemidiInGetDevCapsmidiInGetErrorTextmidiInGetIDmidiInGetNumDevsmidiInMessagemidiInOpenmidiInPrepareHeadermidiInProcmidiInResetmidiInStartmidiInStopmidiInUnprepareHeadermidiOutCacheDrumPatchesmidiOutCachePatchesmidiOutClosemidiOutGetDevCapsmidiOutGetErrorTextmidiOutGetIDmidiOutGetNumDevsmidiOutGetVolumemidiOutLongMsgmidiOutMessagemidiOutOpenmidiOutPrepareHeaderMidiOutProcmidiOutResetmidiOutSetVolumemidiOutShortMsgmidiOutUnprepareHeadermidiStreamClosemidiStreamOpenmidiStreamOutmidiStreamPausemidiStreamPositionmidiStreamPropertymidiStreamRestartmidiStreamStop     


I copied it from the MSVC help. Maybe it''ll help a bit...


Oh, just use DirectMusic, you sissies!

-Domenic-
Geek^n
-Domenic-Geek^n
Ack! If you just want something to play midi, you can use something as simple as the Win32 MM interface (mcisendstring, etc), or you can use DirectMusic. If you want, the Gauntlet Style Project located on this site using DirectMusic to play midi files, and it''s open source. Simply use the sound.cpp & sound.h under the core functions download. Please give credit where credit is due if you decide to use it!

In the next day or two, I''ll be uploading some new updates that fix a loop bug in the midi playback functions.


Jim Adams
FMOD now has midi file support!
www.fmod.org

Edited by - Zipster on September 3, 2000 3:04:00 AM
Advertisement
It''s much easer using my code in watcom c++ or i can tell you how to play midi in FM-Synth mode, There are two codes i suggest
to you:
1. Allegro - midi.c & adlib.c & fminst.h
2. LDrawSDK (my works) - lkeymidi.c
sorry, i''m studying english, maybe some words are wrong
Playing midi require SoundBlaster programming and FM Synth Programming, the code is in my LDrawSDK you can get it from
my homepage http://newbird.126.com. I can mail you one if you want

I am a game programming fan in china
I am crying in programming !
I could send you the files from the Tricks of the Windows Game Programming Gurus that can play midi. They''re really easy to use too.




"NPC's are people too!" --dwarfsoft

"Nazrix is cool." --Nazrix first, then Darkmage
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Nazrix - The only problem with the code for midi files in that book is that sometimes, on some midis, it doesn''t play all the tracks on the midi. At least that''s what happened with all the midi files on my computer.

=======================================
A man with no head is still a man.
A head with no man is plain freaky.
Zipster,

I did not realize that. I have only tried 2 midis and they were the ones that were on the CD that came w/ the book. They seemed to work as far as I could tell




"NPC's are people too!" --dwarfsoft

"Nazrix is cool." --Nazrix first, then Darkmage
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement