Jump to content
  • Advertisement
Sign in to follow this  
duranaki

[java] GameFrame

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I noticed this in an old thread.. it was a post about a problem with GameFrame java game engine from two years ago, but it was the *only* google instance relating to it and there was no solution: The error encountered was this: > init() Completed >Couldn''t create SoundEngine, using NullSoundEngine >java.lang.ClassCastException > at gameframe.implementations.jdk13x.CJavaSoundEngine.<init>(CJavaSoundEngine.java:77) > at gameframe.implementations.jdk14x.CFactory.createSoundEngine(CFactory.java:270) In case anyone else has encountered this, I wanted to post about the problem and workaround... Problem is inside CJavaSoundEngine (as you can see form the exception).. // line are retrieved in an array of Line.info type Line.Info[] aLineInfos = AudioSystem.getMixer( aMixerInfos ).getSourceLineInfo(); // later they are blindly case to DataLine.Info AudioFormat[] aFormats = ( (DataLine.Info) aLineInfos[j] ).getFormats(); In my case, the Mixer was getting several Lines that were not DataLines. I put a workaround in by excluding these: Class srcClass = aLineInfos[j].getClass(); Class destClass = DataLine.Info.class; if (destClass.isAssignableFrom(srcClass) == false) { System.out.println("Skipping non-DataLines"); continue; } AudioFormat[] aFormats = ( (DataLine.Info) aLineInfos[j] ).getFormats(); This seems to work. Using that, I was able to get the gameengine running with the examples, and sound was even working. Wanted to put it out there so future googles might pick up the solution.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!