Allow retrieving an Audio Bus instance from creation, by name, and by index. #11120
yosimba2000
started this conversation in
Engine Core
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://docs.godotengine.org/en/stable/classes/class_audioserver.html
You can create audio bus via
add_bus
, but it does not return the bus instance. You must remember the index you assigned this new bus.You can assign a bus name via
set_bus_name
, but it requires the bus index.You can retrieve the bus index via
get_bus_index
, but it requires the bus name.There is no method that retrieves the actual bus instance/class.
In all cases, ONLY the bus index is used to identify a bus.
The ONLY time the bus name is even used is when assigning the
set_bus_send
of a bus, or assigning the bus of an AudioPlayer node.I think the following should be done:
add_bus
is changed to accept 2 parameters: an integer for bus index, and string for bus name. This assigns the bus index at the integer, and assigns the bus name to the string.add_bus
should also return the newly created bus instance.get_bus_by_index
that takes an integer and returns the bus instance at that index.get_bus_by_name
that takes a string/stringName and returns the bus instance with the matching name.(eg) Say I'm changing a reverb effect:
get_bus_by_name("MyBusName").Effect(someEffectIndex).roomSize=1
get_bus___
functions likeget_bus_effect
are modified to accept a bus index and/or name parameter to find the bus.remove_bus
to accept both int index and bus name to delete the audio bus.This is important because adding/deleting bus instances can affect the indices of all the other buses. And now the indices you've just memorized/stored are no longer valid. But caching bus instances or retrieving them by name solves that issue.
Beta Was this translation helpful? Give feedback.
All reactions