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.

Unity ios AudioSessionCategories - How to set?

0 votes

Hello

I'm trying to set up my Unity project to allow sounds from other applications to mix with my app audio, which is using wwise.

I've found the ios documentation about setting kAudioSessionCategories, and how it's set to default (see below)

But I can't for the life of me figure out how to actually set this in my Unity app.

Any ideas? 

Thanks

-From documentation

The Integration supports two audio session categories

  • kAudioSessionCategory_SoloAmbientSound (Default): When you use this category, audio from other apps is silenced. Your app's audio is also silenced by screen locking and by the Silent switch (called the Ring/Silent switch on the iPhone). However, when using SoloAmbientSound, an audio interruption, for example, an incoming phone call, or playing music with the Music app using a remote control, will seize the audio session from your app. To restore the audio later when you return to your app, you need to specify an interruption listener callback function to respond to the events of entering and exiting the audio interruption.
  • kAudioSessionCategory_AmbientSound: AmbientSound allows your app's audio to be mixed with other apps. Any audio interruptions, for example, an incoming phone call, or playing music with the Music app using a remote control, will be mixed with your app's audio as well.

See the API ListenToAudioSessionInterruption() in Wwise iOS SDK documentation for further information.

asked May 5, 2015 in General Discussion by Simon G. (990 points)

1 Answer

0 votes

I actually got this working in my app the other day so I thought I'd share!

Using Unity 5 and Wwise 2014.1.4 - iOS integration package using a Mac for development

In the AkInitializer script

In the Awake function, find the line that initialises the platform settings;

AkPlatformInitSettings platformSettings = new AkPlatformInitSettings();

Then add this code somewhere after the above line......

        #if UNITY_IOS && ! UNITY_EDITOR

            platformSettings.eAudioSessionCategory = AudioSessionCategory.kAudioSessionCategory_AmbientSound;
            platformSettings.bMuteOtherApps = false;

        #endif 
answered May 15, 2015 by Simon G. (990 points)
Is there any update to this method? I'm trying to set the AudioSessionCategory in my project, but can't find the line you refer to in the Awake function of AkInitializer.
...