Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

How do I set correct audio device for Oculus (Rift Headphones vs Windows Output)

0 votes

There's an Oculus VRC that requires audio to _always_ be outputted via the Rift headphones no mater what the Windows Output is set to (unless toggled by an in-app setting)

"App must target the audio device selected in the "Audio Output in VR" setting in the Oculus app."

I cant find any way to tell Wwise what device to use from inside Unity.

(this is cross posted from the oculus forum as I've not had any answers there either :( )

We're using:

  • Wwise 2017.2.0
  • Unity Integration Bundle: 2017.2.0.947
  • Unity 2017.3.0f3
  • OVR Plugin 1.22

We're not using the OculusSpatializer plugin for wwise, but our audio director is happy with the way the game sounds and we successfully pass VRC.PC.Audio.2 (Audio specialization).


The only two pieces of relevant info I can find on the internet are in this post from January:

Feedback from our internal team:
"’s implemented under the hood and Unity automatically targets the Rift audio device. Unity redirects their audio to the Rift by default. If you use a third-party audio subsystem such as Wwise or FMOD, the latest version also does this. If you're using another audio system, they need to follow the guide [linked above]."

I'm not sure if "latest version" refers to Wwise, Unity or OVR, but everything we're using (afaik) is latest as of January this year.


and in this doc page:


Unity 5 and Wwise

To configure Wwise to use to configured audio device in Unity 5, pass the user-configured audio device name/GUID (set in the Oculus app) into the function AkSoundEngine.GetDeviceIDFromName(), located in AkInitializer.cs.

To get the audio device GUID from libOVR, you must include the Oculus Utilities unitypackage, which exposes that string through the class OVRManager.

The following function should be called before AkSoundEngine.Init(...):



But we're on Unity 2017, so the code snippet doesn't work, and (I think) shouldn't be necessary anymore.


Neither of these sources has helped get me closer to solving the problem.  Since there's so little info around, and because Wwise say their tool has been used in hundreds of games, it feels like it must be something that's (usually) automatically handled but somehow we've missed a step of flicked a switch off somewhere that no-one else does.

If anyone has any info on how we can move on with this, or even how to debug it a bit more, it would be very gratefully received!



Update 1:

I updated everything (Unity, wwise, wwise-unity, oculus, ovrplatform) to the latest available version but still get the same behaviour.


Update 2:

I've also tried this in place of the code snippet from the docs:

string audioDevice = OVRManager.audioOutId;
uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);
initSettings.settingsMainOutput.idDevice = audioOutId;

(just dropped into akSoundEngineController.Init(...) at line 150).


This results in no sound output at all, but


is the only other accessible reference to a device id that I could find

asked Apr 16, 2018 in General Discussion by Chris M. (140 points)
No true answer right now but we are experiencing the same problem.  Looking at the code we found that when running the code that was added in the old way to fix things doesnt get hit because there is an early out at line 124 of the AKSoundEngineController init function.  It seems like AKSoundEngine.IsInitialized() is returning true on unity startup, and that function points to some external function.  In other words it seems that unity is signaling that things are properly initialized as IsInitialized points to an external function.  Just sharing info hope this helps at all.

1 Answer

0 votes

I re-tried the (slightly) modified code snippet (akSoundEngineController.Init(...) at line 150):

string audioDevice = OVRManager.audioOutId;
uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);
initSettings.settingsMainOutput.idDevice = audioOutId;

And everything works exactly as expected this time.

No idea what I did or didn't do right first time, but at least it works now :)

answered May 7, 2018 by Chris M. (140 points)
I'm wondering if you can help clarify some things.

I'm having the same issue failing VRC.PC.Audio.1 (The application targets the wrong audio device) while using Unity 2019.1 and Wwise 2019.1 (with the Oculus spatializer)

I've looked through the  AkInitializer.cs file and found no reference to AkSoundEngine.GetDeviceIDFromName() nor AkSoundEngine.Init in it.

My question is, what script file should I be looking for the function akSoundEngineController.Init in order to drop this code snippet?

Or is the issue now supposed to be solved in a different way?

Whenever I open my application build the audio output does change to the Rift automatically so I'm unsure why I keep failing this test.

I put these lines in `\Assets\Wwise\Deployment\Components\AkSoundEngineController.cs`  at line 170.  Directly before the line:

`result = AkSoundEngine.Init(memSettings, streamingSettings, deviceSettings, initSettings, platformSettings, musicSettings, spatialAudioSettings, (uint)akInitializer.preparePoolSize * 1024);`

It doesn't feel like the right thing to do to be modifying the the wwise source at that level, but it worked for us and let us pass cert, so I was happy enough in the end!
Thanks for the response.

Unfortunately, it looks like our "AkSoundEngineController.cs" are very different. Line 170 is all about Unity editor and IOS and the snippet of code you provided doesn't appear on any file in my project.

I even re-integrated the Wwise project and everything still looks the same.
I wonder why my AkInitializer and AkSoundEngineController look so different!