cancel
Showing results for 
Search instead for 
Did you mean: 

Unity Set WWise output device

Solovick
Level 2
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. 
#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? 
1 ACCEPTED SOLUTION

Accepted Solutions

Solovick
Level 2
I ended up having to do something like this in the AkWwiseInitializationSettings.cs's InitializeSoundEngineFunction:


#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. 

View solution in original post

2 REPLIES 2

MikeF
Level 10
Inside the Initialize method of AkInitializer i've used the following and it works 
  platformSettings.idAudioDevice = AkSoundEngine.GetDeviceIDFromName(OVRManager.audioOutId);

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

Solovick
Level 2
I ended up having to do something like this in the AkWwiseInitializationSettings.cs's InitializeSoundEngineFunction:


#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.