AudioServer cannot set input/output devices for very long names on Linux
Tested versions
- Reproducible in 4.2.2.stable.official [15073afe3] linux
- Reproducible in 4.2.1.stable.offical linux
System information
Godot v4.2.2.stable - Ubuntu 23.10 23.10 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 (nvidia; 535.171.04) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
AudioServer will not select devices ( either for playback or recording ) if the device string is very long.
Using the official Godot demo projects ( https://github.com/godotengine/godot-demo-projects.git ) Audio Device Changer demo ( branch 4.2, path audio/device_changer ) or any other project that uses AudioServer, cannot select some audio devices for either playback or recording.
The devices that cannot be selected have very long names. Shorter named devices function. Devices function in same apps on Windows.
Examples: Default -- works fine alsa_output.pci-0000_0c_00.4.3.iec958-stereo -- works fine alsa_output.usb-Generic_USB_SPDIF_Adapter_202110200032-00.3.iec958-stereo -- works fine alsa_output.usb-Plantronics_Plantronics_BT600_b396c3ee30880d4e8f71f6d6fb9d20cc-00.3.analog-stereo -- cannot be selected.
When devices fail, previous device remains functional. New device looks like it has been chosen in UI, but playback/recording continue on previous active device. Device in question is a headset with microphone.
Steps to reproduce
Run official audioserver demo on Linux with long device names? Unsure this is the cause -- seems to be.
Minimal reproduction project (MRP)
Repro's with official Godot audioserver demo file.
Did you test on the latest 4.3 release candidate? https://godotengine.org/article/release-candidate-godot-4-3-rc-1/
Did you test on the latest 4.3 release candidate? https://godotengine.org/article/release-candidate-godot-4-3-rc-1/
Just tried. It works fine on 4.3 RC1 :)
Then beyond identifying what might have fixed this for possible cherry picking this can be closed
From a quick look at relevant changelogs for AudioServer, alsa/pulseaudio or the Linux platform, I don't spot at a glance what might have fixed this.
I think we can close it as fixed in 4.3.
@ipeerbhai If you want, you could test earlier beta/dev snapshots of 4.3 to pinpoint the first one that works, thus narrowing down the list of changes which might have solved it. Then maybe I can find what was the fix and cherry-pick it for 4.2.3. Otherwise we can just consider the work done here with the bug fixed for 4.3+.
This repro s on latest 4.3 RC3.
Behavior is slightly different.
If Headset mic is "Default" on system, everything works fine.
If any other mic is "Default" on system, cannot activate this microphone. Can activate other microphones, just not the plantronics.
Edit: I noticed someone mentioning the same issue in the non-mono version of Godot for input devices here too. Perhaps it's related to this: https://github.com/godotengine/godot/issues/75603
Hi,
Can this bug be re-opened? I'm on the released version of v4.3 and this appears to still be the case for input devices (as mentioned in the last comment). I've added the following code snippet to test things out in my project (ignore my custom logger - same as print in this case) Input device:
Logger.debug(
"Changing device from %s to %s" % [AudioServer.get_input_device(), input_audio_select.get_item_text(index)]
)
AudioServer.set_input_device(input_audio_select.get_item_text(index))
await get_tree().process_frame
Logger.debug("Device officially set to: %s" % AudioServer.get_input_device())
Output from input device:
2024-08-25T06:10:36 - DEBUG: Changing device from to alsa_input.pci-0000_06_00.6.analog-stereo
2024-08-25T06:10:36 - DEBUG: Device officially set to:
However, for output device:
Logger.debug(
"Changing device from %s to %s" % [AudioServer.get_output_device(), output_audio_select.get_item_text(index)]
)
AudioServer.set_output_device(output_audio_select.get_item_text(index))
await get_tree().process_frame
Logger.debug("Device officially set to: %s" % AudioServer.get_output_device())
Output from output device:
2024-08-25T06:10:30 - DEBUG: Changing device from Default to alsa_output.pci-0000_06_00.6.analog-stereo
2024-08-25T06:10:30 - DEBUG: Device officially set to: alsa_output.pci-0000_06_00.6.analog-stereo
Note: Yes I have the input setting enabled in my project settings. Microphones work fine for player to player communication, as long as I start the game with my headset plugged in.