You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the option to change the audio driver to the Dummy driver and back at runtime, with a set of MuteState flags - Disabled (user control), Silence (period of silence), Focus Loss (when app is not in focus), and Paused (when app is paused).
Control for the flags is added for the editor in EditorSettings, and for the project in ProjectSettings.
Editor defaults to muted (Dummy driver) when there is no audio output, and automatically switches to active on output. This significantly reduces CPU usage.
Copy file name to clipboardExpand all lines: doc/classes/AudioServer.xml
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -182,6 +182,12 @@
182
182
If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
183
183
</description>
184
184
</method>
185
+
<methodname="is_enabled"qualifiers="const">
186
+
<returntype="bool" />
187
+
<description>
188
+
If [code]false[/code], the audio server is disabled/muted.
189
+
</description>
190
+
</method>
185
191
<methodname="lock">
186
192
<returntype="void" />
187
193
<description>
@@ -276,6 +282,13 @@
276
282
Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
277
283
</description>
278
284
</method>
285
+
<methodname="set_enabled">
286
+
<returntype="void" />
287
+
<argumentindex="0"name="enabled"type="bool" />
288
+
<description>
289
+
If [code]true[/code], the audio server is enabled and can output or input audio. Setting this to [code]false[/code] will mute audio input/output and minimize audio CPU usage.
Safer override for [member audio/mix_rate] in the Web platform. Here [code]0[/code] means "let the browser choose" (since some browsers do not like forcing the mix rate).
If [code]true[/code], the current audio driver will be automatically disabled when the application loses focus, and re-enabled when the application regains focus.
If [code]true[/code], the current audio driver will be automatically disabled when the application is paused by the OS, and re-enabled when the application is resumed.
313
+
[b]Note:[/b] This only affects platforms where the OS can pause applications (typically Android and iOS). This does not refer to in-game pausing, where you can manually mute audio by calling [method AudioServer.set_enabled].
If [code]true[/code], the current audio driver will be automatically disabled after a period of silence is detected, and re-enabled when audio attempts to play. This may result in temporarily higher audio latency when audio restarts after being muted.
Specifies the preferred output latency in milliseconds for audio. Lower values will result in lower audio latency at the cost of increased CPU usage. Low values may result in audible cracking on slower hardware.
306
320
Audio output latency may be constrained by the host operating system and audio hardware drivers. If the host can not provide the specified audio output latency then Godot will attempt to use the nearest latency allowed by the host. As such you should always use [method AudioServer.get_output_latency] to determine the actual audio output latency.
0 commit comments