Add AudioServer.get_driver_name() to get the actual audio driver name

The project setting does not reflect CLI argument overrides
(including `--headless` which sets the audio driver to `Dummy`),
so it can't be reliably used to detect which audio driver is
actually being used at run-time.
This commit is contained in:
Hugo Locurcio
2024-10-22 23:14:59 +02:00
parent 533c616cb8
commit 77c31b9cc8
4 changed files with 15 additions and 0 deletions

View File

@@ -110,6 +110,12 @@
Returns the volume of the bus at index [param bus_idx] in dB.
</description>
</method>
<method name="get_driver_name" qualifiers="const">
<return type="String" />
<description>
Returns the name of the current audio driver. The default usually depends on the operating system, but may be overridden via the [code]--audio-driver[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url]. [code]--headless[/code] also automatically sets the audio driver to [code]Dummy[/code]. See also [member ProjectSettings.audio/driver/driver].
</description>
</method>
<method name="get_input_device_list">
<return type="PackedStringArray" />
<description>