Skip to content

Loading Soundbanks

Alessandro Famà edited this page Dec 13, 2023 · 3 revisions

Setting up the Base path location

Before attempting to load any banks, make sure to set the correct Base path location in the Wwise settings located in the Project Settings (the Advanced Settings toggle at the top right section of the window needs to be activated for the Wwise settings to show up):



wwise-godot-base-path-settings

Configuring Soundbank Names

By default, the integration uses Soundbank names for loading soundbanks. However, if you prefer to use IDs instead, follow the steps below to deactivate the "Use SoundBank Names for Filenames" setting:

  1. Open the Wwise authoring app and go to the SoundBanks settings.
  2. Locate the "Use SoundBank Names for Filenames" setting and deactivate it.
  3. Additionally, deactivate the "Use Soundbank names" setting in the Project settings:



wwise-godot-use-soundbank-names

By deactivating these settings, the integration will use IDs instead of Soundbank names for loading soundbanks. Make sure to regenerate your banks after applying these settings.

Loading Soundbanks with the AkBank Node

The integration provides a custom node called AkBank that allows you to select a soundbank and load or unload it using the Enter Tree, Ready, or Exit Tree callbacks:



wwise-godot-ak-bank-node-inspector

To select a bank, click on the Select Bank... button in the inspector, and a list of soundbanks will appear. Simply click on the desired bank to select it. Select when the bank should be loaded/unload in the Load On and Unload On properties of the node.

Loading Soundbanks with GDScript

load_bank

The simplest way to load banks in GDScript is by calling load_bank on the Wwise singleton:

func _enter_tree():
	Wwise.load_bank("Init")
	Wwise.load_bank("TestBank")

To unload a bank, call unload_bank:

func _enter_tree():
	Wwise.unload_bank("TestBank")

load_bank_id

Alternatively, you can directly pass the generated IDs to load_bank_id (if you are not using soundbank names):

func _enter_tree():
	Wwise.load_bank_id(AK.BANKS.INIT)
	Wwise.load_bank_id(AK.BANKS.TESTBANK)

load_bank_async / load_bank_async_id

You can load banks asynchronously by calling load_bank_async or load_bank_async_id:

extends Node

var cookie_wrapper = CookieWrapper.new()
var callable = Callable(self, "_bank_callback")

func _enter_tree():
	cookie_wrapper.cookie = callable
	Wwise.load_bank_async_id(AK.BANKS.INIT, cookie_wrapper)
	Wwise.load_bank_async_id(AK.BANKS.TESTBANK, cookie_wrapper)

func _bank_callback(data):
	print(data)

Create a CookieWrapper object and a Callable. Assign the callable to the cookie property of the wrapper. The callback function will receive information about the soundbank loading state. In the example above, it would be:

{ "bank_id": 1355168291, "result": 1 }
{ "bank_id": 3291379323, "result": 1 }

You should now have a good understanding of how to load banks in your Godot project.