Add NO_AUDIO switch to build without audio by ThomasFOG · Pull Request #8750 · MonoGame/MonoGame
This PR adds a ```NO_AUDIO``` constant switch to the DesktopGL, WindowsDX, Android, and iOS .csproj of MonoGame. The reasoning for this switch is to better accommodate third-party sound engines like FMOD or Wwise by entirely disabling audio and any audio dependency that could interfere with or corrupt FMOD/Wwise (while not changing the API). While MonoGame already has a mechanism that doesn't initialize audio unless you use it, there are still possible annoyances: - OpenAL/NVorbis/XAudio are enforced as a dependency, even if ```PrivateAssets``` is used. Therefore users using FMOD or Wwise are still required to ship with those binaries even if they don't use the MonoGame Audio namespace at all (otherwise the app won't start); - the non-initialization mechanism doesn't guarantee that OpenAL or XAudio aren't loaded (it entrusts static initializers for not doing so, which can't be assumed to be reliable throughout all .NET runtimes) The ```NO_AUDIO``` switch fixes those concerns by replacing the Audio implementation with a ```NotImplemented``` version and also removes OpenAL/NVorbis/XAudio binaries/nugets dependencies.