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

AudioServer.capture_set_device()and AudioServer.device() do not work on Windows #46710

Open
Tracked by #76797
Gamemap opened this issue Mar 5, 2021 · 20 comments
Open
Tracked by #76797

Comments

@Gamemap
Copy link
Contributor

Gamemap commented Mar 5, 2021

Godot version:

Godot 3.2.3 64 Bit and Godot 3.2.4 RC3

OS/device including version:

Windows 8.1

Issue description:

AudioServer.capture_set_device("Stereo Mix") don't work.

print(AudioServer.capture_get_device_list())
Has as output: [Default, Stereo Mix (Realtek High Definition Audio), Microphone (Realtek High Definition Audio)]
But AudioServer.capture_set_device("Stereo Mix") (or AudioServer.capture_set_device("Stereo Mix (Realtek High Definition Audio)")) has with print(AudioServer.capture_get_device()) only Default as output. (It also won't work with Microphone.)

Maybe the documentation should be improved, if I have understood something wrong.
I haven't tested the AudioServer.device .

Steps to reproduce:

  1. AudioServer.capture_set_device("Stereo Mix")
  2. print(AudioServer.capture_get_device())

Minimal reproduction project:

AudioServer.zip (Enable Stereo Mix in Windows AudioSettings.)

@Calinou Calinou changed the title AudioServer.capture_set_device() AudioServer.capture_set_device() doesn't work Mar 5, 2021
@Calinou
Copy link
Member

Calinou commented Mar 5, 2021

@Gamemap Please upload a minimal reproduction project to make this easier to troubleshoot.

@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 5, 2021

I have uploaded it.
You have to enable Stereo Mix on Windows or you can change the line 12 to `AudioServer.capture_set_device("Micophone"). (If you have an Microphon on your PC)

@snougo
Copy link

snougo commented Mar 7, 2021

I can't be sure AudioServer.capture_set_device() works or not, because the minimal project is too simple, so I just uplaod the screenshot

Screen Shot 2021-03-07 at 16 38 04

Screen Shot 2021-03-07 at 16 38 11

@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 7, 2021

When I run the exact same script, my output is this:
Audio

Maybe it is somhow only one Realtekdevice?

@snougo
Copy link

snougo commented Mar 7, 2021

When I run the exact same script, my output is this:
Audio

Maybe it is somhow only one Realtekdevice?

I use Mac, so not sure about that

@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 7, 2021

It is probably a Windows problem. (I use Windows 8.1)

@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 7, 2021

AudioServer.device =AudioServer.get_device_list()[1] does not work either. ( Speaker (Realtek High Definition Audio) )

@Gamemap Gamemap changed the title AudioServer.capture_set_device() doesn't work AudioServer.capture_set_device()and AudioServer.device() do not work Mar 7, 2021
@Gamemap Gamemap changed the title AudioServer.capture_set_device()and AudioServer.device() do not work AudioServer.capture_set_device()and AudioServer.device() do not work on Windows Mar 7, 2021
@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 11, 2021

If I run this script and use a AudioStreamPlayer with a AudioStreamMicrophone the Output prints Default but the Microphone (also Stereo Mix) don't work. Without this code the microphone works.

AudioServer.capture_set_device("Stereo Mix (Realtek High Definition Audio)")
  print(AudioServer.capture_get_device())

Edit:
There is also this error:

E 0:00:02.473 audiodeviceinit: WASAPI: Initialize failed with error 0xffffffff8889000a.
<C++-Fehler> Condition "hr != ((HRESULT)0x00000000)" is true. Returned: ERRCANTOPEN
<C++-Quellcode>drivers/wasapi/audiodriverwasapi.cpp:299 @ audiodeviceinit()

@infohub-gather
Copy link

I am on Windows 10 and setting the device as above does indeed not work. Godot 3.3.2 Stable.

AudioServer.capture_set_device(AudioServer.capture_get_device_list()[2])

@Gamemap
Copy link
Contributor Author

Gamemap commented Mar 6, 2022

Dosn't work on Windows 11 with Godot v4.0.alpha2.official [79077e6].
AudioServer.capture_set_device(AudioServer.capture_get_device_list()[1])

@Gamemap
Copy link
Contributor Author

Gamemap commented Jun 15, 2022

Not working with Godot v4.0.alpha10.official [4bbe7f0]

@panmaro
Copy link

panmaro commented Oct 11, 2022

Tested on Windows 7 SP1, Godot_v3.5.1-stable_win64, Godot_v3.5-stable_win64, Godot_v3.4.4-stable_win64.
Not working.
I tried to set device from capture_get_device_list (I have 3 devices). The result of AudioServer.capture_get_device() is always "Default".

@Gamemap
Copy link
Contributor Author

Gamemap commented Oct 12, 2022

Also not working with Godot 4.0 Beta 1.
Edit: ... and with Beta 3 neither.

@souplamp
Copy link
Contributor

souplamp commented Feb 3, 2023

With #69120, here is a new project to test this: beta17.zip

Update: It seems that the output device does actually update, but it won't print the new device name immediately after. Selecting a new output device and playing a sound (see project) shows that it is still being updated. No luck with the input device, still.

@Calinou
Copy link
Member

Calinou commented Feb 3, 2023

Do you have microphone access enabled in the Windows settings? This setting affects both Win32 and UWP applications.

image

Also make sure Let desktop apps access your microphone is enabled on that page.

@souplamp
Copy link
Contributor

souplamp commented Feb 3, 2023

I have the equivalent Windows 10 setting enabled, but Godot 4 does not come up on the list of apps, so that might be related.

Edit: Nevermind, giving Godot and a running project the input devices through audio settings does not work either. The console is printing the current input device using AudioServer.get_input_device().
access

@souplamp
Copy link
Contributor

souplamp commented Feb 9, 2023

Microphone input does not work on Godot 4 Beta 17 & RC1 due to #72892. I'll build from master on Windows 11 and see if that makes a difference.

@souplamp
Copy link
Contributor

souplamp commented Mar 8, 2023

Time flies. Turns out (at least my hunch is) Godot isn't initializing the microphone (even after enabling audio input in Project Settings). Checking the Windows microphone settings, the last time Godot asked for microphone use was in Godot 3 about a year ago on my machine. So for some reason, WASAPI might not be initializing now in Godot 4.0.

@infohub-gather
Copy link

infohub-gather commented Mar 24, 2023

Time flies. Turns out (at least my hunch is) Godot isn't initializing the microphone (even after enabling audio input in Project Settings). Checking the Windows microphone settings, the last time Godot asked for microphone use was in Godot 3 about a year ago on my machine. So for some reason, WASAPI might not be initializing now in Godot 4.0.

Same problem here, did all of the above but WASAPI is not initializing. I got it to work in a Beta, but somehow the problem returned.

If I run Godot 4 first, no error, but as soon as I turn on another audio program (to get the input in) its starts spitting the errors:
W 0:00:28:0839 thread_func: WASAPI: Current output_device invalidated, closing output_device <C++ Source> drivers/wasapi/audio_driver_wasapi.cpp:794 @ thread_func()

@benchpres
Copy link

Started working for me after disabling all other microphones and turning off "Exclusive Mode" on my default microphone.
exclusive
Since this is not a necessary step to do in other games, I think it is still fair to consider this a bug.

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

7 participants