Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Enigma_Studios

Playing MIDI FIles in C++

This topic is 6591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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???

Share this post


Link to post
Share on other sites
Advertisement
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!

Share this post


Link to post
Share on other sites
MIDI Functions
The following functions are used with MIDI.

    
midiConnect
midiDisconnect
midiInAddBuffer
midiInClose
midiInGetDevCaps
midiInGetErrorText
midiInGetID
midiInGetNumDevs
midiInMessage
midiInOpen
midiInPrepareHeader
midiInProc
midiInReset
midiInStart
midiInStop
midiInUnprepareHeader
midiOutCacheDrumPatches
midiOutCachePatches
midiOutClose
midiOutGetDevCaps
midiOutGetErrorText
midiOutGetID
midiOutGetNumDevs
midiOutGetVolume
midiOutLongMsg
midiOutMessage
midiOutOpen
midiOutPrepareHeader
MidiOutProc
midiOutReset
midiOutSetVolume
midiOutShortMsg
midiOutUnprepareHeader
midiStreamClose
midiStreamOpen
midiStreamOut
midiStreamPause
midiStreamPosition
midiStreamProperty
midiStreamRestart
midiStreamStop


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


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!