Skip to content

Setting RTPC Values

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

Setting RTPC values for AkEvent nodes

Consider this simple scene tree:

Screenshot 2023-08-30 at 16 32 57

We want to set the RTPC value of a game sync named Volume (mapped to the Voice volume of the respective playlist container) to a random value between 0 and 100 every frame.

To do this, we attach a script to the root node and call Wwise.set_rtpc_value in the _process callback:

func _process(delta):
	Wwise.set_rtpc_value("Volume", randf_range(0, 100), $MusicEvent)

The first parameter is name of the game sync, the second the value and third the associated game_object. For AkEvent nodes, you can pass directly the node as this parameter.

Setting RTPC values for manually posted Events

If you are manually posting events in GDScript, you can set RTPC values by passing the registered game_object as the third parameter to Wwise.set_rtpc_value. In this example, the node in which the script resides is registered as the game_object:

func _ready():
	Wwise.register_game_obj(self, "Music GameObject")
	Wwise.post_event("Music", self)

func _process(delta):
	Wwise.set_rtpc_value("Volume", randf_range(0, 100), self)

Setting global RTPC values

If you need to set a global RTPC value simply pass null as the third game_object parameter to Wwise.set_rtpc_value:

func _process(delta):
	Wwise.set_rtpc_value("Volume", randf_range(0, 100), null)