![]() ![]() If you give it the size of the whole file, then it will write the whole file, easy. It makes your job easy as you doesn't have to loop byte per byte. The code speaks for itself, no explaination is needed. But you must first create a file using CreateFile(), after you finished writing the data, then close it using CloseFile(). I think that the code speaks for itself, nothing too complex there, except for one. WriteData(*StartFile, *EndFile - *StartFile)ĬreateIncludeFile("canon.mid", ?StartFile_frunlog, ?EndFile_frunlog) Procedure CreateIncludeFile(Name.s, *StartFile, *EndFile) Pure Basic makes it easy to embed data into your. Anyway, it was just a simple binary data writing, the trick is embedding the file and get its memory address. Someone has written an example on including a file and to dump it to disk, but I can't remember who it was. Since Polaris already taught you how to use pecompiler, I'll guess I'll skip that one. Each MIDI loaded must be given a number, and you use that number to play that particular MIDI file. However, the 0 / zero is the MIDI number. Most of the function is self explanatory. NOTE: For this tutorial, I'm not sure if you can run it using demo version of Pure Basic, this is because it uses Win32 calls.īut as far as simplicity goes, this is all what you need to play a MIDI file inside Pure Basic, MCI way. Just copy/paste to see how other functions works. Open the file to see how to communicate with MCI using Pure Basic, and other available functions. It is supplied with jaPBe, an even more powerfull editor (it's free and open source, written with Pure Basic too -P) for Pure Basic. There is a midi.pbi written by a very helpful person, but I don't know his name. So before I went into some long code, I want to cover music first.įirst, I will give credits where it's due. 1 - graphics programming with Pure Basic is easy. NOTE: I stray away from Polaris' tutorial for a reason. If your idea of music is techno, electronic, etc - this file format might be useless, but having access to a lot of real world musical intruments, and writing tunes & melody using notation software, or MIDI hardware - for a small size file, IT IS GREAT! The MIDI file format is alive, well, and NOT updated means something - it can stand the test of time. ![]() ![]() If you think that MIDI is dead, think again. It's still a good way to add a music to your demos. use fmod - it supports loading MIDI-files from memory.Ĥ.Why part 1? Simply, for now I'm teaching you how to play a MIDI file using MCI and NOT DirectX. copy the included Binary to a tempfile on HDD and load & play it using the Movie-commands, orĢ. The Movie-Lib can play MIDI-files, but there's no CatchMovie()-commandġ. It only supports sounds based on sampledata. > So,playback through the Sound-Lib will not work. (There's a standard-set of instruments, so a piano will always be a piano, but some sound really ugly) You can even route these information to the external MIDI-port.Īll these ways have in common, that the sound you hear during playing back a MIDI-file are generated in realtime and can differ from soundcard to soundcard. All these infos are streamed to a MIDI-synthesizer, which is implemented in Windows as a software-module, but can be on the soundcard as a hardware-interface. It stores information about the used instrument, the pressed/released note, the volume of one of the 16 virtual channels, and a lot more of these information. It is not based on (maybe compressed) samplevalues. The Midi-format is totally different from those like WAV, MP3, etc. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |