-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Cannot switch Audio input device (AudioServer.input_device) #75603
Comments
I have analyzed the problem and found the cause and an initial fix for this problem. Affected file: drivers\wasapi\audio_driver_wasapi.cpp Debugging showed that in the current state by using the given project the audio_input is not initialized. After this is done it still wont work since the audio_input.audio_device is never started. Now things are in a "working" state. I am extremely new to this codebase (just started 2 hours ago) so i am not sure if this would be the "right" solution in case of this engine. Also since the change of the device seem to be done in a separate thread your print statement in the GoDot script: Hope i could help EDIT:: should take my ADHD meds, this info is all over the place... sry, basically cannot change device because device not active. I am happy to provide more information if needed... EDIT2:: I have now gained more insight into the code. I understand the problem better and would like to fix this. However i will need a little time as im still reading through the contribution guides/rules |
I greatly appreciate your help @lazydevl0per 👍 |
Until then you can get the audio device to change if you add an AudioStreamPlayer Node to your scene and choose an AudioStreamPlaybackMicrophone resource as stream source for it. Make sure to start the AudioStreamPlayer so that the input data is being collected. |
Can you reproduce this issue in 3.5.2? It's worth checking so that we can cherry-pick the fix to |
I will try. Need to make a build for 3.5.2 real quick :) EDIT:: Nevermind, glanced over the 3.5 code and saw that the AudioDriver API is entirely different. Event though the underlying AudioDriver interface being different it seems that the same logic is contained in the 3.5 WASAPI driver. The same behaviour is reproducable with the following project built for 3.5: I am not sure how to handle fixing this on the 3.5 branch. It should be easy doable to recreate the fix on a separate branch for 3.5 with a separate PR but i dont know if thats the best course of action. |
Tried it yesterday on latest master branch and the issue is still present. @MJacred this issue is caused by the same logic in 3.x however the affected file changed too much from 3.x to 4.x so it might require its own fix, dont know if cherrypicking or something similiar will work in this case. Also this is an OS Specific Audio issue, currently only present on Windows using the WASAPI driver |
@lazydevl0per: Yes, it would need its own fix in that case with a brand new PR. The other issue was also assigned to Windows (wasapi) platform. |
Are we sure this is a platform-specific problem? I'm running into it on Linux, using v4.2.1.stable.mono.official [b09f793]. No matter what I do, I can't get it to switch inputs. Here's a screenshot from within my editor: Here, I'm showing that the input I'm trying to set the server to matches one of the entries in its list of inputs, but it ends up assigning I've tried locking and then unlocking first, no dice. Am I running into a different-yet-similar problem? EDIT: Also, this happens for output devices as well. I do have the project setting checked to get inputs. EDIT 2: Well. . .I can't reproduce this 100% of the time in a fresh project, but, it does seem to sporadically pop up in this sample project on Linux Mint: https://gitlab.com/b4ux1t3/AudioTestGodot It does seem to happen 100% of the time in the project where I originally saw this: https://gitlab.com/b4ux1t3/RigControl.Net/-/tree/godot-gui?ref_type=heads To be clear, it is almost impossible for most people to vet this from my primary project here; it relies on having specific hardware and external conditions to Godot. I include it just so the code is available. EDIT 3: For my last edit, I want to share that I'm running into this issue in the non-mono Godot, as well. I copied the scene from my .NET project, got everything working in GDScript, and am still unable to correctly switch audio devices. I'm starting to think I may need to open a separate ticket for this, though, because it does sometimes seem to actually switch audio devices. But only sometimes. |
Yes, this is specific to Windows because the bug is in AudioDriverWASAPI. Even if the cause is similar, it would require a separate fix than addressing this bug. Open another bug report if you get the chance! |
Gotcha! That was basically what I was asking, if I should open another ticket for the Linux issue. I'll get the project dusted off, see if recent versions fixed it, and go from there. Thanks! |
Hello, any idea about this issue? With the trend of using voice in games, it should very nice to get an eyes on
Hi @b4ux1t3, Did you have a bit of time to check this issue? 🙂 |
I have not had time yet, sorry! I'm planning on doing a round of godot version upgrades with the release in the near-ish future. |
I am also unable to set the AudioServer.output device in 4.3. Giving it anything from the get_output_device_list() just results in it still being 'Default'. |
Godot version
v4.0.1.stable.official [cacf499]
System information
Windows 11, Sound card zoom h2n, Sound card Roland duo capture
Issue description
I try to switch the audio input using the AudioServer.set_input_device() method. Unfortunately, the input device is always the same.
Steps to reproduce
Minimal reproduction project
AudioInputDeviceList.zip
The text was updated successfully, but these errors were encountered: