FMOD sounds not playing through Rift

We migrated over a UE4 4.9 project to UE4 4.10 and tested it on the Rift, music plays though the Rift, but all FMOD sounds play though the default audio device which is usually the user’s headphones, computer speakers, etc. Has anyone else seen this problem? I’ve tried upgrading to the latest version of FMOD, but that’s just seems to break FMOD entirely. And I’m not entirely sure it’s necessary to upgrade FMOD.
Does anyone else have problems re-routing audio to the Rift?

Thanks,
-Stanley

From what you’ve said, there may be multiple audio outputs on the one computer. By default FMOD should choose the system default output device. If that is a headphones, computer speakers, etc, then it explains why you see FMOD sound going to there instead of to the Rift.

FMOD initialization has functions for querying all outputs and then selecting a specific one, but we haven’t hooked that up to our UE4 integration.

When you say the music plays fine, are you playing that via FMOD or the inbuilt audio? Did you change any settings in UE4 to make it play sound via the Rift as opposed to the normal output device?

We’ve wrapped some low level FMOD API calls, like getNumDrivers, getDriverInfo, and setDriver and exposes them in Blueprints. But getDriverInfo is crashing the UE4 editor. Here’s some of our code: #include “FMODStudioPrivatePCH.h”

#include "FMODStudioModule.h"
#include "FMODManager.h"



bool UFMODManagerLibrary::setAudioOutput(FString targetName)
{
	FMOD::Studio::System* System = IFMODStudioModule::Get().GetStudioSystem(EFMODSystemContext::Runtime);
	FMOD::System* lowLevelSystem = nullptr;
	if (System->getLowLevelSystem(&lowLevelSystem) != FMOD_OK)
		return false;

	int numDrivers;
	if (lowLevelSystem->getNumDrivers(&numDrivers) != FMOD_OK)
		return false;
	FMOD_GUID *tmpGuid = 0;
	int *tmpSystemrate = 0;
	FMOD_SPEAKERMODE *tmpSpeakermode = 0;
	int *tmpSpeakermodechannels = 0;
	
	for (int i = 0; i < numDrivers; ++i) {		
		
		char *name = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
		int namelen = sizeof(name);

		UE_LOG(LogTemp, Display, TEXT("numdrivers %d\n"), numDrivers);
		UE_LOG(LogTemp, Display, TEXT("i %d\n"), i);
		UE_LOG(LogTemp, Display, TEXT("namelen %d\n"), namelen);
		
		if (lowLevelSystem->getDriverInfo(i, name, namelen, tmpGuid, tmpSystemrate, tmpSpeakermode, tmpSpeakermodechannels) != FMOD_OK)
			return false;
	
		FString currDriverName(name);
		UE_LOG(LogTemp, Display, TEXT("Driver name %s\n"), *currDriverName);
		
		currDriverName.TrimToNullTerminator();

		if (targetName.Equals(currDriverName)) {
			if (lowLevelSystem->FMOD::System::setDriver(i) != FMOD_OK)
				return false;
			else
				return true;
		}
	}
	
	return false;
}

Any idea why getDriverInfo is crashing the UE4 editor?

Thanks,
-Stanley

Declare the name buffer like this instead:

char name[128];