Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing docs about AudioServer.set_device #58096

Closed
tavurth opened this issue Feb 14, 2022 · 7 comments · Fixed by #58104
Closed

Confusing docs about AudioServer.set_device #58096

tavurth opened this issue Feb 14, 2022 · 7 comments · Fixed by #58104

Comments

@tavurth
Copy link
Contributor

tavurth commented Feb 14, 2022

Godot version

3.4.2.stable

System information

Mac OSX (Intel 2019)

Issue description

I was trying to fix some of the CPU usage caused by coreaudio running non-stop while the editor runs.

Associated issues & PRs

#38154
#55608
#38208
#45948

Here is the plugin I was working on

https://github.com/tavurth/godot-sound-disabler

What's not working

ProjectSettings["audio/driver"] = "dummy"

Steps to reproduce

Please see above, sample code can be found here

https://github.com/tavurth/godot-sound-disabler

Minimal reproduction project

https://github.com/tavurth/godot-sound-disabler

@Calinou
Copy link
Member

Calinou commented Feb 14, 2022

The audio driver can't be changed at run-time, as Godot does not have a way to restart the audio server without restarting the entire project. Implementing this is likely nontrivial, but it would also allow for changing the output latency without restarting the project.

@tavurth
Copy link
Contributor Author

tavurth commented Feb 14, 2022

The audio driver can't be changed at run-time

I see, so that "audio/driver" is actually used to spawn the project when running as an export.

Makes more sense about why it's not working then.

It would be great to be able to do this, as from the code I linked above, a temporary (in-editor rather than command line) workaround to all those issues would be simple to implement in GDscript, compared to complex in C++.

@Calinou
Copy link
Member

Calinou commented Feb 14, 2022

Actually, set_device() has nothing to do with setting the audio driver. set_device() is meant to set the output device when multiple devices are attached (which is possible with USB or HDMI audio).

This is why setting it to "dummy" will have no effect, because "dummy" is not a valid audio device name on your system.

@tavurth
Copy link
Contributor Author

tavurth commented Feb 14, 2022

Hi @Calinou I think there is some misunderstanding.

I think this statement is what I was looking for with this issue:

Godot does not have a way to restart the audio server
Implementing this is likely nontrivial, but it would also allow for changing the output latency without restarting the project.

This bug is more about the ProjectSettings["audio/driver"] = "dummy" not working in the editor. I will update the title to reflect that.

@tavurth tavurth changed the title AudioServer.set_device does not work in the editor ProjectSettings["audio/driver"] = "dummy" does not work in the editor Feb 14, 2022
@tavurth tavurth changed the title ProjectSettings["audio/driver"] = "dummy" does not work in the editor ProjectSettings["audio/driver"] does not work in the editor (no way to change audio driver) Feb 14, 2022
@Calinou
Copy link
Member

Calinou commented Feb 14, 2022

This bug is more about the ProjectSettings["audio/driver"] = "dummy" not working in the editor. I will update the title to reflect that.

Most project settings are not designed to be changed at run-time, as their value is not read continuously by the engine (doing this is slow). Instead, you should use server methods (like AudioServer's), and there is no such method exposed yet.

There is no bug here, just missing functionality. You should open a feature proposal 🙂

@tavurth
Copy link
Contributor Author

tavurth commented Feb 14, 2022

I see, shall we close this issue then, or revert to the set_device and use as a documentation bug?

@Calinou
Copy link
Member

Calinou commented Feb 14, 2022

I see, shall we close this issue then, or revert to the set_device and use as a documentation bug?

You can keep this issue open as a documentation issue.

@tavurth tavurth changed the title ProjectSettings["audio/driver"] does not work in the editor (no way to change audio driver) Confusing docs about AudioServer.set_device Feb 14, 2022
@akien-mga akien-mga added this to the 3.5 milestone Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants