Using FMOD for C #?

I work with FMOD in C #. I tried to import the fmodex.dll file by selecting Project-> Add Reference and viewing for fmodex.dll , but I get an error:

Link to ... cannot be added. Make sure the file is accessible and that it is a valid assembly or COM component

Available, but I still get the error message. I read the manual and it says use fmodex_vc.lib when connecting to the fmodex.dll file. So I try, but I canโ€™t find a way to link to .lib files in Visual Studio; Google search always leads me to a link to .dll files.

+7
source share
4 answers

Fmod is written in unmanaged C ++, so you cannot reference it directly from a .Net application. There is an aC # shell for fmodex.dll in the fmod package under the "fmod_wrapper" directory, if I'm not mistaken what you can add to your project and take care of making P / Invoking for you.

+7
source

Try https://github.com/madrang/FmodSharp to work a bit on this. This should be better than the current Fmod shell.

Instead of using descriptors and coding, how do you use C ++ in C #. The FmodSharp shell is object-oriented, and you do not need to think about using descriptors.

 public static void Main (string[] args) { Console.WriteLine ("Fmod Play File Test"); Xpod.FmodSharp.Debug.Level = Xpod.FmodSharp.DebugLevel.Error; var SoundSystem = new Xpod.FmodSharp.SoundSystem.SoundSystem(); Console.WriteLine ("Default Output: {0}", SoundSystem.Output); SoundSystem.Init(); SoundSystem.ReverbProperties = Xpod.FmodSharp.Reverb.Presets.Room; if (args.Length > 0) { foreach (string StringItem in args) { Xpod.FmodSharp.Sound.Sound SoundFile; SoundFile = SoundSystem.CreateSound (StringItem); Xpod.FmodSharp.Channel.Channel Chan; Chan = SoundSystem.PlaySound(SoundFile); while(Chan.IsPlaying) { System.Threading.Thread.Sleep(10); } SoundFile.Dispose(); Chan.Dispose(); } } else { Console.WriteLine ("No File to play."); } SoundSystem.CloseSystem(); SoundSystem.Dispose(); } 
+2
source

To use FMOD in C #, you need to wrap the functions and structures of FMOD using p / Invoke. This task has been addressed to you in the open source project fmodnet.

+1
source

To add a COM object to a VS project, follow these steps:

  • Register COM

  • Select "Add Link"

  • Select COM tab

  • Scroll to an item and select it.

You should see (after the build) that VS created the Interopt DLL in your BIN directory.

-one
source

All Articles