Nex sound system design

Hi,



I have made major changes in the sound system implementation.

That is because (imho) that was pretty for playing around with small sized

files (is that english enough? :? ).

Now it supports streaming, wav and mp3 files.







A few words about mp3 :

mp3 decoding requires a new library “jl030.jar” which you can find in the lib directory.

on my computer it was impossible to play the *.mp3 file with only 2 back buffers, I needed at least 4. I’d like to have your testing results.

As the mp3 file was too heavy I did not uploaded it so you can maybe take yours and test it with the new version of TestSound.



About wave files :

There is something for what I was unable to find a solution:

The audio stream was closing each time I was trying to access it. (The audio input stream was initialized in the LWJGLWaveStream constructor in order to read the data frame by frame, in the beginning and not in read() method). To have a quick solution the wave is fully read.

That means : The Source that plays the wave data “must” have only 1 buffer.





Don’t Hesitate to criticize my work, that’ll make me doing better next time.





I’am looking for ogg documentation/libs for completing issue 61 :wink:



Please tell me your thoughts about it.



I hope you will have fun by playing your music with the jme sound engine :smiley:

Arman

Arman,



I’ve been playing with the MP3 system. Works great. I added another test that plays sound within the game loop. I called it TestSoundLoop and similar to your test, you’ll need to change the name of the mp3 it’s playing as I didn’t add the file to the repository.



I haven’t tested anything complicated such as multiple stream or positional sounds etc. But it was very easy to play the background music and worked great.



Good job!

Actually, I do have one question.



Trying to understand how the jl030.jar fits in. You still use LWJGL’s OpenAL to play the sounds, but use the jar to load the mp3 into a data format that OpenAL can understand. Is that accurate?



So, if we were to add support for JOAL and use that to play sound rather than LWJGL you’d still use to jl030.jar?



I just want to make sure we aren’t limiting our playback library by using the jar. If all it’s used for is to decode the mp3, that’s cool.

That library has three parts,

Actually it has a converter part which converts mp3 files into wav.

Another part is a simple player using the javax sound api but doeas not have 3D support.

Another part is the decoder : this part converts the mpeg layer frames(1 2 or 3) into pcm format (array of short buffers to simplify).



So each 3D sound api that can play byte buffers (shorts shifted to bytes for instance) (actually all of them) can use the decoder part in order to play the sounds.



In my simplistic view joal is just another openAL binding like LWJGL and vice-versa. So joal can use the library to play sounds.



I hope i have answered correctly the question.

Great job :slight_smile: , I will do some tests today to see if I can load an mp3 file.



tomcat