C++/CLI (.NET) - Make your trainer play .xm sound (music/chiptunes)
This tutorial is intended to everyone who hasn't been able to make their programs play sound yet. We will be using free uFMOD library ( included as attachment ) for this tutorial, which lets us play .xm files.
I will be using Visual Studio 2010 for this tutorial. It might be littlebit different for other compilers though.
1) Start off by downloading the attachment
2) Load up your project and extract the content which you downloaded to your projects folder. Then make sure you have those three files added to the projects 'solution explorer'
3) Now open up your projects properties (ALT + F7) and go to Configuration Properties->Linker->Input and to the 'additional dependencies' add ufmod.lib and winmm.lib
4) Now go to your form(.h), which you want to make playing the sound and add following:
5) Go to your projects resource view and do the following:
5.1 Right click on your projects name and select add->resource
5.2 Select 'Import' from the right hand side, and browse to your .xm file and choose it
5.3 Set resources type as 10
5.4 You should see that it was added to your resource view box. Find it and click on it.
5.5 Now change it's ID in the properties box (on the right side by default) to 1
6) Now go back to your form, which you wanted to make playing sound and add this line wherever you want it to start playing the sound:
7) Compile it and test it It should be working if you followed the steps
uFMOD_PlaySong((char*)1, 0, XM_RESOURCE);
If it doesn't somehow work, feel free to reply here (with compilers errors of course ), maybe I missed something and we can figure something out 8)
Post Thanks / Like - 1 Thanks
Add VIRUS SCAN TO APPROVE
Great tutorial!, as BlackPitch said please put a virus scan up for that file, https://www.virustotal.com/
Thanks for the addition
Sorry, my bad Here are the results for the virus scan https://www.virustotal.com/file/aab2...is/1342896980/
It's as clear as it could be
Approved nice work keep going :P
Thank you and no problem.
And to add, if someone finds the sound playing too loud or too silent then simply adding:
and replacing x with any number ( 0 - .... , if I recall correctly ) changes the volume. Ufmod.h is highly commented and all of the other available instructions ( like changing the pitch for instance ) are found there