Is there any piece of code that I can just paste into my project to make my game read any type of compressed sound? I have code for wave that I got from the Internet which worked fine but wave files are too large.

My tutorial is old, and I kind of shudder when I look at the code. Even so, the music/sound code works. I've improved upon it slightly since (for instance, I made looped sound effects possible by making the SoundPlayer class more like the MusicStream class), but it's essentially the same.

I always get an exception when trying to OggClip oc= new OggClip(String); Earlier, I used a method for playing .wav files and I am in code using the same path now and have just replaced the blahblah.wav with blahblah.ogg and create and try to create an OggClip from it.I have the OggClip file in the same folder as the wave and they both have the same name.

and it never throws an IOException at me, unless I use a bad parameter, of course. what IOException message are you getting?

notice I'm using the OggClip that takes the InputStream parameter, not the one that takes a String parameter. not that it should make a difference, as the String-parameter constructor grabs a stream anyway

i tried using new OggClip("myfile.ogg")or new OggClip("C:/myclip.ogg)or the one where i use a path defined inside my game like

path=ceaw.getSoundPath();

String s=path+"myfile.ogg";and then new MyClip(s);

Nothing works, but the paths work for the myclip.wav that i used in a method that was playing wave sound.I also pu the myclip.ogg in the same folder as the OggClip.class in case the OggClip does not take a path (does it?)

Yes, seems the simplest way was to use the InputStream instead.it is now working The only thing missing in that OggPlayer is that I would want to know how long a sound file is, so if i put several different long OGG's in queue, i can start the second one when the first one is finished.

Sort...of. With a leading slash its kinda absolute... from all root dirs (virtual or not) in the classpath. So if your jar contains gfx/foo.tga you can access it from foo.bar.Game (or anywhere else) via getResourceAsStream("/gfx/foo.tga").

The only problem remaining is, Borland JBuilder seems to delete my imported class files that use to make OGG work, odd. Since most of the easyogg files are only class and not source i cannot compile them inside JBuilder pfffftttt.

I have to compile it and then run it with some other software (exe4j for instance).

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org