PDA

View Full Version : Midi Files



Gadget
11-04-2003, 03:05 PM
I thought I posted this yesterday, but I can't see the thread anywhere....

Can I play Midi files using DirectSound? Or do I have to use TMediaPlayer?

Thanks

Useless Hacker
13-04-2003, 06:53 PM
I think you can use DirectMusic for playing midi files.

Darhazer
17-04-2003, 05:17 PM
Ok, I read a lot about DirectSound and DirectMusic and I found nothing about playing external MIDIs - only for generating ones. As I know, DirectSound/DirectMusic don't support any external file type but there are libraries which can be used - or you can write your own procedure for reading wave or MIDI. I cannot write such procedure. Do you know any .pas files available for download, which provide such functions?

Alimonster
22-04-2003, 09:42 AM
You can definitely play midi files with DirectMusic. I forget exactly how, since I don't have the example code to hand, but I think it's just a matter of using loading the tune up with IDirectMusicLoader8.LoadObjectFromFile and then playing the segment w/ IDirectMusicPerformance8.PlaySegment(Ex).

Mike
15-01-2004, 11:00 AM
DirectSound itself doesn't support any external files, it only provides access to wave output devices on system, but DirectMusic plays midi and wav files directly - through it's loader object. DirectMusic supports also sgt and sgp files (DirectMusic native file format), those files are a bit like midi but they can also contain samples for instruments so it's a bit like mod or xms.

You can even play MP3,OGG or any format as long as appropriate audio compression codec is installed and file has standard RIFF header which identificates which codec DirectMusic should use.