Jump to content
  • Advertisement
Sign in to follow this  
cockroach92

How to add fmodex.dll in xna?

This topic is 2537 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm working on a rhythm game written in C# and I'm thinking about using fmod to handle the audio.
I've read some posts here and there about getting fmod to work in xna but I'm still having trouble adding fmodex.dll to my project.
The fmodex.dll from Program Files/FMOD Programmers API Windows/api has been copied to my project directory, but whenver I try to add it using Add Reference, an error pops up saying "...fmodex.dll could no be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
I have some simple fmod code written and compiled but when I run the game playSound doesn't play any music, so I'm guessing it's because of fmodex.dll is not added.
Below is what I have:
fmodSystem = new FMOD.System();
channel = new FMOD.Channel();
fmodSound = new FMOD.Sound();
fmodSystem.createSound("song.mp3", FMOD.MODE.HARDWARE, ref fmodSound);
fmodSystem.playSound(CHANNELINDEX.FREE, fmodSound, false, ref channel);

I'm pretty new to xna and fmod so I appreciate any help.
If this question has been answered, it'd be great if you could direct me to the related posts.
Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
Fmod is unmanaged C++ and thus can't be referenced directly into .Net. You have to use their wrapper, located in [color="#444444"][font="Arial,"]%install dir%\api\csharp\[/font][color="#444444"][font="Arial,"].
[/font]

Share this post


Link to post
Share on other sites
Thank you!
So as long as I add those .cs files in api\csharp to my project fmod will work?
I still feel like my fmod is missing something. For example FMOD.Factory.Create_System generates an error "'FMOD.Factory' does not contain a definition for 'Create_System'."
All I want to do right now is to let fmod play the background music....


Fmod is unmanaged C++ and thus can't be referenced directly into .Net. You have to use their wrapper, located in [color="#444444"][font="Arial,"]%install dir%\api\csharp\[/font][color="#444444"][font="Arial,"].
[/font]

Share this post


Link to post
Share on other sites

Thank you!
So as long as I add those .cs files in api\csharp to my project fmod will work?
I still feel like my fmod is missing something. For example FMOD.Factory.Create_System generates an error "'FMOD.Factory' does not contain a definition for 'Create_System'."
All I want to do right now is to let fmod play the background music....


I believe that's because it's actually FMOD.Factory.System_Create()

[color="#1C2837"]So as long as I add those .cs files in api\csharp to my project fmod will work?

[color="#1C2837"]I'm not sure. To be honest, I've never used FMOD or XNA. I found this info via google. There's apparently an example that ships with FMOD named "loadfrommemory". Or here is a link to the files. http://delirium-wars...loadfrommemory/ Maybe that'll help you see how it is done, then it's a matter of porting it to c#.

Share this post


Link to post
Share on other sites


another way to work with unmanaged modules is to use unmanaged C++ function as a middle translator but it will be very hard and may be not applicable in huge namespaces.

if u just wanna play a background music , you may find a better sound engine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!