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

Missing OS.get_current_audio_driver_index() #63677

Open
Tracked by #76797
MJacred opened this issue Jul 30, 2022 · 2 comments
Open
Tracked by #76797

Missing OS.get_current_audio_driver_index() #63677

MJacred opened this issue Jul 30, 2022 · 2 comments

Comments

@MJacred
Copy link
Contributor

MJacred commented Jul 30, 2022

Godot version

3.x

System information

All

Issue description

NOTE: This is not a Godot proposal, because I think it belongs to the category which deserves some leeway (as stated in godot-proposals).


For video driver, you can get the current one by calling OS.get_video_driver_name(OS.get_current_video_driver())

Something equivalent should exist for getting the current audio driver.

Currently we can only fetch the following info, which is does not allow to properly narrow it down:

	print(AudioServer.get_device()) # prints: Default
	for d in AudioServer.get_device_list():
		print(d)
        # prints:
        # * Default
        # * alsa_output.pci-0000_00_1f.3.analog-stereo
        # * alsa_output.pci-0000_02_00.1.hdmi-stereo-extra1
	for i in OS.get_audio_driver_count():
		print(OS.get_audio_driver_name(i))
        # prints:
        # * PulseAudio
        # * ALSA
        # * Dummy

an OS.get_current_audio_driver_index() which fits to OS.get_audio_driver_name(index) should be implemented to align with e.g. video driver info.

There's also the "audio/driver" property in the project settings, but that only works if there's a value entered that's actually valid.

In master branch, the get_audio_driver_count and get_audio_driver_name are not in OS anymore, but in AudioDriverManager, which has no bindings afaics… For Godot 4, this should get exposed again, or at least the latter including OS.get_current_audio_driver_index()

Steps to reproduce

Minimal reproduction project

No response

@lawnjelly
Copy link
Member

In 3.x you can't currently change the audio driver on the fly, which makes this info not super useful at the moment. As you say you can display the audio drivers list, and the current driver string. It's not difficult to expose though.

#63458 however adds functionality to change audio driver at runtime. Although I haven't exposed changing the driver yet aside from flipping between dummy and selected driver (for muting), hot swapping the driver could potentially be done for audio apps where multiple drivers are available, along with retrieving the current driver ID. Although I would like to get some more feedback from Juan before working further on this (otherwise it may be wasted effort).

There is also one situation which is not dealt with currently, which if something externally changes the drivers available in the OS or numbering, which would be kind of nice. But it's not a massive priority as this is probably a pretty rare scenario.

@MJacred
Copy link
Contributor Author

MJacred commented Jul 30, 2022

There's also the use case of collecting system data for error/bug reporting. If the issue is audio related, knowing the driver would help (especially if you can auto-fetch it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants