http://javadoc.jmonkeyengine.org/com/jme3/system/AppSettings.html#setAudioRenderer-java.lang.String-
How to disable audio for SimpleApplication
I had this problem too. I disable my soundcard and use HDMI or bluetooth. If I have no sound it results in the same output as above. I never bothered to look into why. Tyvm.
I am still getting the same exception
public class MyGame extends SimpleApplication {
public static void main(String[] args){
AppSettings settings = new AppSettings(true);
settings.setAudioRenderer(null);
MyGame app = new MyGame();
app.setSettings(settings);
app.start(); // start the game
}
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1); // create cube shape
Geometry geom = new Geometry("Box", b); // create cube geometry from the shape
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube's material
rootNode.attachChild(geom); // make the cube appear in the scene
}
}
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80070490
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80070490
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80070490
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80070490
Sep 14, 2017 11:18:23 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.RuntimeException: org.lwjgl.LWJGLException: Could not locate OpenAL library.
at com.jme3.audio.lwjgl.LwjglALC.createALC(LwjglALC.java:17)
at com.jme3.audio.openal.ALAudioRenderer.initOpenAL(ALAudioRenderer.java:95)
at com.jme3.audio.openal.ALAudioRenderer.initialize(ALAudioRenderer.java:225)
at com.jme3.app.LegacyApplication.initAudio(LegacyApplication.java:283)
at com.jme3.app.LegacyApplication.initialize(LegacyApplication.java:603)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:178)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
at java.lang.Thread.run(Unknown Source)
Then you need to rebuild again or something because that code must not be being used.
If you look at the initAudio() code:
private void initAudio(){
if (settings.getAudioRenderer() != null && context.getType() != Type.Headless){
audioRenderer = JmeSystem.newAudioRenderer(settings);
audioRenderer.initialize(); // Line 283 from the exception
AudioContext.setAudioRenderer(audioRenderer);
listener = new Listener();
audioRenderer.setListener(listener);
}
}
There is no way that block runs if the audio renderer is null.
And there is nothing special about AppSettings as itās just a map. So⦠not sure what to tell you.
Edit: updated with the exception line number to prove that app settings is not setup right in that error dump.
And it actually sounds like lwjgl is unable to load the openAL.dll it extracts. Maybe youād have the same problem for physics then.
Do you have some restriction/anti Virus blocking dlls?
Anyway try a Clean & Build, Maybe something just got messed up
Seems Iām a late poster in this thread, but I stumbled onto the same issue myself. I did some research, and I believe I may have found a bug in how the AppSettingsā AudioRenderer value is handled.
Iāve based my application on the SimpleApplication class, and I got the same āCould not locate OpenAL libraryā message while using a computer without a sound card driver. After reading this thread, I tried OPās approach by creating my own AppSettings and setting its AudoRenderer value to null:
public static void main(String[] args){
AppSettings settings = new AppSettings(true);
settings.setAudioRenderer(null);
MyGame app = new MyGame();
app.setSettings(settings);
app.start();
}
As OP, I still got the same result as before. The code inside the initAudio() method mentioned by pspeed would still run, causing exceptions.
After a little debugging, I noticed that AudoRendererās value in AppSettings had reverted back to āLWJGLā and was no longer null when initAudio() was invoked. This was a bit strange, since I was sure I set it to null in the main() method. A bit more research, and I noticed that the AudioRenderer value got changed back to āLWJGLā when SimpleApplication.start() was invoked.
I checked the JME documentation to make sure I wasnāt using AppSettings in an unintentional way, but according to the information found at https://jmonkeyengine.github.io/wiki/jme3/intermediate/appsettings.html, OPās approach is correct, and I assume this is how itās intended to work.
This seems to be an issue exclusively with the AudioRenderer. I havenāt tested all settings, but the FrameRate setting, for instance, doesnāt get overwritten, and works just fine. I was able to work around the issue by setting the AudioRenderer to null on both the SimpleApplication and its context after invoking app.start(), but this feels like a hack.
Iām running JME version 3.2-stable on 64-bit linux.
I like using my computer speakers to play my music stored on my old, unusable except through the internet connection at my house, smart phone(stupid phone now) and found this same thing happens on win 7.
This requires unplugging the external pc speakers and plugging them into my phones headphone jack, thereby disabling sound on the pc.
The serenic fix does work but it sure feels strange setting things like this. In my case I only set it with context since using AppSettings has no effect.
main.start();
//Disable when jamming to the music.
main.getContext().getSettings().setAudioRenderer(null);
Feels dirty, am I supposed to do this differently?
The fact that setting the audio renderer to null doesnāt work is likely due to code like this:
ā¦that incorrectly assumes that ānullā means ānot setā instead of checking for the key.
so something like?
if (get(key) == null && other.get(key) != null) {
put(key, other.get(key));
}
No.
if( !hasKey(key) )
ā¦the other value doesnāt have null in it or this wouldnāt be an issue.
public void mergeFrom(AppSettings other) {
for (String key : other.keySet()) {
if( !hasKey(key) ) {
put(key, other.get(key));
}
}
}
Yeah, I mean I canāt promise thatās the issue here but itās probably something like that⦠it could be that.
It was just a bug I noticed when skimming the code because I had a hunch.
This did work.
public void mergeFrom(AppSettings other) {
for (String key : other.keySet()) {
if( !this.containsKey(key) ) {
put(key, other.get(key));
}
}
}
I tested it by setting these two settings since they were the only ones that I saw that take a null parameter.
settings.setRenderer(null);
settings.setAudioRenderer(null);
Without the change to AppSettings, setting setRenderer(null);
had no effect, the app would startup, the settings dialog runs, game loads normally.
With the change, the app just sits there running, no settings dialog shows so can go no further.
Without the change to AppSettings, setAudioRenderer(null);
, the setting is ignored and causes an exception, app crashes.
With the change, the setting is recognized, the settings dialog runs. game loads normally.
I ran TestCustomAppSettings and it shows as ok but not sure that means anything. is there a more robust way to test this other than these two settings?
Seems like enough testing. The code was already suspect.
As a team lead in my day job, I automatically learn to spot things like this⦠or automatically suspect them when certain symptoms arise.
Which is another way of saying, it was already a bug/bad-smell⦠so fixing it is a good idea. The fact that it also fixes the real problem you were seeing only makes it even better. (JME codebase is pretty good overall but there are plenty of these little off-smell things all over the place to those with a sensitive nose.)
Yeah, you spotted that quick. Thatās one of those pitfall bugs that takes experience to catch.
I will do a pr and refer back to here.
Thank you guys for resolving this issue. Me and probably a lot more people already had some problems with this āAL-Library not foundā-problem.
Glad to hear that this has been eradicated
Its not eradicated, the way to avoid the problem has been improved. Defensive coding at its best.
In a dream world, not having a sound card or disabled sound would just be ignored.