iOS Targets
When building for iOS, the trueSpatial plug-ins require some additional configuration to work correctly.
In comparison to the Unity counterpart, the FMOD integration for Unreal Engine doesn’t provide an interface to load plug-ins from static libraries, and dynamic libraries are not supported on iOS.
To work around this limitation, the source code of the FMOD integration needs to be modified to include the trueSpatial plug-ins directly.
Add the Accelerate Framework
To use the trueSpatial plug-ins on iOS, the Accelerate framework needs to be
linked to the FMOD Studio module. To do this, add the following highlighted code
to the FMODStudio.Build.cs
file:
public FMODStudio(ReadOnlyTargetRules Target) : base(Target)
{
if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicFrameworks.Add("Accelerate");
}
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PrivatePCHHeaderFile = "Private/FMODStudioPrivatePCH.h";
// ...
Declare symbols to load
In order to call the plug-in descriptions functions during initialization, the
functions need to be declared in the FMODStudioModule.cpp
file. Add the
following highlighted code to the FMODStudioModule.cpp
file, e.g. right before
the CreateStudioSystem
function:
#if PLATFORM_IOS
extern "C" {
FMOD_DSP_DESCRIPTION* F_CALL FMOD_atmoky_Spatializer_GetDSPDescription();
FMOD_DSP_DESCRIPTION* F_CALL FMOD_atmoky_Renderer_GetDSPDescription();
FMOD_DSP_DESCRIPTION* F_CALL FMOD_atmoky_AmbisonicRenderer_GetDSPDescription();
FMOD_DSP_DESCRIPTION* F_CALL FMOD_atmoky_Externalizer_GetDSPDescription();
}
#endif
void FFMODStudioModule::CreateStudioSystem(EFMODSystemContext::Type Type)
{
// ...
With this the linker will know to look for these functions outside of the FMOD integration.
Register the plug-ins during initialization
To register the trueSpatial plug-ins during initialization, add the
following highlighted code to the CreateStudioSystem
function in the
FMODStudioModule.cpp
file, e.g. right after the LoadPlugin
loop:
void FFMODStudioModule::CreateStudioSystem(EFMODSystemContext::Type Type)
{
// ...
for (FString PluginName : Settings.PluginFiles)
{
if (!PluginName.IsEmpty())
LoadPlugin(Type, *PluginName);
}
unsigned int handle = 0;
lowLevelSystem->registerDSP(FMOD_atmoky_Spatializer_GetDSPDescription(), &handle);
lowLevelSystem->registerDSP(FMOD_atmoky_Renderer_GetDSPDescription(), &handle);
lowLevelSystem->registerDSP(FMOD_atmoky_AmbisonicRenderer_GetDSPDescription(), &handle);
lowLevelSystem->registerDSP(FMOD_atmoky_Externalizer_GetDSPDescription(), &handle);
if (Type == EFMODSystemContext::Runtime)
{
// ...
With this configuration, the trueSpatial plug-ins should work correctly on iOS. In case you update the FMOD integration, you might need to reapply these changes.