🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Here's how to play S3M/IT/MOD in your DirectX programs

Started by
3 comments, last by kbomb987 22 years, 9 months ago
There were lots of questions about this topic I''ve seen. So here is the solution. I know this has probably been covered but I am just facinated how easy it was to finally get my S3M files playing in my games and demos. I use DirectX in Visual C++, and thought I had to use WAV files to play music. WAVs are way too large. MIDIs stink. I make my S3M files using Impulse Tracker. (Look it up on the search engine to download it). Anyways, here is a link to the BASS Sound System. With 3 lines of code you can play your MOD files. Note MOD is generic for = S3M/MOD/IT/all those tracker file types. 1. Download the library at: http://www.un4seen.com/cgi-bin/download.cgi?bass07m.zip 2. Copy the bassmod.dll and bassmod.lib into your Visual C++ workspace directory. 3. #include "bassmod.h" in your file where you want to play the songs. 4. Click PROJECT->SETTINGS and add bassmod.lib to your LINK section before compiling. 5. Add this code to your GameInit() function. // Start the bass sound system. // Initialize bass sound system. // Check that BASSMOD 0.7 was loaded if (BASSMOD_GetVersion()!=MAKELONG(0,7)) return 0; // setup output - default device, 44100hz, stereo, 16 bits if (!BASSMOD_Init(-1,44100,0)) return 0; BASSMOD_MusicFree(); // free the current mod if (BASSMOD_MusicLoad(FALSE,"yourmusicfile.s3m",0,0,BASS_MUSIC_LOOP|BASS_MUSIC_RAMP|BASS_MUSIC_POSRESET)) { /* get the MOD length */ BASSMOD_MusicPlay(); } else { /* not a MOD */ int r = BASSMOD_ErrorGetCode(); CString str = "Error playing MOD sound file: #"; char buf[5]; str += itoa(r, buf, 10); InitFail(main_window_handle, 0, str); } Quite easy, fine library, props to the makers. So there you have it, tracker music files in your games and demos. Play em till your ears bleed. Hm, now about that alpha blending ..... ftpdummy,submitdummy,more .. www.dummysoftware.com
ftpdummy,submitdummy,more ..www.dummysoftware.com
Advertisement
Yes, bassmod is sweet, but a couple of things that I''d like to point out:

- Cannot be used if you are going to charge for the software.
- It has nothing to do with DX, you can use it in any app.
- It is realy realy cool.


Resist Broken Links - andrewrussellstudios.4nx2.comI don''t believe it! Just Great!
Another server has gone!
I used to be heavily into Tracking and this would have been good to know back then!

All I wanted to say is have you had a look at MS Music Producer and using DirectMusic because I think you can either use MIDI or build things called Downloadable Sound Banks which are banks of samples with properties (like IT instruments) and use them, you can also do funky stuff like have the music change as you do stuff (eg kill the boss and the bass kicks it)

Could be wrong because I''ve never tried using it but I think DirectMusic is worth a look.

X2k

Hm, midi format? What program would use you to make the MIDI songs? I am using Impulse Tracker to make S3M files to play in my games, I don''t think you can convert those to midi though. You got a link to a midi making software?

ftpdummy,submitdummy,more ..
www.dummysoftware.com
ftpdummy,submitdummy,more ..www.dummysoftware.com
Mod Plug Tracker can do some good midi-to/from-mod conversions.

This topic is closed to new replies.

Advertisement