1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Merge pull request #36620 from Calinou/doc-linear2db-example

Add a practical example for `@GDScript.linear2db()`
This commit is contained in:
Rémi Verschelde
2020-02-28 07:03:35 +01:00
committed by GitHub

View File

@@ -600,7 +600,13 @@
<argument index="0" name="nrg" type="float">
</argument>
<description>
Converts from linear energy to decibels (audio).
Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear). Example:
[codeblock]
# "Slider" refers to a node that inherits Range such as HSlider or VSlider.
# Its range must be configured to go from 0 to 1.
# Change the bus name if you'd like to change the volume of a specific bus only.
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear2db($Slider.value))
[/codeblock]
</description>
</method>
<method name="load">