Comments (9)
Technically this is half-accurate; when there's no audio device XNA should be throwing NoAudioHardwareException, but I think there should be a messagebox that tells you this. @SeanColombo or @darthdurden may be able to explain this in a bit more detail.
For now I'm going to shift some things around to try and at least get the messagebox. I might be able to get you an AudioReferenceDevice too, so you can run without worrying about runtime errors there.
from fna-mghistory.
This commit should now ensure that the messagebox shows up, which should be more accurate (or at least more informative). I'll throw together a NullDevice now; shouldn't take more than a few minutes.
from fna-mghistory.
Bam:
Set environment variable FNA_AUDIO_DISABLE_SOUND
to "1" and it should use the NullDevice. This behavior is completely undefined, but at least it should give you the opportunity to just skip sound. Hopefully this has no effect on performance, but I only tested functionality and not perf... we'll see.
EDIT: This is now documented on the FNA wiki:
https://github.com/flibitijibibo/FNA/wiki/7:-FNA-Environment-Variables#fna_audio_disable_sound
from fna-mghistory.
Ok, I get the message box now, but seem not to be catching the exception correctly (or else I am just not understanding how to use). Here is what I did:
THGame game = null;
try
{
game = new THGame();
}
catch(Microsoft.Xna.Framework.Audio.NoAudioHardwareException e)
{
System.Console.WriteLine("No hardware. Trying to use null device.");
System.Environment.SetEnvironmentVariable("FNA_AUDIO_DISABLE_SOUND", "1");
game = new THGame();
}
if (game != null)
{
try
{
game.Run();
}
finally
{
game.Dispose();
}
}
I also tried a plain ole'
catch(Exception e)
-but nothing happened.
from fna-mghistory.
If you happen to have a debugger handy, make sure it's actually creating a NullDevice (or worst case, throw a printf in that block). The first NoAudioHardwareException still makes sense, but the second crash does not...
Sent from my iPhone
On Apr 25, 2015, at 17:53, Tom Happ [email protected] wrote:
Ok, I get the message box now, but seem not to be catching the exception correctly (or else I am just not understanding how to use). Here is what I did:
THGame game = null; try { game = new THGame(); } catch(Microsoft.Xna.Framework.Audio.NoAudioHardwareException e) { System.Console.WriteLine("No hardware. Trying to use null device."); System.Environment.SetEnvironmentVariable("FNA_AUDIO_DISABLE_SOUND", "1"); game = new THGame(); } if (game != null) { try { game.Run(); } finally { game.Dispose(); } }
I also tried a plain ole'
catch(Exception e)
-but nothing happened.
—
Reply to this email directly or view it on GitHub.
from fna-mghistory.
FWIW, I'm now officially out of town but if you want to send me test cases I can still debug on my end as well. Doesn't have to be Linux/Mac, I can debug Windows assemblies without any fuss.
from fna-mghistory.
I sat down with XNA4 and looked into this. It turns out XNA actually has an unhandled Exception handler internally, which calls ShowMissingRequirementMessage. So, the messagebox only shows up when you don't catch the Exception:
If you catch this properly the messagebox will not show up, and if not, you should expect the application to crash in these scenarios (though at least a messagebox will show up, right?).
This should now behave accurately, though it should probably be tested locally.
from fna-mghistory.
Closing due to old age, but as far as I can tell this should now be accurate. If an AV customer happens to try playing with no sound card we might find out for sure... >_>
from fna-mghistory.
I'm sorry, I should have mentioned - I did test it, and it works. Thank you!
from fna-mghistory.
Related Issues (20)
- shader normalmap not work HOT 3
- [OpenGL] VMware/VBox Support? HOT 7
- [MojoShader] MOJOSHADER_glSetVertexAttribDivisor causes 'System.AccessViolationException' on some computers HOT 3
- [Keyboard] Proposal for Keyboard.GetLayoutEXT() HOT 1
- Microsoft.Xna.Framework.Input.GamePad.INTERNAL_AddInstance throws "An element with the same key already exists in the dictionary" HOT 2
- Triangle color is wrong with fairly simple shader + access violation exception HOT 7
- Unable to load a texture (.PNG) from stream HOT 9
- Initialization order mishap HOT 3
- GraphicsDeviceManager never set in Game HOT 1
- GL Object Disposal Wrappers are not thread-safe HOT 3
- DynamicSoundEffectInstance behavior incompatible with XNA4 HOT 8
- OpenGL 3.2+ Core Profile support HOT 4
- Starting game in full screen bug HOT 8
- Null reference when disposing sound effect after checking sound device exists HOT 5
- [QUESTIONS] learning, using FNA HOT 3
- More spec-compliant Touch Support HOT 34
- FNA Binary Release HOT 1
- RasterizerState.MultiSampleAntiAlias not implemented HOT 8
- Set Render Target to Another Window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fna-mghistory.