mynes Posted May 27, 2008 Posted May 27, 2008 Hey Hey, I'm using Visual C++ 9.0 Express Edition, i'm trying to add a XM to a program the example file supplied with uFMOD are getting me no where, i'm pretty n00b at C++, but any kind of help would be great
STN Posted May 27, 2008 Posted May 27, 2008 (edited) Here's how you do it. Put ufmod.h in the same dir as your project, add an include to it in your project. Now add the .xm file to your resource section and in the code, use this APIuFMOD_PlaySong((void *)id(xm file id in resource section),hInstance(duh ? :P),XM_RESOURCE(read ufmod documentation, it means look for xm file in resource section btw));and you are done. Edited May 27, 2008 by STN
Killboy Posted May 27, 2008 Posted May 27, 2008 (edited) Either add ufmod.lib and winmm.lib to the list of library dependencies in the project settings or add those 2 lines either to your main cpp file or to ufmod.h: #pragma comment(lib, "ufmod.lib")#pragma comment(lib, "winmm.lib") I usually just put them into ufmod.h so I can copy the two files to a new project without having to deal with the project settings. What's left is including the header.... As for playing music, it's fairly easy: uFMOD_PlaySong((void *)1, 0, XM_RESOURCE); // It appears to be working with 0 instead of the instance, better do it the way STN suggested tho Where 1 is the resource ID of the xm file in the resources. It's saved as RC_DATA type. Can't test it right now, but you should be able to insert a new resource and give it a name. Just call it RC_DATA. Attached the header + the lib files (taken from the MASM dir, works fine with VC++) //Eeeek WTF took me so long... ufmod.rar Edited May 27, 2008 by Killboy
mynes Posted May 27, 2008 Author Posted May 27, 2008 (edited) I'm getting build errors, yeah !_! plus i don't quite follow you EDit Still looking at Killboy reply XD Edited May 27, 2008 by mynes
STN Posted May 27, 2008 Posted May 27, 2008 (edited) Killboy explained it better than me hehe. Also you might need to include "MMSYSTEM.H" if you get errors in ufmod.h when compiling the project (HWAVEOUT not being recognized). I had to include it in VC 6 for getting it to work . Edited May 27, 2008 by STN
mynes Posted May 27, 2008 Author Posted May 27, 2008 (edited) Yeah i'm still having problems Edited May 27, 2008 by mynes
enhzflep Posted May 27, 2008 Posted May 27, 2008 Just looking at your screen-shot, I see that you've inadvertantly cut-off 5 of the 7 error messages. Notice that you're trying to use the hInstance variable, which is not even declared. To use that, you need to be making a windows program; one with WinMain. Also the id(d.xm) should be replaced with the Resource_Id# of the XM file you've included. Care to repost the image, with all of the errors shown?
mynes Posted May 27, 2008 Author Posted May 27, 2008 ooops on the screen shot indeed that was due to my bad coding here is the updated one with the only true 3 error messages, this is what i got so far i should also point out that i'm not using form it a command line thing i'm "trying" to do, also how do i find the Resource_Id# of the XM
Killboy Posted May 27, 2008 Posted May 27, 2008 Yeah, you should include windows.h, usually includes the winmm stuff as well.
Killboy Posted May 27, 2008 Posted May 27, 2008 haha That's what I'd say about Delphi Hm, you got MSN or anything ? Maybe we can sort it better that way... ICQ and Yahoo is fine by me too, just PM he some number. No obligation of course lol
human Posted May 27, 2008 Posted May 27, 2008 dont insult c++ best language(except his classes) after asm.delphi is lame.and vs told you all about error.figure it out or use ufmod included sources.
Encrypto Posted May 27, 2008 Posted May 27, 2008 (edited) lol delphi aint lame XD. it has useful sources. we all are entitled to our opinions and id rather that this didnt go down the wrong way. Edited May 27, 2008 by Encrypto
mynes Posted May 27, 2008 Author Posted May 27, 2008 (edited) Found out some of the problems, there where type'o's in the uFMOD.h file (not my fault ) also seen as my version is express it doesn't allow res files Edited May 27, 2008 by mynes
human Posted May 27, 2008 Posted May 27, 2008 if you want compile something you need visual studio produe express is a joke, you can do **** in it.it has stripped mfc,docs,masm that you can install later.but without mfc you will not compile a lot from inet sources.encrypto people learn delphi due they think its easier. but c++ isnt hard and is flexible. multiplatform. delphi only windows and pc.next java,php use similiar to c++ syntax so its easier later.
STN Posted May 28, 2008 Posted May 28, 2008 the build errors he's getting aren't the fault of IDE anyway so it doesn't matter if he compiles that code in pro or express. But i agree express is not for serious coding, as according to microsoft, its for hobbyists
Angel-55 Posted May 28, 2008 Posted May 28, 2008 Lol Mynes u could have asked me ^^ u see me each day on MSN XD i have asource in case u want it... the errors was first that the hInstance isn't decleared actually unused in console mode second the lib winmn,lib must be included into source u can check project configs to do that....... lest but not last the project should have been created as a Win32 Program anyway any serious troubles, i'll be happy to help u !
atom0s Posted May 29, 2008 Posted May 29, 2008 The compile errors he gets are not the fault of the IDE. They are the fault of the programmer. No offense intended or anything.Firstly, the Express edition of Visual Studio does not include the resource editor. Your method of including the XM is incorrect which is why you get the error you get about the void* as it is:1.) Not part of a resource so XM_RESOURCE will not work.2.) Is directly added to the project and is also not even named '1'.I suggest you either create a resource file and include it by hand, or just download the full version of Visual Studio or use a different IDE / Compiler.
STN Posted May 29, 2008 Posted May 29, 2008 (edited) doesn't matter if its a console mode or win32 gui application. It should compile fine. Wiccaan mentioned most of the errors but i'll be one step ahead of all you and provide working examples for vc6(which i always use) and vc2005 express done in console mode . _http://rapidshare.com/files/118592381/ufmod_examples_vs.rar.html hope it helps Edited May 29, 2008 by STN
atom0s Posted May 29, 2008 Posted May 29, 2008 doesn't matter if its a console mode or win32 gui application. It should compile fine. Wiccaan mentioned most of the errors but i'll be one step ahead of all you and provide working examples for vc6(which i always use) and vc2005 express done in console mode ._http://rapidshare.com/files/118592381/ufmod_examples_vs.rar.html hope it helps The code given above (not the link you provided) are specific to a console application based on the entry point. Without modding the entry point that will not compile as a Window application as the entry point for that would be WinMain.
Killboy Posted May 29, 2008 Posted May 29, 2008 I dont get the problem here...Console apps compiled with VC++ are compiled to work on Windows...And you can of course use the API even if you dont have WinMain, just takes the right include files and libraries.
atom0s Posted May 29, 2008 Posted May 29, 2008 That wasn't what I meant, when you use Visual Studio you are given the option on which type of Win32 application you wish to create:1.) Console Application2.) Window Based ApplicationBoth of which use different default entrypoints which was what I was pointing out above.Console Applications use 'int main' while Window Based Applications use 'int WinMain'. Attempting to use either in the others place will result in a compiler error saying it was unable to find the entry point.
enhzflep Posted May 30, 2008 Posted May 30, 2008 Here ya go mynes,straight out of the uFMod download. use with VS or DevCpp. Works fine with 2k8 express.WinMM.7z
STN Posted May 30, 2008 Posted May 30, 2008 Here ya go mynes,straight out of the uFMod download. use with VS or DevCpp. Works fine with 2k8 express. lol i am sure he already had this as it is provided with ufmod download. Besides its too complex for an example when you just want to see how uFMOD_PlaySong works .
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now