I currently load Clips for my .ogg audio files. However there's no real easy way to pause all the sound when things aren't active... like if I'm half-way through a sound and I pop up a menu pausing the game, I want the sound to stop. Right now I run through searching for all active sounds anywhere in the game and call .stop() on them, but that gets a little tricky. I would much rather use the GAGESound idea and just call .render() when necessary. That would perfectly solve my problem. However as far as I can tell GAGE won't load .ogg's.

I also want to introduce music. Right now I don't know how to stream music from a file, but the docs say GAGE only supports midi.

I love how well GAGESound is set up and it would be perfect for me... but only if I can get my ogg files in there Will I have any luck with this or do I need something else?

Note that this is different from the file available on the main page. Let me know if it works for you.

Now keep in mind that while the WaveEngine should now be able to load OGG files, it can only do so when the JOrbis SPI plugin is present. Also keep in mind that it will load the complete decoded clip into memory! i.e. You can save on the size of your download, but don't expect to save on your memory footprint!

Streaming OGG music is a bit easier. I don't recommend the music engine for this, but rather that you simply load the file and play the bytes like this:

You should be able to rework that to make it stream a little better. If you're using applications instead of Applets, I'd actually suggest decoding the data to disk, then memory mapping the data to a ByteBuffer. Just pump the data from a ByteBuffer into a SourceDataLine, and everything should work great. If you don't have that luxury, then I suggest keeping in mind that Vorbis files will reduce your usable CPU cycles, and that it may only be workable on faster machines.

I think I'll stick to my Clip implementation. While you say there's a risk of blocking, I've never experienced that effect. In terms of quality, Clip's are MUCH better on that note and I think even a risk of blockage is worth the quality gain. In using your library for the sound I got horrid static and screeches in some of my audio. I can't deal with that especially when I want people to buy this I still need some advice on how to stream music (and have good quality). Does any such thing exist in the world of JavaSound?

In using your library for the sound I got horrid static and screeches in some of my audio.

Static and screeching? Umm... that definitely shouldn't be happening. When I say that quality may suffer, I mean that it won't sound quite as crystal clear as some methods. It shouldn't in any way be producing the types of artifacts you're seeing. If you'd like, you can email me your current source, and I'll see if I can figure out what's going on.

Quote

I still need some advice on how to stream music (and have good quality). Does any such thing exist in the world of JavaSound?

1. Open an AudioInputSteam. 2. Open a SourceOutputStream.3. Write data from AudioInputStream to SourceOutputStream.

Just wanted to let you know that I'm still looking at this. I haven't had too much time over the weekend, so I haven't gotten very far yet. I do hope to track this down today though. What I have noticed is that the sound plays crystal clear the first time, then turns into garbage noise the second time. If I open a new line each time, the sound plays fine.

Honestly, I've never seen anything like this problem. It's almost like the PCM data is out of phase. (i.e. The line starts playing somewhere in the middle of the frame instead of at the start of the frame.) I'll let you know what I find.

By the way, my code works great with Clips now. I have all the functionality I was hoping for. If anyone is in a similar situation to where I was and would like to see code let me know! Perhaps, jbanes, you might want the code to add to GAGE? I have it so that it should never garbage collect and it pools all the Clips so that you can play multiple sounds of the same source at the same time and not have the GC run you straight to heck

By the way, my code works great with Clips now. I have all the functionality I was hoping for. If anyone is in a similar situation to where I was and would like to see code let me know! Perhaps, jbanes, you might want the code to add to GAGE? I have it so that it should never garbage collect and it pools all the Clips so that you can play multiple sounds of the same source at the same time and not have the GC run you straight to heck

Hey I'm intersted.

My current game uses straight jorbis decoding (streaming from a jar) and I'm pretty sure it consumes too much CPU for low end computers...

do you plan to make GAGESound 1.2 public via GAGE website? The downloaf link still points to the 1.1 version. Also, do you plan to offer ogg streaming in the API?

Sorry, I didn't notice this until just now.

I haven't released 1.2 because of the problems that Malohkan found. While they seem to be JVM version related, they finally turned me off to the entire idea of using JavaSound for mixing. I've was working on a much more powerful replacement (with streaming support and everything), but other projects got in the way.

As it stands right now, GAGE2D and GAGESound are horribly out of date. They need to be updated to reflect the better understanding of Java Game programming that we as a community have developed over the past several years. I've left the page up for now, but I'm not sure when I'll get back around to updating the APIs.

- looping (for music themes) - setting gain to individual clips - enhanced render loop in case too much time has passed between two calls (like when reading a new long ogg file : render becomes blocking)

On top of that, I've developped a MusicThemeManager component that handles a nice fadeout to finish the current music theme and introduce the new one (or stop)

I'll post the code in the coming weeks if someone is interested (after clean up)

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