Set up FMOD Studio for UE4 C++

Hi,

I wanted to ask, when I use the UE4-FMOD Plugin, whether it is possible to use it then in the Unreal C++ Project?

I followed the tutorial and implemented
PrivateDependencyModuleNames.AddRange(new string[] { “FMODStudio” }); in the .build-cs.
and included “FMODStudioModule.h” and “fmod_studio.hpp” in my new Actor-class.
But then I get the error cannot open source file or after some tries I get “is not a class or namespace name”.

Do I’m missing something? Or is it really necessary to import FMOD as external C++ library? I appreciate any help.

PS:I once imported FMOD as external library and it worked like a charm, but I had trouble to work with the UE4 objects/classes directly.

That should work fine. Make sure you include the fmod files before the actor’s generated.h file.

Another thing you could try is moving the FMODStudio.Build.cs include path “FMODStudio/Public/FMOD” from the PrivateIncludePaths to PublicIncludePaths. However in the testing I’ve done, this hasn’t been necessary.

Here is a step by step guide:

  • Unzip the latest FMOD integration into the UE4 Engine/Plugins directory. Currently that is fmodstudio10800ue4.10win64.zip.

  • Run UE4, and create a new First Person C++ project called “MyFirstPerson”

  • Open the project in visual studio

  • Edit MyFirstPerson.Build.cs and add “FMODStudio” to the list of PublicDependencyModuleNames

  • In MyFirstPersonProjectile.h add the following just before the “MyFirstPersonProjectile.generated.h” include:

    #include “FMODEvent.h”

  • Add the following property in the public section of the class:

    /** Test audio event */
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Audio)
    UFMODEvent* TestEvent;

  • In MyFirstPersonProjectile.cpp add:

    #include “FMODBlueprintStatics.h”

  • In AFMyFirstPersonProjectile::OnHit, before the AddImpulseAtLocation line, add:

    UFMODBlueprintStatics::PlayEventAtLocation(this, TestEvent, GetTransform(), true);

  • Compile and build the project for Development Editor | Win64

If it compiles and runs, then you are using FMOD headers successfully. To test it further, you can:

  • Export banks into the content/FMOD directory so you have some events in the content window.
  • Open FirstPersonCPP/Blueprints/FirstPersonProjectile blueprint.
  • Edit the blueprint properties and set TestEvent to an event you want to play.
  • Run the game in the editor and shoot a box. You will hear the event play.

Okay, I don’t know what of your detailed tutorial fixed my error, but…
It worked! Many thanks to that!

There is one thing, I’m wondering about.
IntelliSense from Visual Studio is all red over my code since I put your changes into my the new project, but it does still compile. Why? Can I turn it somehow off?

I’m not sure how to fix intellisense if its not behaving correctly.

I’m a little confused. The official documentation says you should ad “FMODStudio” to PrivateDependencyModules in the Build.cs file but the one of the answers says that we should add it to PublicDependencyModules. Which one should it be :stuck_out_tongue: ?

Either will work. This is a description of the difference from an Epic UDN post:

“The difference between public and private dependencies is that they are visible to public and or private code respectively. Thus, when public is used functionality can be exposed to other editors or plugins, that depend on your game (or module).”

That means unless you have additional plugins that depend on your game project, it won’t matter which one you put it in.

Hi, Geoff,

Thanks, I’m new to FMOD. I can’t get it to work when I put it in either Private or Public. When I hover over #include “FMODEvent.h” (which shows up with a red squiggly line) it says Cannot Open Source File and I end up with 31 errors.

This is what my build.cs line looks like
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore” , “FMODStudio”});

Right now I’m just trying everything you suggested in your reply to the question but I eventually need to program with the FMOD C++ API and I’ll have to add the fmod_studio.hpp file, does this file need to be included in the .cpp or the .h of my class? My goal is to record audio from the PS4 microphone and use custom DSP (a custom filter) on the audio input in real-time.

Hi,
is your plugin properly installed? His tutorial worked pretty well.
If your plugin is properly installed, you can check 2 options:
-Your UnrealEngine Installation offers a submenu for FMOD in
-Your C++ project has got a depedency on the FMOD plugin folder (check the project above, you have nothing to do here…)

There is a youtube video from the FMOD developers how to install it.

Hi, Max

I think, I’ve installed it properly because I can see the FMOD Help sub-menu when I click on help in the UE4 Editor. Is that fine or something else I need to be checking to make sure FMOD has been plugged in to UE4 properly?

I still haven’t been able to solve this error. Any help would be greatly appreciated.

Update: I tried this on another computer and it worked flawlessly. I’m not quite sure what’s wrong and why I can’t get it to work on my computer.

Update no.2: It fails when I add the FMOD PS4 plugin for Unreal but it worked with the Windows plugin. So, I am still stuck with the same problem since I am developing a PS4 game.

Update no.2: It fails when I add the FMOD PS4 plugin for Unreal but it worked with the Windows plugin. So, I am still stuck with the same problem since I am developing a PS4 game.

I’ll follow this up in support, and update this Q/A when the issue is resolved.

The above issue was resolved when reinstalling Visual Studio on that machine.

Hi,

I have a little problem launching my game from Visual Studio under the “Development” mode.
It pops up saying “Plugin Missing, This Project requires the FMODStudio plugin”.

When I build it in Development Editor it works perfectly, and it works correctly in Package as well.

Is this a known issue? I suppose it will work by copying the dll in the correct folder, but I expected it to be solved automatically.

Does anybody have the same problem?

Thanks in advance
Emanuele

PS: I found the problem. It depends on the folder structure of the project. Since my game folder tree is a bit different from the standard UE4, This particular configuration does not work. Just in case it happens to someone else.

Namely, the ordinary structure is:

MyProject/Binary
MyProject/Plugins/FMODStudio
MyProject/MyProject.uproject

My structure is:

MyProject/AnotherFolder/Binary
MyProject/AnotherFolder/Plugins/FMODStudio
MyProject/AnotherFolder/AnotherName.uproject

This particular case does not work.

Thanks for the additional information.