Skip to content

Wwise GDExtension Interface

Alessandro Famà edited this page Aug 23, 2023 · 12 revisions

Methods

Return value Signature
void init()
void render_audio()
void shutdown()
bool set_base_path(base_path: String)
void set_current_language(language: String)
bool load_bank(bank_name: String)
bool load_bank_id(bank_id: int)
bool load_bank_async(bank_name: String, cookie: CookieWrapper)
bool load_bank_async_id(bank_id: int, cookie: CookieWrapper)
bool unload_bank(bank_name: String)
bool unload_bank_id(bank_id: int)
bool unload_bank_async(bank_name: String, cookie: CookieWrapper)
bool unload_bank_async_id(bank_id: int, cookie: CookieWrapper)
bool register_listener(game_object: Object)
bool register_game_obj(game_object: Object, name: String)
bool unregister_game_obj(game_object: Object)
bool set_listeners(emitter: Object, listener: Object)
void set_random_seed(seed: int)
bool set_3d_position(game_object: Object, transform_3d: Transform3D)
bool set_2d_position(game_object: Object, transform_2d: Transform2D, z_depth: float)
bool set_multiple_positions_3d(game_object: Object, positions: Array[Transform3D], num_positions: int, multi_position_type: MultiPositionType)
bool set_multiple_positions_2d(game_object: Object, positions: Array[Transform2D], z_depths: Array[float], num_positions: int, multi_position_type: MultiPositionType)
bool set_game_object_radius(game_object: Object, outer_radius: float, inner_radius: float)
unsigned int post_event(event_name: String, game_object: Object)
unsigned int post_event_callback(event_name: String, flags: AkCallbackType, game_object: Object, cookie: CookieWrapper)
unsigned int post_event_id(event_id: int, game_object: Object)
unsigned int post_event_id_callback(event_id: int, flags: AkCallbackType, game_object: Object, cookie: CookieWrapper)
void stop_event(playing_id: int, fade_time: int, interpolation: AkCurveInterpolation)
bool set_switch(switch_group: String, switch_value: String, game_object: Object)
bool set_switch_id(switch_group_id: int, switch_value_id: int, game_object: Object)
bool set_state(state_group: String, state_value: String)
bool set_state_id(state_group_id: int, state_value_id: int)
float get_rtpc_value(rtpc_name: String, game_object: Object)
float get_rtpc_value_id(rtpc_id: int, game_object: Object)
bool set_rtpc_value(rtpc_name: String, rtpc_value: float, game_object: Object)
bool set_rtpc_value_id(rtpc_id: int, rtpc_value: float, game_object: Object)
bool post_trigger(name: String, game_object: Object)
bool post_trigger_id(id: int, game_object: Object)
unsigned int post_external_source(event_name: String, game_object: Object, source_object_name: String, filename: String, id_codec: AkCodecID)
unsigned int post_external_source_id(event_id: int, game_object: Object, source_object_id: int, filename: String, id_codec: AkCodecID)
int get_source_play_position(playing_id: int, extrapolate: bool)
Dictionary get_playing_segment_info(playing_id: int, extrapolate: bool)
bool set_game_object_output_bus_volume(game_object: Object, listener: Object, control_value: float)
bool set_game_object_aux_send_values(game_object: Object, ak_aux_send_values: Array, num_send_values: int)
bool set_object_obstruction_and_occlusion(game_object: Object, listener: Object, calculated_obs: float, calculated_occ: float)
bool set_geometry(vertices: Array, triangles: Array, acoustic_texture: Resource, occlusion_value: float, game_object: Object, enable_diffraction: bool, enable_diffraction_on_boundary_edges: bool, associated_room: Object)
bool remove_geometry(game_object: Object)
bool register_spatial_listener(game_object: Object)
bool set_room(game_object: Object, ak_aux_bus_id: int, reverb_level: float, transmission_loss: float, front_vector: Vector3, up_vector: Vector3, keep_registered: bool, associated_geometry_instance: Object)
bool remove_room(game_object: Object)
bool set_portal(game_object: Object, transform: Transform3D, extent: Vector3, front_room: Object, back_room: Object, enabled: bool, portal_name: String)
bool remove_portal(game_object: Object)
bool set_game_object_in_room(game_object: Object, room: Object)
bool remove_game_object_from_room(game_object: Object)
bool set_early_reflections_aux_send(game_object: Object, aux_id: int)
bool set_early_reflections_volume(game_object: Object, volume: float)
bool add_output(share_set: String, output_id: int)
bool remove_output(output_id: int)
bool suspend(render_anyway: bool)
bool wakeup_from_suspend()

Method descriptions

  • init() -> void

Initializes the Wwise Soundengine. This is called automatically by the Wwise Runtime autoload singleton at each game start.


  • render_audio() -> void

Processes all commands in the sound engine's command queue. This is called automatically by the Wwise Runtime autoload singleton. Calls AK::SoundEngine::RenderAudio.


  • shutdown() -> void

Shuts down the Wwise Soundengine. This is called automatically by the Wwise Runtime autoload singleton.


  • set_base_path(base_path: String) -> bool

Configures the root path for the generated soundbanks. This feature proves beneficial when loading soundbanks from external sources beyond Godot's virtual filesystem.


  • set_current_language(language: String) -> void

Sets the current language. This is done automatically based on the startup_language setting in the Common User Wwise settings (Project Settings).


  • load_bank(bank_name: String) -> bool

Loads a bank with the given bank_name. Calls AK::SoundEngine::LoadBank.

Returns true if bank loading succeeded.


  • load_bank_id(bank_id: int) -> bool

Loads a bank with the given bank_id. Calls AK::SoundEngine::LoadBank.

Returns true if bank loading succeeded.


  • load_bank_async(bank_name: String, cookie: CookieWrapper) -> bool

Loads a bank with the given bank_name. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice. Calls AK::SoundEngine::LoadBank.

Returns true if bank loading succeeded.


  • load_bank_async_id(bank_id: int, cookie: CookieWrapper) -> bool

Loads a bank with the given bank_id. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice. Calls AK::SoundEngine::LoadBank.

Returns true if bank loading succeeded.


  • unload_bank(bank_name: String) -> bool

Unloads a bank with the given bank_name. Calls AK::SoundEngine::UnloadBank.

Returns true if bank unloading succeeded.


  • unload_bank_id(bank_id: int) -> bool

Unloads a bank with the given bank_id. Calls AK::SoundEngine::UnloadBank.

Returns true if bank unloading succeeded.


  • unload_bank_async(bank_name: String, cookie: CookieWrapper) -> bool

Unloads a bank with the given bank_name. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice. Calls AK::SoundEngine::UnloadBank.

Returns true if bank unloading succeeded.


  • unload_bank_async_id(bank_id: int, cookie: CookieWrapper) -> bool

Unloads a bank with the given bank_id. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice. Calls AK::SoundEngine::UnloadBank.

Returns true if bank unloading succeeded.


  • register_listener(game_object: Object) -> bool

Registers a listener with the given game_object.

Returns true if registering succeeded.


  • register_game_obj(game_object: Object, name: String) -> bool

Registers a game object with the given game_object and name. Calls AK::SoundEngine::RegisterGameObj.

Returns true if registering succeeded.


  • unregister_game_obj(game_object: Object) -> bool

Unregisters a game object with the given game_object. Calls AK::SoundEngine::UnregisterGameObj.


  • set_listeners(emitter: Object, listener: Object) -> bool

Associates the game object emitter with a listener object.

Returns true if succeeded.


  • set_random_seed(seed: int) -> void

Sets the random seed value. Can be used to synchronize randomness across instances of the Sound Engine. Calls AK::SoundEngine::SetRandomSeed.

This seeds the number generator used for all container randomizations and the plug-in RNG; since it acts globally, this should be called right before any PostEvent call where randomness synchronization is required, and cannot guarantee similar results for continuous containers.


  • set_3d_position(game_object: Object, transform_3d: Transform3D) -> bool

Sets the 3D position of the given game_object with the given transform_3d. Calls AK::SoundEngine::SetPosition.

Returns true if setting the position succeeded.


  • set_2d_position(game_object: Object, transform_2d: Transform2D, z_depth: float) -> bool

Sets the 3D position of the given game_object with the given transform_2d and z_depth. Calls AK::SoundEngine::SetPosition.

Use the z_depth parameter to position the game object on the z-axis.

Returns true if setting the position succeeded.


  • set_multiple_positions_3d(game_object: Object, positions: Array[Transform3D], num_positions: int, multi_position_type: MultiPositionType) -> bool

Sets the 3D position of the given game_object with the given positions array. Specify the number of position with num_positions and the position type with MultiPositionType. Calls AK::SoundEngine::SetMultiplePositions.


  • set_multiple_positions_2d(game_object: Object, positions: Array[Transform2D], z_depths: Array, num_positions: int, multi_position_type: MultiPositionType) -> bool

Sets the 2D position of the given game_object with the given positions array. Specify the number of position with num_positions and the position type with MultiPositionType. Calls AK::SoundEngine::SetMultiplePositions.


  • set_game_object_radius(game_object: Object, outer_radius: float, inner_radius: float) -> bool

Sets the outer and inner radius for the specified game_object. Calls AK::SpatialAudio::SetGameObjectRadius.


  • post_event(event_name: String, game_object: Object) -> unsigned int

Posts an Event with the given event_name on the given game_object to the sound engine. Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • post_event_callback(event_name: String, flags: AkCallbackType, game_object: Object, cookie: CookieWrapper) -> unsigned int

Posts an Event (with callbacks) with the given event_name on the given game_object to the sound engine. Pass the AkCallbackType bitmask specified in the AkUtils class to flags. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice.

Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • post_event_id(event_id: int, game_object: Object) -> unsigned int

Posts an Event with the given event_id on the given game_object to the sound engine. Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • post_event_id_callback(event_id: int, flags: AkCallbackType, game_object: Object, cookie: CookieWrapper) -> unsigned int

Posts an Event (with callbacks) with the given event_id on the given game_object to the sound engine. Pass the AkCallbackType bitmask specified in the AkUtils class to flags. The cookie Object should be a CookieWrapper instance variable. Set the cookie property of the wrapper to a Callable of your choice.

Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • stop_event(playing_id: int, fade_time: int, interpolation: AkCurveInterpolation) -> void

Stops an Event with the given playing_id. fade_time describes the fade time duration in milliseconds. Pass the AkCurveInterpolation value from the AkUtils class to interpolation. Calls AK::SoundEngine::ExecuteActionOnPlayingID.


  • set_switch(switch_group: String, switch_value: String, game_object: Object) -> bool

Sets the given switch_value of the switch_group on the given game_object. Calls AK::SoundEngine::SetSwitch.

Returns true if setting the switch succeeded.


  • set_switch_id(switch_group_id: int, switch_value_id: int, game_object: Object) -> bool

Sets the given switch_value_id of the switch_group_id on the given game_object. Calls AK::SoundEngine::SetSwitch.

Returns true if setting the switch succeeded.


  • set_state(state_group: String, state_value: String) -> bool

Sets the given state_value of the state_group. Calls AK::SoundEngine::SetState.

Returns true if setting the state succeeded.


  • set_state_id(state_group_id: int, state_value_id: int) -> bool

Sets the given state_value_id of the state_group_id. Calls AK::SoundEngine::SetState.

Returns true if setting the state succeeded.


  • get_rtpc_value(rtpc_name: String, game_object: Object) -> float

Gets the RTPC value of the given rtpc_name of the game_object. Pass null to game_object to get a global RTPC value. Calls AK::SoundEngine::Query::GetRTPCValue.

Returns the RTPC value if succeeded, 1.0f (INVALID_RTPC_VALUE) if failed.


  • get_rtpc_value_id(rtpc_id: int, game_object: Object) -> float

Gets the RTPC value of the given rtpc_id of the game_object. Pass null to game_object to get a global RTPC value. Calls AK::SoundEngine::Query::GetRTPCValue.

Returns the RTPC value if succeeded, 1.0f (INVALID_RTPC_VALUE) if failed.


  • set_rtpc_value(rtpc_name: String, rtpc_value: float, game_object: Object) -> bool

Sets the RTPC rtpc_name with the given rtpc_value on the game_object. Pass null to game_object to set a global RTPC value. Calls AK::SoundEngine::SetRTPCValue.

Returns true if setting the RTPC succeeded.


  • set_rtpc_value_id(rtpc_id: int, rtpc_value: float, game_object: Object) -> bool

Sets the RTPC rtpc_id with the given rtpc_value on the game_object. Pass null to game_object to set a global RTPC value. Calls AK::SoundEngine::SetRTPCValue.

Returns true if setting the RTPC succeeded.


  • post_trigger(name: String, game_object: Object) -> bool

Posts a trigger with the given name on the game_object. Calls AK::SoundEngine::PostTrigger.

Returns true if posting the trigger succeeded.


  • post_trigger_id(id: int, game_object: Object) -> bool

Posts a trigger with the given id on the game_object. Calls AK::SoundEngine::PostTrigger.

Returns true if posting the trigger succeeded.


  • post_external_source(event_name: String, game_object: Object, source_object_name: String, filename: String, id_codec: AkCodecID) -> unsigned int

Posts an Event with the given event_name with an External Source on the game_object. source_object_name is the Wwise External Source SFX name added through the Contents Editor in the authoring application. file_path refers to the relative file path of the external source specified in the Output Path of the External Sources settings in the authoring application. Pass the AkCodecID value defined in AkUtils class to id_codec. Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • post_external_source_id(event_id: int, game_object: Object, source_object_id: int, filename: String, id_codec: AkCodecID) -> unsigned int

Posts an Event with the given event_id with an External Source on the game_object. source_object_id is the Wwise External Source SFX ID added through the Contents Editor in the authoring application. file_path refers to the relative file path of the external source specified in the Output Path of the External Sources settings in the authoring application. Pass the AkCodecID value defined in AkUtils class to id_codec. Calls AK::SoundEngine::PostEvent.

Returns the playing ID of the Event launched, or 0 if posting the Event failed.


  • get_source_play_position(playing_id: int, extrapolate: bool) -> int

Gets the current position of the source associated with the given playing_id, obtained from post_event_callback() or post_event_id_callback(). You need to pass the AK_EnableGetSourcePlayPosition AkCallbackType flag defined in the AkUtils class to use this method. Calls AK::SoundEngine::GetSourcePlayPosition.

Returns the current position of the source if succeeded, 0 if failed.


  • Dictionary get_playing_segment_info(playing_id: int, extrapolate: bool) -> Dictionary

Queries information on the active segment of a music object that is playing, associated with the given playing_id, obtained from post_event_callback() or post_event_id_callback(). You need to pass the AK_EnableGetMusicPlayPosition AkCallbackType flag defined in the AkUtils class to use this method. Calls AK::MusicEngine::GetPlayingSegmentInfo.

Returns a Dictionary with the segment info.


  • set_game_object_output_bus_volume(game_object: Object, listener: Object, control_value: float) -> bool

Sets the Output Bus Volume of the given game_object. Calls AK::SoundEngine::SetGameObjectOutputBusVolume.

Returns true if setting the Output Bus Volume succeeded.


  • set_game_object_aux_send_values(game_object: Object, ak_aux_send_values: Array, num_send_values: int) -> bool

Sets the Auxiliary Busses to route the specified game_object. Pass an Array of Dictionaries to ak_aux_send_values representing environments. The Dictionaries should contain the keys aux_bus_id (the Aux Bus ID) and control_value (float representing the attenuation or amplification factor applied to the volume of the sound going through the auxiliary bus). Pass the number of environments to num_send_values, 0 to clear the game object's auxiliary send. Calls AK::SoundEngine::SetGameObjectAuxSendValues.

Returns true if succeeded.


  • set_object_obstruction_and_occlusion(game_object: Object, listener: Object, calculated_obs: float, calculated_occ: float) -> bool

Sets the obstruction and occlusion levels of the given game_object. It's up to you to calculate the calculated_obs and calculated_occ values. Calls AK::SoundEngine::SetObjectObstructionAndOcclusion.

Returns true if succeeded.


  • set_geometry(vertices: Array, triangles: Array, acoustic_texture: Resource, occlusion_value: float, game_object: Object, enable_diffraction: bool, enable_diffraction_on_boundary_edges: bool, associated_room: Object) -> bool

Adds a set of geometry from the SpatialAudio module for geometric reflection and diffaction processing on the given 'game_object'. vertices should be an Array containing Vertices (Vector3), pass an Array of triangles (int) to triangles. enable_diffraction enables or disables geometric diffraction for this geometry, enable_diffraction_on_boundary_edges enables or disables geometric diffraction on boundary edges for this geometry. Pass the associated_room object if the geometry is inside a room, null if the geometry has a global scope. Doing so reduces the search space for ray casting performed by reflection and diffraction calculations. acoustic_texture is a AkAcousticTexture resource (currently not supported). Pass null here if you don't use acoustic textures. Calls AK::SpatialAudio::SetGeometry.

TODO: AcousticTexture


  • remove_geometry(game_object: Object) -> bool

Removes a set of geometry. Pass the game_object that was used to register the geometry. Calls AK::SpatialAudio::RemoveGeometry.

Returns true if removing the geometry set succeeded.


  • register_spatial_listener(game_object: Object) -> bool

Registers a spatial audio listener with the given game_object.

Note: There can be only one Spatial Audio listener registered at any given time

Calls AK::SpatialAudio::RegisterListener.

Returns true if registering the spatial audio listener succeeded.


  • set_room(game_object: Object, ak_aux_bus_id: int, reverb_level: float, transmission_loss: float, front_vector: Vector3, up_vector: Vector3, keep_registered: bool, associated_geometry_instance: Object) -> bool

Adds a room with the given game_object. Pass the reverb aux bus that is associated with the room to ak_aux_bus_id.

Calls AK::SpatialAudio::SetRoom.

Returns true if setting the room succeeded.


  • remove_room(game_object: Object) -> bool

Removes a room with the given game_object. Calls AK::SpatialAudio::RemoveRoom.

Returns true if removing the room succeeded.


  • set_portal(game_object: Object, transform: Transform3D, extent: Vector3, front_room: Object, back_room: Object, enabled: bool) -> bool

Adds an acoustic portal with the given game_object at the transform position. extent defines the dimensions of the portal relative to its center. Pass room objects created with set_room to front_room and back_room. enabled defines wheter the portal is active or enabled. Calls AK::SpatialAudio::SetPortal

Returns true if setting the portal succeeded.


  • remove_portal(game_object: Object) -> bool

Removes a portal created previously with set_portal. Calls AK::SpatialAudio::RemovePortal.

Returns true if removing the portal succeeded.


  • set_game_object_in_room(game_object: Object, room: Object) -> bool

Sets the room that the game object is currently located in. Pass a previously registered game object to game_object and the room to room. Calls AK::SpatialAudio::SetGameObjectInRoom.

Returns true if setting the game object in a room succeeded.


  • remove_game_object_from_room(game_object: Object) -> bool

Removes the given game_object from any room. Calls AK::SpatialAudio::SetGameObjectInRoom.

Returns true if removing the game object from a room succeeded.


  • set_early_reflections_aux_send(game_object: Object, aux_id: int) -> bool

Set the given early reflections auxiliary bus aux_id for the particular game object game_object. Calls AK::SpatialAudio::SetEarlyReflectionsAuxSend.

Returns true if setting the early reflections auxiliary bus succeeded.


  • set_early_reflections_volume(game_object: Object, volume: float) -> bool

Set the given early reflections send volume volume for the particular game_object. Calls AK::SpatialAudio::SetEarlyReflectionsVolume.

Returns true if setting the early reflections send volume succeeded.


  • add_output(share_set: String, output_id: int) -> bool

Adds an output to with the given share_set name and output_id to the sound engine. Calls AK::SoundEngine::AddOutput.

Returns true if adding the output succeeded.


  • remove_output(output_id: int) -> bool

Removes an output with the given output_id. Calls AK::SoundEngine::RemoveOutput.

Returns true if removing the output succeeded.


  • suspend(render_anyway: bool) -> bool

Suspends the sound engine. Set render_anyway to true if your game still runs in backround. Calls AK::SoundEngine::Suspend.

Returns true if suspending the sound engine succeeded.


  • wakeup_from_suspend() -> bool

Wakes up the sound engine and starts processing audio again. Calls AK::SoundEngine::WakeupFromSuspend.

Returns true if waking up the sound engine succeeded.