Hello.
Simply following Programming with the FMOD Studio C++ API page, I’m having problems including the right files for using the C++ API in UE4.
I am using the full FMOD tutorial project to which I add a C++ class of an AActor to test my code.
Also, PrivateDependencyModuleNames.AddRange(new string[] { "FMODStudio" });
is part of my Build.cs.
Here’s my code based on the example:
#include "FMOD_UE4_Tutorial.h"
#include "MyActor.h"
#include "FMODStudioModule.h"
#include "fmod_studio.hpp"
void AMyActor::BeginPlay()
{
Super::BeginPlay();
if (IFMODStudioModule::IsAvailable())
{
FMOD::Studio::System* StudioSystem = IFMODStudioModule::Get().GetStudioSystem(EFMODSystemContext.Runtime);
if (StudioSystem)
{
// Use it here
}
}
}
I needed to add FMODStudioModule.h
so that IFMODStudioModule::IsAvailable()
could be recognized but
EFMODSystemContext is not recognized though it is part of the same header file.
2>E:\Documents\Unreal Projects\FMOD_UE4_Tutorial\Source\FMOD_UE4_Tutorial\MyActor.cpp(24): error C2882: 'EFMODSystemContext': illegal use of namespace identifier in expression
2>E:\Documents\Unreal Projects\FMOD_UE4_Tutorial\Source\FMOD_UE4_Tutorial\MyActor.cpp(24): error C2228: left of '.Runtime' must have class/struct/union
So what’s correct procedure ?
Regards.