UE4 Integration 2.00
Some platforms require some extra steps to run properly.
To deploy on Android, make sure FMODStudio is in your game's directory, not in the Engine plugins directory. When FMODStudio is in your game's plugin directory, the engine will rebuild the plugin for Android and deploy all the files properly.
FMOD supports DSP plugins, which will be stand-alone .so files that will need to be packaged into the build. Add the .so file into the FMODStudio/Binaries/Android/{Architecture}
directory. Unreal will also need an APL file so it knows to package the .so file. To do this, you will need to write an APL file and drop it into the FMODStudio/Binaries/Android
directory. The FMODStudio.build.cs file looks for any file ending with __APL.xml_ and will pass that along to the unreal build tool for packaging.
The APL is a custom xml file format which is documented in the engine file AndroidPluginLanguage.cs. Here is a sample APL file for libovrfmod.so:
<?xml version="1.0" encoding="utf-8"?>
<!--Plugin additions-->
<root xmlns:android="http://schemas.android.com/apk/res/android">
<!-- init section is always evaluated once per architecture -->
<init>
<log text="ovrfmod APL init"/>
</init>
<!-- optional files or directories to copy to Intermediate/Android/APK -->
<resourceCopies>
<log text="ovrfmod APL copying files for $S(Architecture)/"/>
<copyFile src="$S(PluginDir)/$S(Architecture)/libovrfmod.so"
dst="$S(BuildDir)/libs/$S(Architecture)/libovrfmod.so" />
</resourceCopies>
<!-- optional libraries to load in GameActivity.java before libUE4.so -->
<soLoadLibrary>
<log text="ovrfmod APL adding loadLibrary references"/>
<loadLibrary name="ovrfmod" failmsg="ovrfmod not loaded and required!" />
</soLoadLibrary>
</root>
You only need to write this if you want to load a DSP plugin on Android.
To build for TVOS, make sure FMODStudio is in your game's directory and not in the Engine plugins directory.
To deploy on linux, you will need to rebuild the engine from source via github. For compiling linux from windows, see this page for instructions how to get up and running with UE4. Then, add in both the fmodstudio linux .zip and windows .zip on top of each other into the engine plugins directory.
The last thing you will need to do is to get the FMOD .so libraries into a directory that the executable can read them. The easiest way is to copy them from
<DeployedDir>\Engine\Plugins\FMODStudio\Binaries\Linux\x86_64
to
<DeployedDir>\<GameName>\Binaries\Linux
To see what directories the .so files can be located, look at LinuxToolChain.cs. Currently there are only a set of hard coded directories that are supported.
To enable FMOD Studio the use of any microphone input, including Kinect, on the Xbox One. The Engine ini file specific for the platform, located in '/Config/XboxOne/XboxOneEngine.ini', needs to have the following lines added:
[AppxManifest]
Package.Capabilities.mx:Capability[0].Name=kinectAudio
Package.Capabilities.mx:Capability[1].Name=kinectGamechat
Add the following to GetFilesToDeployOrStage in XboxOnePlatform.Automation.cs, before the end of the function:
// FMOD code start
DirectoryReference FMODDLLPath = null;
if (Directory.Exists(Path.Combine(SC.ProjectRoot.ToString(), "Plugins/FMODStudio")))
{
FMODDLLPath = DirectoryReference.Combine(SC.ProjectRoot, "Plugins/FMODStudio/Binaries/XBoxOne/");
}
else if (Directory.Exists(Path.Combine(SC.LocalRoot.ToString(), "Engine/Plugins/FMODStudio")))
{
FMODDLLPath = DirectoryReference.Combine(SC.LocalRoot, "Engine/Plugins/FMODStudio/Binaries/XBoxOne/");
}
else
{
LogError("Failed to find FMODStudio plugin in game or engine directory");
}
if (FMODDLLPath != null)
{
Log.TraceInformation("Copying FMOD dlls to loose directory: " + RelativeBinPath);
StagedDirectoryReference RelativeBinPathRef = new StagedDirectoryReference(RelativeBinPath);
StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmod.dll"), RelativeBinPathRef, SC);
StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodL.dll"), RelativeBinPathRef, SC);
StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodstudio.dll"), RelativeBinPathRef, SC);
StageFileIfExists(StagedFileType.NonUFS, FileReference.Combine(FMODDLLPath, "fmodstudioL.dll"), RelativeBinPathRef, SC);
}
// FMOD code end
Add the following to PrepTargetForDeployment in XboxOneDeploy.cs, in the same scope as 'DestDir':
// FMOD code start
string FMODDLLPath = null;
if (Directory.Exists(Path.Combine(ProjectDirectory.FullName, "Plugins/FMODStudio")))
{
FMODDLLPath = Path.Combine(ProjectDirectory.FullName, "Plugins/FMODStudio/Binaries/XBoxOne/");
}
else if (Directory.Exists(Path.Combine(RelativeEnginePath, "Plugins/FMODStudio")))
{
FMODDLLPath = Path.Combine(RelativeEnginePath, "Plugins/FMODStudio/Binaries/XBoxOne/");
}
else
{
Log.TraceWarning("Failed to find FMODStudio plugin in game or engine directory");
}
if (FMODDLLPath != null)
{
Log.TraceInformation("...copying the FMOD dlls...");
string FMODDLLName = "fmod.dll";
Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
FMODDLLName = "fmodL.dll";
Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
FMODDLLName = "fmodstudio.dll";
Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
FMODDLLName = "fmodstudioL.dll";
Log.TraceInformation("\tcopying " + FMODDLLPath + FMODDLLName + " to " + DestDir + "/" + FMODDLLName);
CopyFile(FMODDLLPath + FMODDLLName, DestDir + "/" + FMODDLLName, true);
}
// FMOD code end