Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes
Hey there,

I'm running unity 2018.1.9f1, Oculus Utilities 1.27, WWise Unity Integration 2018.1.1.6727.1172, and WWise 2018.1.1. I'm struggling to change the WWise audio output from the default windows device to the Oculus chosen device. 
#if !OVRPLUGIN_UNSUPPORTED_PLATFORM
            string audioDevice = OVRManager.audioOutId;

            uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);

            ActivePlatformSettings.AkInitializationSettings.initSettings.settingsMainOutput.idDevice = audioOutId;
#endif

I've tried adding something along the lines of the above in the AkWwiseInitializationSettings.cs's InitializeSoundEngine function, before AkSoundEngine.Init gets called. However, it doesn't seem to work. 

Any tips? 

in General Discussion by Mike S. (260 points)

1 Answer

0 votes
 
Best answer
I ended up having to do something like this in the AkWwiseInitializationSettings.cs's InitializeSoundEngine function:
#if !OVRPLUGIN_UNSUPPORTED_PLATFORM
	    AkWindowsSettings akWindowsSettings = (AkWindowsSettings)(ActivePlatformSettings);
	    if (akWindowsSettings)
	    {
	        string audioDevice = OVRManager.audioOutId;
	        uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);
	        akWindowsSettings.UserSettings.m_MainOutputSettings.m_DeviceID = audioOutId;
        }
#endif
Additionally, I had to make sure OVRManager ran before AKInitialize in my script execution order.
And I noticed that AkSoundEngine.IsInitialized() was returning True, even if the sound engine wasn't initialized. So I had to do
if (AkSoundEngine.IsInitialized())
{
    AkSoundEngine.Term();
}
at the start of AkSoundEngineController.cs's Init method. 
by Mike S. (260 points)
selected by Mike S.
Sorry to necropost here but I was struggling with this same problem and although the above code pointed me in the right direction I found that it didn't work for me. (Wwise Integration 2018.1.11.6987.1466)

In the end I found that it worked to create an OculusWwiseInitialize Component like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OculusWwiseInitialize : MonoBehaviour
{
    void Awake()
    {
        if (AkBasePathGetter.GetPlatformName() == "Windows")
        {
            AkWindowsSettings akWindowsSettings = (AkWindowsSettings)AkWwiseInitializationSettings.ActivePlatformSettings;
            if (akWindowsSettings)
            {
                string audioDevice = OVRManager.audioOutId;
                uint audioOutId = AkSoundEngine.GetDeviceIDFromName(audioDevice);
                akWindowsSettings.UserSettings.m_MainOutputSettings.m_DeviceID = audioOutId;
            }
        }
    }
}

Under Project Settings -> Script Execution Order I've then tweaked the order to be like:

OculusWwiseInitialize
OVRManager
AkInitializer
...