A fellow coder is trying to get a Java 2D based game out. However, they'd like to be able to compress their background music down into OGG files. How do you play OGG files with Java Sound? Well, I say, you just go and pick up JOrbis and JOgg and play it through that (I've done the same thing using OpenAL).

He does that, but it turns out the examples from JOrbis and pretty intricate and don't make alot of useful sense. Especially given in the pure java world we're used to doing simple thing like:

Clip clip = new Clip("mysound.wav");
clip.loop();

Or code to that effect (been a while). Anyway, I offered to wrap JOrbis up to be a bit easier to use, so here it is.. EasyOGG. A sample would be:

OggClip clip = new OggClip("mymusic.ogg");
clip.loop();

Which will load the mymusic.ogg from your classpath and loop it over and over through a Java Sound output. It'll also handle random input streams for those that still believe direct file access is the right way to go.

Mostly the code is taken and repackaged from the JOggPlayer example given with JOrbis so all kudos to them.

EDIT: EasyOgg got an update. The new version (0.2) is here

EDIT: EasyOgg got another update. The new version (0.3) is here

EDIT: EasyOgg got another update. The new version (0.4) is here

EDIT: EasyOgg got another update. The new version (0.5) is here

EDIT: EasyOgg got another update. The new version (0.6) is here

many thanks kev! that works

many thanks kev! that works perfect for me! glad someone is smart enough to figure it out and save me from a headache :)

Hey Kevin. I'd just like to

Hey Kevin. I'd just like to say that I've been pulling my hair out with the audio in my game for the last week (I will spare you the gory details), and your EasyOgg just descended from heaven and saved the day. Thanks. :)

Many, MANY thanks for

Many, MANY thanks for creating EasyOgg. Your intro paragraph ("...[writing] a 2D game...the examples from JOrbis and pretty intricate and don't make alot of useful sense. Especially given in the pure java world we're used to...") could have been written about the programming for Motherload Unlimited, the game project my friends and I have been working on.

EasyOgg is exactly what we've been looking for. Thanks again.