Skip to content

Remove XAudio2 support #108846

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kus04e4ek
Copy link
Contributor

Why remove support?

XAudio2 driver is not being developed:

  • XAudio2 driver can only be compiled using MSVC (didn't actually test, might be broken with MSVC as well);
  • No new features have been implemented in quite a long time (most of the recent changes are stylistic or were just applied to all audio drivers).

XAudio2 driver is not being used:

  • There are no issues/proposals for the 4.x releases mentioning XAudio2;
  • There's an audio driver for Windows that Godot supports better.
XAudio2 WASAPI
Microphone support - +
Audio channels supported 2 1-8
Audio formats supported 16-bit PCM 8-bit PCM,16-bit PCM, 24-bit PCM, 32-bit PCM, float PCM

Microphone support can't be implemented it seems (at least without using multiple audio drivers at once) while every other missing feature can be, however there are no requests from users.

This fixes the compilation issues for me
diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub
index cd210466a2..7ad8245a20 100644
--- a/drivers/xaudio2/SCsub
+++ b/drivers/xaudio2/SCsub
@@ -5,4 +5,8 @@ Import("env")
 
 env.add_source_files(env.drivers_sources, "*.cpp")
 env.Append(CPPDEFINES=["XAUDIO2_ENABLED"])
-env.Append(LINKFLAGS=["xaudio2_8.lib"])
+
+if env.msvc:
+    env.Append(LINKFLAGS=["xaudio2_8.lib"])
+else:
+    env.Append(LIBS=["xaudio2_8"])
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index 1946cdb542..12a87ddbb5 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -35,7 +35,6 @@
 #include "core/templates/safe_refcount.h"
 #include "servers/audio_server.h"
 
-#include <mmsystem.h>
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <wrl/client.h>

Why was it added?

It was added to support UWP, however there are no plans to support UWP in Godot 4, so I don't really see an use case for it now.

This PR can always be reverted if an use case for XAudio2 appears, but I don't think there's any reason to support it now. However it's low maintenance, the files can just stay exactly as they were and I don't think anyone will complain. And hey, Godot 4.5 no longer supports Windows 7, so the driver can now be enabled by default

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me.

I agree with removing XAudio2, it's received very little testing (as evidenced by the lack of GitHub issues about it).

@Calinou
Copy link
Member

Calinou commented Jul 21, 2025

Paging @RandomShaper, as XAudio2 is maybe still relevant for some custom ports.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On modern Windows, XAudio2 is just a wrapper over WSAPI. And it seems to be unused for a long time. If it's used by custom ports (unlikely, it's XBox360 era API) it should be part of the port since it's a self-contained driver.

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

Successfully merging this pull request may close these issues.

3 participants