Jump to content
  • Advertisement
Sign in to follow this  

[java] GameFrame

This topic is 4982 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
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!