Skip to content

Commit

Permalink
Merge pull request #97 from alessandrofama/fix-set-game-object-output…
Browse files Browse the repository at this point in the history
…-bus-volume-listener-null

Refactor `set_game_object_output_bus_volume` to allow for `AK_INVALID_GAME_OBJECT` (null) parameter.
  • Loading branch information
alessandrofama authored May 7, 2024
2 parents d163d4b + 30839c4 commit 28948f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions addons/Wwise/native/doc/Wwise.xml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@
<description>
Sets the Output Bus Volume of the given [param game_object]. Calls
[code]AK::SoundEngine::SetGameObjectOutputBusVolume[/code].[br][br]
Set [param listener] to [code]null[/code] to set the Output Bus Volume for all
connected listeners.[br][br]
Returns [code]true[/code] if setting the Output Bus Volume succeeded.
</description>
</method>
Expand Down
12 changes: 9 additions & 3 deletions addons/Wwise/native/src/wwise_gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,15 @@ Dictionary Wwise::get_playing_segment_info(const unsigned int playing_id, const

bool Wwise::set_game_object_output_bus_volume(const Object* game_object, const Object* listener, float f_control_value)
{
return ERROR_CHECK(
AK::SoundEngine::SetGameObjectOutputBusVolume(static_cast<AkGameObjectID>(game_object->get_instance_id()),
static_cast<AkGameObjectID>(listener->get_instance_id()), f_control_value));
AkGameObjectID listener_obj_id{ AK_INVALID_GAME_OBJECT };

if (listener)
{
listener_obj_id = static_cast<AkGameObjectID>(listener->get_instance_id());
}

return ERROR_CHECK(AK::SoundEngine::SetGameObjectOutputBusVolume(
static_cast<AkGameObjectID>(game_object->get_instance_id()), listener_obj_id, f_control_value));
}

bool Wwise::set_game_object_aux_send_values(
Expand Down

0 comments on commit 28948f4

Please sign in to comment.