Hi.
We are sending our game to the Oculus team and they are reporting that the game “must target the audio device selected in the “Audio Output in VR” setting in the Oculus app.”
We have pasted the code snippet that can be found on their website, but nothing seems to work. I also changed the deprecated “getLowLevelSystem” for the “getCoreSystem”, but nothing seems to work.
We recently made handling Oculus driver selection a lot easier and provide an example specifically for implement that behavior. Check out our Unity docs for details.
In order to prevent problems, we would like to avoid a major version upgrade. We are currently using the version 2.0.10 and the game is already published in some stores.
The last build I sended to them was this one. But they still report that there’s no audio through the target device.
public void PreInitialize(FMOD.Studio.System studioSystem)
{
string riftId = OVRManager.audioOutId;
FMOD.System coreSystem;
FMOD.RESULT result = studioSystem.getCoreSystem(out coreSystem);
int driverCount = 0;
result = coreSystem.getNumDrivers(out driverCount);
for (int i = 0; i < driverCount; i++)
{
int rate;
int channels;
System.Guid guid;
FMOD.SPEAKERMODE mode;
result = coreSystem.getDriverInfo(i, out guid, out rate, out mode, out channels);
if (guid.ToString() == riftId)
{
result = coreSystem.setDriver(i);
break;
}
}
}
Understood, it looks like you are calling PreInitialize at the top of RuntimeManager.Initialize, at this point the Studio System won’t have been created yet. Try moving your call to PreInitialize down to just before the call to studioSystem.initialize, line 244 in the version I have here.
It worked. Thanks Mathew.
If someone has the same problem and needs to avoid upgrading to 2.1 for any reason, the snippet of code above should work. Just make sure you call this method after the “FMOD.Studio.System.create”.
The OVRManager is the one that knows the GUID of the VR audio endpoint. If that’s not available to you, then your other option is finding it by name (if it has a well known name).
How can this be accomplished with OpenXR and Unity? The Unity sound is playing on the right device, but I found no way of getting the Unity output device GUID, or the OpenXR device GUID.
This may not be an FMOD question, but on the right topic at least, since OpenXR is the current way. How do people do it?
Also it is not easy to do it by name, since getDriverInfo does not report a name.
Would it be possible to elaborate on the issue you are facing? What version of the FMOD Integration and Unity are you using?
FMOD should natively output to the Oculus Rift, is there any code that you have implemented to try to select an output device? Would it be possible to see this if so?
I use FMOD Studio Unity Integration 2.02.07. Unity output for sound (outputs to headset), and FMOD for music (outputs on device 0 - the selected device in Windows).
I have no code to show, but if I knew the Oculus device GUID I would select it like in the example above. However, since there could be other headsets than Oculus, it would be nice if the device GUID could be retrieved from Unity or OpenXR…