I don't want to use OpenAL audio at all, so I don't think I should be required to distribute the libraries related to it.
It would be better to make me choose whether I want to initialize the MonoGame audio (and load the libs) or not. It's done in the runtime anyway, so this functionality should be easy to add (e.g. static Game.InitializeAudio = false; before creating the Game instance), especially that my use case isn't really isolated. I believe that many gamedevs choose FMOD or Wwise over solutions native to engines/frameworks simply because their sound designers are used to these tools.
I get that it might be a minor issue to most people, but there's no need to be forced to distribute two audio frameworks simultaneously (which is one of many reasons I don't really like Unity) and it seems to be easy to avoid in case of MonoGame. Give us more freedom :)
I thought MG already silently failed when OpenAL initialization throws an exception. Can you post a stack trace?
Should we add an API for this as suggested or just silently fail?
It did in 3.6, but I decided to try 3.7.
Stack trace:
Microsoft.Xna.Framework.Audio.NoAudioHardwareException occurred
HResult=0x80004005
Message=Failed to init OpenALSoundController
Source=MonoGame.Framework
StackTrace:
at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game game)
at Microsoft.Xna.Framework.Game..ctor()
at Monster.EngineSystem..ctor() in E:\LocalProjects\Game210617\Game210617\_Main\EngineSystem.cs:line 71
at Monster.Program.Main() in E:\LocalProjects\Game210617\Game210617\_Main\Program.cs:line 18
I was looking at these sources before creating this issue and it seems that SdlGamePlatform does this:
I think that having an option to choose would be the better thing, at least for me.
I'm getting this same error in MonoGame 3.7.0.1129, but I'm using OpenAL. If the user doesn't have sound enabled, I agree that we should be able to handle whether we want the game to run or not. Has there been any progress on this?
I have no audio devices connected to my dev machine and I get a NoAudioHardwareException even tough I do not use or need audio at all for the application I am going to write. There should be a switch to disable the audio engine if I don't need it.
Connecting a headset helps but I don't want to connect a headset because I don't want to hear anything.
Microsoft.Xna.Framework.Audio.NoAudioHardwareException
HResult=0x80004005
Message=OpenAL device could not be initialized, see console output for details.
Source=MonoGame.Framework
StackTrace:
at Microsoft.Xna.Framework.Audio.OpenALSoundController..ctor()
at Microsoft.Xna.Framework.Audio.OpenALSoundController.get_GetInstance()
at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game game)
at Microsoft.Xna.Framework.Game..ctor()
at Game1.Game1..ctor() in C:\dev_Tests\Game1\Game1\Game1.cs:line 21
at Game1.Program.Main() in C:\dev_Tests\Game1\Game1\Program.cs:line 16
This is connected to #4717 so I'm gonna add this to the 3.7 milestone.
Should be fixed, see #6629
Most helpful comment
It did in 3.6, but I decided to try 3.7.
Stack trace:
I was looking at these sources before creating this issue and it seems that SdlGamePlatform does this:
https://github.com/MonoGame/MonoGame/blob/1a9466ef46b98d9b4ea5818190eaa33df1c5a6df/MonoGame.Framework/SDL/SDLGamePlatform.cs#L77
I think that having an option to choose would be the better thing, at least for me.