A couple of slick-util Audio questions

Started by CodeBunny, October 30, 2010, 14:08:55

Previous topic - Next topic

CodeBunny

I've been messing around with Slick-Util's Audio setup, and for the most part I haven't had too much trouble. However, a few things have been giving me some problems.

First off, what's the best way to pause and resume sound (for both streaming and non-streaming audio)? I've tried storing the audio position and calling stop, and then using setPosition() to restore its previous state on resume. It works perfectly fine with a clip. Only problem is, I seem to run into trouble with streaming audio. The game doesn't actually crash, but it seems to reset the buffer and not allow it to queue more data - resulting in it playing the beginning of the audio only (and if it's looping, it only loops that).

Also, what's the proper way to set the gain in the "playAsSoundEffect" or "playAsMusic" functions? I've messed around with it a bit, and it seems like you can put 0.5f for half volume, 0.25f for quarter, and so on, but I can't seem to supply 2f to get it to play at twice normal volume (or higher, as the case may be). Is this intended, or is there a way to get sounds to play louder than normal?

CodeBunny

Well, I asked this question over at the Slick forums, and apparently there's a bug with Slick-Util's streaming audio code that doesn't allow the position to be set appropriately.

Does anybody have any fixes for this?