![]() This is because there might be different plugins and/or codecs installed, (or not) on othermachines. You may even be able to play more formats thanwhat is shown on this list:Ģ34 SoundsMovie Files: Audio Video Interleave (‘*.avi’) MPEG Video (‘*.mpg’)Audio Files: Midi Files (‘*.mid’) MP3 Files (‘*.mp3’) Ogg Vorbis (‘*.ogg’) Wave Files (‘*.wav’)The ‘Movie’ library may seem like a ‘one stop shop’ for all your media playing needs and some peoplehave even asked for it to be renamed to the ‘Media’ library, but the one thing to remember is that ifsomething loads and plays on your computer, it might not load and play on another person’scomputer. #Mp3d purebasic movieNot only can you play movie formatsusing these commands, but you can also play audio file formats.Here is a list of the more popular file formats that the ‘Movie’ library is able to play as long as therequired plugins and/or codecs are installed first. The ‘Movie’ library provides a convenient way to load and playnearly all media that has a codec installed on the host computer. It mayseem a little odd using the movie commands to play mp3 files but the movie commands are capable ofmuch more than just playing movies. #Mp3d purebasic licenseThis license also prevents the‘Midas11.dll’ file being included within the PureBasic package, so you have to download it for yourselffrom the ‘Housemarque Audio System’ website, which can be found in Appendix A (Useful InternetLinks).To learn about other commands that can be used to manipulate module files, see the module libraryin the PureBasic helpfile (Helpfile:Reference Manual->2D Games Libraries->Module).Mp3’sMP3 files are quickly becoming the most popular sound file format of all time, largely due to the factthat the MP3 file format is the de-facto standard for nearly all downloadable music on the Internet.MP3 is an anacronym that stands for ‘MPEG-1 Audio Layer 3’ which is quite a mouthful, so you willprobably understand why it was shortened.MP3 files are handled a little bit differently in PureBasic and in order to play them we must use thecommands from the ‘Movie’ library (Helpfile:Reference Manual->General Libraries->Movie). You may think that this isn’t too bad but the license connected to usingthis ‘Midas’ library forbids the use of it for any commercial purposes. ![]() This dynamic linked library is loaded by the command ‘InitModule()’ andwill error if it doesn’t find it. The second downside is that you have to distribute the ‘Midas11.dll’ filealong with your program. ![]() There are however, ways ofstoring the module in your executable, and then writing it to disk before loading and playing it, but thisis a little bit cumbersome. This means that youhave to distribute all the used module files along with your executable. The first is that there is noeasy way to embed and load from memory any modules that need to be played. To stop the module from playing you can use the ‘StopModule()’ command.The Downsides Of Using ModulesThere are two big downsides of using modules in your PureBasic programs. Just like the‘PlaySound()’ command, this one takes one parameter, which is the PB number of the module youwant to play. This command takes twoparameters, the first is the PB number that you wish to be associated with this module and the secondis the filename of the module to be loaded.Once it’s loaded we can play this module at any time using the ‘PlayModule()’ command(Helpfile:Reference Manual->2D Games Libraries->Module->PlayModule). Sounds 233Once the environment is set up we can load a module by using the ‘LoadModule()’ command(Helpfile:Reference Manual->2D Games Libraries->Module->LoadModule). Both of these commands should be tested to ensure that both areinitialized correctly. Next, we need to initialize the module playing capabilities of PureBasic byusing the ‘InitModule()’ command. 15000 StopModule(#MODULE_FILE) End EndIf EndIfFirst, we need to initialize the sound environment just like the wave file example by using the‘InitSound()’ command. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |