diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-28 07:03:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-28 07:03:35 +0100 |
commit | 807b511125006817373f975e0b833881c966f8cc (patch) | |
tree | eae0665f7768cd02ed56df87d6f3ef3ae180ac45 /modules/gdscript | |
parent | ec74664af19faf37fbf6bfabdd6d0ff252fa8e0d (diff) | |
parent | a6fd6b78dd267d21ea30cc644d8aad10bc0f66ce (diff) |
Merge pull request #36620 from Calinou/doc-linear2db-example
Add a practical example for `@GDScript.linear2db()`
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index d3957c682e..2f6f9f30a4 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -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"> |